From cd71c1e64c5b03032faa3368d6589e557e23022d Mon Sep 17 00:00:00 2001 From: Alexander Kovalchuk Date: Tue, 6 Feb 2024 16:26:07 +0300 Subject: [PATCH] Fixed saving for models that don't have _name_or_path in config --- src/peft/peft_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peft/peft_model.py b/src/peft/peft_model.py index 63a09fad64..a1396a2d7c 100644 --- a/src/peft/peft_model.py +++ b/src/peft/peft_model.py @@ -784,7 +784,7 @@ def create_or_update_model_card(self, output_dir: str): model_config = getattr(self, "config", None) if hasattr(model_config, "to_dict"): model_config = model_config.to_dict() - if model_config is not None: + if model_config is not None and "_name_or_path" in model_config: card.data["base_model"] = model_config["_name_or_path"] lines = card.text.splitlines()