# How to unload an adapter in PEFT?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-unload-an-adapter-in-peft%2F48142%3E%5C
**Category:** 🤗Accelerate\
**Created:** [July 25, 2023, 8:12pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-unload-an-adapter-in-peft%2F48142 "2023-07-25T20:12:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arorahimanshu](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@arorahimanshu](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Farorahimanshu)%5C
**Post date:** [July 25, 2023, 8:12pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-unload-an-adapter-in-peft%2F48142%2F1 "2023-07-25T20:12:18Z")

</div>

Hello,

I’m using the `PeftModel.from_pretrained(base_model, lora_model_id)` method to load a LoRA adapter on a base LLM. The method seems to be directly modifying the `base_model` weights.

Is there a way to “unload” an adapter to get the original `base_model` weights back? I want to be able to switch between adapters in real-time for multi-task inference.

Thanks!

---

<div class="post-metadata">

**Author:** ![dmitrijsk](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@dmitrijsk](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdmitrijsk)%5C
**Post date:** [August 10, 2023, 8:21am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-unload-an-adapter-in-peft%2F48142%2F2 "2023-08-10T08:21:47Z")

</div>

Yes - check this: [LoRA](https://huggingface.co/docs/peft/conceptual_guides/lora#utils-for-lora)  
There’s a exactly what you asked for, the `unload()` method.

However, I’m not sure how to load the LoRA adapter back after the unload. I guess it’s `model = PeftModel.from_pretrained(model, peft_model_id)` because there seems to be no `load()` method. Please let me know if you find a better solution.

---

<div class="post-metadata">

**Author:** ![bpben](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/bpben/32/23013_2.png) [@bpben](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbpben)%5C
**Post date:** [January 15, 2024, 11:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-unload-an-adapter-in-peft%2F48142%2F3 "2024-01-15T23:28:35Z")

</div>

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 method `unload_adapters` and `load_adapters`. [Here in the docs](https://huggingface.co/docs/transformers/main/peft#enable-and-disable-adapters). This made this much easier!
