Open LazerJesus opened 1 year ago
Hi @ArmelRandy This also isn't clear.
There are 4 different ways to save a model.
model.save_pretrained(PATH)
torch.save({'model_state_dict': model.state_dict()})
trainer.save_model(PATH)
and
TrainerArgs(save_strategy='steps')
.
Which one can I use to store the PeftModelForCausalLM(AutoModelForCausalLM())
and how to load it again?
(I like TrainerArgs least because I can't call it.)
(and just using python finetune.py
isn't an option.)
Try replacing
model = get_peft_model(model, lora_config)
with
from peft import PeftModel
model = PeftModel.from_pretrained(model, <YOUR CHECKPOINT PATH>,is_trainable = True)
Does it work?
I am trying to further finetune
Starchat-Beta
, save my progress, load my progress, and continue training. But whatever I do, it doesn't come together. Whenever I load my progress and continue training, my loss starts back from zero (3.xxx in my case). I'll run you through my code and then the problem.I have two alternatives saved to disk. Lets restart and try either of these approaches
First the huggingface docs approach: I now have three sets of weights.
But I only have two opportunities to load weights.
AutoModelForCausalLM.from_pretrained
get_peft_model
orPeftModel.from_pretrained
Neither works. training restarts at a loss of 3.x.
Second approach: Load the 60bg instead of the old starchat-beta repo model.
get_peft_model("/notebooks/torch_model/pytorch_model.bin", peftconfig)
Also doesn't work. The
print_trainable_parameters(model)
drops totrainable: 0.02%
and training restarts at a loss of 3.x