From 5d88ffefd5480acbe3d97050ee9b93df0f56d67c Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Tue, 20 Feb 2024 18:00:51 +1100 Subject: [PATCH] Update save.py --- unsloth/save.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unsloth/save.py b/unsloth/save.py index 0a71b7425f..221ccb3e76 100644 --- a/unsloth/save.py +++ b/unsloth/save.py @@ -310,7 +310,7 @@ def unsloth_save_model( model.save_pretrained(**save_pretrained_settings) # Update model tag - if push_to_hub: + if push_to_hub and hasattr(model, "config"): _ = upload_to_huggingface( model, save_pretrained_settings["save_directory"], token, "finetuned", "trl", file_location = None, @@ -484,7 +484,7 @@ def unsloth_save_model( print("Done.") # Update model tag - if push_to_hub: + if push_to_hub and hasattr(model, "config"): _ = upload_to_huggingface( model, save_pretrained_settings["save_directory"], token, "finetuned", "trl", file_location = None,