# How to save peft weight every epoch?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-peft-weight-every-epoch%2F39061%3E%5C
**Category:** 🤗Transformers\
**Created:** [May 8, 2023, 8:38am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-peft-weight-every-epoch%2F39061 "2023-05-08T08:38:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiami](https://avatars.discourse-cdn.com/v4/letter/x/dc4da7/32.png) [@xiami](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fxiami)%5C
**Post date:** [May 8, 2023, 8:38am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-peft-weight-every-epoch%2F39061%2F1 "2023-05-08T08:38:39Z")

</div>

With training\_args set as,

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/3/36de471edb9ca8c9ab74fa0b7885cfc4ce717a77.png)  
training with lora will save entire weight every epoch. But I think this weight can not be loaded? Since it will report many lora weight is not loaded correctly with AutoModelForCausalLM.from\_pretrained.

PEFT’s doc says i can use model.save\_pretrained(“output\_dir”) to get adapter\_model.bin. But it only does this at the end of training using trainer.

Is there a agrs I miss can save adapter\_model.bin every epoch or I have to write a callback myself?

Thank you!

---

<div class="post-metadata">

**Author:** ![lucasjin](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@lucasjin](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flucasjin)%5C
**Post date:** [June 20, 2023, 3:11am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-peft-weight-every-epoch%2F39061%2F2 "2023-06-20T03:11:06Z")

</div>

No, no such as way
