From b5d3d63df5553ae92b07322a493af7d22a71c75d Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Mon, 11 Mar 2024 02:15:33 +1100 Subject: [PATCH] Update save.py --- unsloth/save.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unsloth/save.py b/unsloth/save.py index 42d326e128..d1a00e189a 100644 --- a/unsloth/save.py +++ b/unsloth/save.py @@ -203,7 +203,11 @@ def unsloth_save_model( print("Unsloth: Merging 4bit and LoRA weights to 4bit...") print("This might take 5 minutes...") - model = model.merge_and_unload() + + # Counteract no LoRA adapters! + if hasattr(model, "merge_and_unload"): + model = model.merge_and_unload() + pass print("Done.") pass