How to unload an adapter in PEFT?
Hello,I’m using thePeftModel.from_pretrained(base_model, lora_model_id)method to load a LoRA adapter on a base LLM. The method seems to be directly modifying thebase_modelweights.Is there a way to “unload” an adapter to get the originalbase_modelweights back? I want to be able to switch between adapters in real-time for multi-task inference.Thanks!
2023-08-10T08:21:47Z
Yes - check this:LoRAThere’s a exactly what you asked for, theunload()method.However, I’m not sure how to load the LoRA adapter back after the unload. I guess it’smodel = PeftModel.from_pretrained(model, peft_model_id)because there seems to be noload()method. Please let me know if you find a better solution.
2024-01-15T23:28:35Z
Just stumbled across this post, not sure if it is something other folks are looking into, but it seems like the latest versions of transformers/peft has a methodunload_adaptersandload_adapters.Here in the docs.  This made this much easier!