In the examples from PEFT source code, I found two ways to load the model:
model = PeftModel.from_pretrained(model, peft_model_id, device_map="auto", max_memory=max_memory)
model = get_peft_model(model, peft_config)
Is there any difference between them?
Im expecting someone gonna help me to understand this
well, with from_pretrained
, the adapter of the peft model will be frozen by default. U can change it by tuning the configuration is_trainable
. However, in get_peft_model
, the parameters are not frozen, u will get a trainable model for SFT.
Besides, you can fine-tune a fine-tuned peft model by using from_pretrained
and set is_trainable = True
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With