Update save.py

This commit is contained in:
Daniel Han-Chen 2024-03-11 02:15:33 +11:00
commit b5d3d63df5

View file

@ -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