Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Update loader.py

Daniel Han1a6722792316
diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py
index ffc0dc3a5ed..3f7264fe393 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 \