mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 14:22:51 +08:00
set use_cache before saving model
Former-commit-id: 395ed1cf1b811a21fe61dd6b57040653ce98ba49
This commit is contained in:
parent
b9d56b2ac5
commit
023f9367fc
@ -105,11 +105,13 @@ class PeftTrainer(Seq2SeqTrainer):
|
||||
if self.finetuning_args.finetuning_type == "lora":
|
||||
backbone_model.save_pretrained(output_dir, state_dict=get_state_dict(backbone_model))
|
||||
else: # freeze/full tuning
|
||||
backbone_model.config.use_cache = True
|
||||
backbone_model.save_pretrained(
|
||||
output_dir,
|
||||
state_dict=get_state_dict(backbone_model),
|
||||
safe_serialization=self.args.save_safetensors
|
||||
)
|
||||
backbone_model.config.use_cache = False
|
||||
if self.tokenizer is not None:
|
||||
self.tokenizer.save_pretrained(output_dir)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user