From e2f8b79c9d4d50ab33cff55299d759b13c9dc417 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 20 Dec 2024 02:40:42 -0800 Subject: [PATCH] Update save.py --- unsloth/save.py | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/unsloth/save.py b/unsloth/save.py index 027d88b2fc..ce5ee5d38e 100644 --- a/unsloth/save.py +++ b/unsloth/save.py @@ -2129,17 +2129,31 @@ def unsloth_generic_save( ): if token is None and push_to_hub: token = get_token() - merge_and_overwrite_lora( - get_model_name, - create_huggingface_repo, - model, - save_location = save_directory, - push_to_hub = push_to_hub, - token = token, - upload_location = save_directory if push_to_hub else None, - low_disk_space_usage = True, - private = private, - ) + import unsloth_zoo + if Version(unsloth_zoo.__version__) <= Version("2024.12.1"): + merge_and_overwrite_lora( + get_model_name, + create_huggingface_repo, + model, + save_location = save_directory, + push_to_hub = push_to_hub, + token = token, + upload_location = save_directory if push_to_hub else None, + low_disk_space_usage = True, + private = private, + ) + else: + merge_and_overwrite_lora( + get_model_name, + model, + save_directory = save_directory, + push_to_hub = push_to_hub, + private = private, + token = token, + low_disk_space_usage = False, + use_temp_file = False, + ) + pass return pass