Correct way of identifying when to save config

This commit is contained in:
nemo
2025-10-16 16:07:22 +02:00
parent 6fb8539159
commit 6c2fd8970c

View File

@@ -99,7 +99,7 @@ def save_checkpoint(
pretrained_dir = checkpoint_dir / PRETRAINED_MODEL_DIR
policy.save_pretrained(pretrained_dir)
cfg.save_pretrained(pretrained_dir)
if cfg.use_peft:
if cfg.peft is not None:
# When using PEFT, policy.save_pretrained will only write the adapter weights + config, not the
# policy config which we need for loading the model. In this case we'll write it ourselves.
policy.config.save_pretrained(pretrained_dir)