# How do I merge a lora adapter back into the model weights?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-merge-a-lora-adapter-back-into-the-model-weights%2F51529%3E%5C
**Category:** Beginners\
**Created:** [August 21, 2023, 1:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-merge-a-lora-adapter-back-into-the-model-weights%2F51529 "2023-08-21T13:52:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![baebee](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/baebee/32/21964_2.png) [@baebee](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbaebee)%5C
**Post date:** [August 21, 2023, 1:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-merge-a-lora-adapter-back-into-the-model-weights%2F51529%2F1 "2023-08-21T13:52:36Z")

</div>

I’m using this colab I found on youtube, and I dont really have a clue on how I can merge adapters to models.

> **[Google Colaboratory](https://colab.research.google.com/drive/12dVqXZMIVxGI0uutU6HG9RWbWPXL3vts?usp=sharing)**

---

<div class="post-metadata">

**Author:** ![sm226](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sm226](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsm226)%5C
**Post date:** [August 23, 2023, 2:44am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-do-i-merge-a-lora-adapter-back-into-the-model-weights%2F51529%2F2 "2023-08-23T02:44:47Z")

</div>

Based on the link to the code:

Your peft adapter would be saved in ‘outputs’ via:  
model\_to\_save.save\_pretrained(“outputs”)

To load the peft adapter and merge with the base model try:

from peft import PeftModel  
peft\_model = PeftModel.from\_pretrained(model,‘outputs’)
