Update loader.py

This commit is contained in:
Daniel Han 2025-03-25 23:15:14 -07:00
commit 329a3a6663

View file

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