#How to integrate the checkpoint after finetuned the model finished into the base model using unsloth

1 messages · Page 1 of 1 (latest)

vocal hollow
#

Hi everyone, I have the question about how to integrate the checkpoint after finetuned the model finished into the base model using unsloth.
After I got the last Checkpoint from the finetuned. I added the checkpoint into the base model as follows in this code:

I'm not sure the step 3 for load adapter checkpoint in the code is correct or not? Because I got the answer that is not different from running the Phi4 base model normally.

Note:
I use the dataset for finetuning the model around 10k records as a format as follows:
<|im_start|>system<|im_sep|>You are a large language model specializing in Thai Language. Your job is to learn the structure of Thai language, consist of appropriate grammar, sentence structures, and connectors.<|im_end|>
<|im_start|>user<|im_sep|>คณิตศาสตร์<|im_end|>
<|im_start|>assistant<|im_sep|>คณิตศาสตร์ คือ วิชาที่ศึกษาเกี่ยวกับจำนวน ปริมาณ...<|im_end|>

knotty venture
#

Phi4_model.save_pretrained_merged()

vocal hollow
rich pawn
#

You can do that step after finetuning or after loading the adapter. It merges the base weights and the adapter so when you load the model later you won't need to explicity load the adapter.

#

But i also noticed that your call to get_peft_model doesn't include arguments after model so it's using the default. You should make sure that the adapter you've checkpointed correspond to same peft setup/arguments.

#

you're also passing an adapter_name, unless you've explicitly named your adapter "Checkpoint_285" it won't work. I think you can remove that arg if you havent named youre adapter at all

#

but finally you can verify whether the adapter weights changed before and after load_adapter. Most free chat model's should be able to walk you through that