bugfix python runtime

This commit is contained in:
游雁 2024-07-25 15:13:04 +08:00
parent 15ef54a3ce
commit a20157435e

View File

@ -347,7 +347,10 @@ class Trainer:
if self.use_lora:
lora_outdir = f"{self.output_dir}/lora-{ckpt_name}"
os.makedirs(lora_outdir, exist_ok=True)
model.llm.save_pretrained(lora_outdir)
if hasattr(model, "module"):
model.module.llm.save_pretrained(lora_outdir)
else:
model.llm.save_pretrained(lora_outdir)
filename = os.path.join(self.output_dir, ckpt_name)
torch.save(state, filename)