From fce9e8286694bf665f14445ac8d1a0bdaa155ebd Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 25 Mar 2025 23:13:26 -0700 Subject: [PATCH] Update loader.py --- unsloth/models/loader.py | 72 ++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 670e082580..ffc0dc3a5e 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -481,8 +481,8 @@ class FastModel(FastBaseModel): dtype = torch.float16 assert(dtype in (torch.float16, torch.bfloat16, torch.float32)) - patch_compiled_autograd() - patch_compiling_bitsandbytes() + # patch_compiled_autograd() + # patch_compiling_bitsandbytes() if full_finetuning and (load_in_4bit or load_in_8bit): print("Unsloth: You selected full finetuning support, but 4bit / 8bit is enabled - disabling LoRA / QLoRA.") @@ -661,40 +661,40 @@ class FastModel(FastBaseModel): if use_gradient_checkpointing == "unsloth": patch_unsloth_smart_gradient_checkpointing(dtype = dtype) - with redirector: - patch_loss_functions(torch_compile = False) - model_types = unsloth_compile_transformers( - dtype = dtype, - model_name = model_name, - model_types = model_types, - token = token, - sdpa_dynamic_mask = True, - sdpa_bool_masks = True, - sdpa_gqa_replace = True, - sdpa_dynamic_compile = True, - compile_attention = True, - disable_causal_masks = True, - compile_torch_modules = True, - compile_custom_modules = True, - compile_function_calls = True, - fuse_lm_head = True, - gradient_checkpointing = True, - manual_replacements = True, - fast_lora_forwards = True, - fast_residual_stream = False, - accurate_accumulation = True, - epilogue_fusion = True, - max_autotune = False, - shape_padding = True, - cudagraphs = False, - debug = False, - fullgraph = fullgraph, - import_from_cache = False, - disable = False, - return_logits = return_logits, - trust_remote_code = trust_remote_code, - ) - pass + # with redirector: + # patch_loss_functions(torch_compile = False) + # model_types = unsloth_compile_transformers( + # dtype = dtype, + # model_name = model_name, + # model_types = model_types, + # token = token, + # sdpa_dynamic_mask = True, + # sdpa_bool_masks = True, + # sdpa_gqa_replace = True, + # sdpa_dynamic_compile = True, + # compile_attention = True, + # disable_causal_masks = True, + # compile_torch_modules = True, + # compile_custom_modules = True, + # compile_function_calls = True, + # fuse_lm_head = True, + # gradient_checkpointing = True, + # manual_replacements = True, + # fast_lora_forwards = True, + # fast_residual_stream = False, + # accurate_accumulation = True, + # epilogue_fusion = True, + # max_autotune = False, + # shape_padding = True, + # cudagraphs = False, + # debug = False, + # fullgraph = fullgraph, + # import_from_cache = False, + # disable = False, + # return_logits = return_logits, + # trust_remote_code = trust_remote_code, + # ) + # pass # Check if this is local model since the tokenizer gets overwritten if os.path.exists(os.path.join(old_model_name, "tokenizer_config.json")) and \