Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between PeftModel.from_pretrained & get_peft_model in initiating a peft model?

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

like image 240
EkoMickA Avatar asked Aug 31 '25 01:08

EkoMickA


1 Answers

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.

like image 88
Rayden.Z Avatar answered Sep 03 '25 10:09

Rayden.Z