From 329a3a66632397fa9bd2cf8e76efb7e49a7a352a Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 25 Mar 2025 23:15:14 -0700 Subject: [PATCH] Update loader.py --- unsloth/models/loader.py | 68 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index ffc0dc3a5e..3f7264fe39 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -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 \