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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Revert
Daniel Handa0048d2b540
diff --git a/unsloth/models/loader.py b/unsloth/models/loader.pyindex 6ddb7d66190..1b54c8c7fc7 100644--- a/unsloth/models/loader.py+++ b/unsloth/models/loader.py@@ -609,30 +609,30 @@ class FastModel(FastBaseModel):patch_loss_functions(torch_compile = False)model_types = unsloth_compile_transformers(model_name = model_name,- sdpa_dynamic_mask = False,- sdpa_bool_masks = False,- sdpa_gqa_replace = False,- sdpa_dynamic_compile = False,- compile_attention = False,- disable_causal_masks = False,- compile_torch_modules = False,- compile_custom_modules = False,- compile_function_calls = False,- fuse_lm_head = False,- gradient_checkpointing = False,- manual_replacements = False,- fast_lora_forwards = False,+ 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 = False,- epilogue_fusion = False,+ accurate_accumulation = True,+ epilogue_fusion = True,max_autotune = False,- shape_padding = False,+ shape_padding = True,cudagraphs = False,debug = False,- fullgraph = False,+ fullgraph = fullgraph,import_from_cache = False,disable = False,- return_logits = False,+ return_logits = return_logits,)pass@@ -668,7 +668,7 @@ class FastModel(FastBaseModel):use_gradient_checkpointing = use_gradient_checkpointing,*args, **kwargs,)-+if resize_model_vocab is not None:model.resize_token_embeddings(resize_model_vocab)passdiff --git a/unsloth/models/mapper.py b/unsloth/models/mapper.pyindex b4facf729c2..cb0d73c5900 100644--- a/unsloth/models/mapper.py+++ b/unsloth/models/mapper.py@@ -638,37 +638,45 @@ __INT_TO_FLOAT_MAPPER = \"Qwen/QwQ-32B","unsloth/QwQ-32B-bnb-4bit",),- "unsloth/gemma-3-1b-it-bnb-4bit" : (+ "unsloth/gemma-3-1b-it-unsloth-bnb-4bit" : ("unsloth/gemma-3-1b-it","google/gemma-3-1b-it",+ "unsloth/gemma-3-1b-it-bnb-4bit",),- "unsloth/gemma-3-4b-it-bnb-4bit" : (+ "unsloth/gemma-3-4b-it-unsloth-bnb-4bit" : ("unsloth/gemma-3-4b-it","google/gemma-3-4b-it",+ "unsloth/gemma-3-4b-it-bnb-4bit",),- "unsloth/gemma-3-12b-it-bnb-4bit" : (+ "unsloth/gemma-3-12b-it-unsloth-bnb-4bit" : ("unsloth/gemma-3-12b-it","google/gemma-3-12b-it",+ "unsloth/gemma-3-12b-it-bnb-4bit",),- "unsloth/gemma-3-27b-it-bnb-4bit" : (+ "unsloth/gemma-3-27b-it-unsloth-bnb-4bit" : ("unsloth/gemma-3-27b-it","google/gemma-3-27b-it",+ "unsloth/gemma-3-27b-it-bnb-4bit",),- "unsloth/gemma-3-1b-pt-bnb-4bit" : (+ "unsloth/gemma-3-1b-pt-unsloth-bnb-4bit" : ("unsloth/gemma-3-1b-pt","google/gemma-3-1b-pt",+ "unsloth/gemma-3-1b-pt-bnb-4bit",),- "unsloth/gemma-3-4b-pt-bnb-4bit" : (+ "unsloth/gemma-3-4b-pt-unsloth-bnb-4bit" : ("unsloth/gemma-3-4b-pt","google/gemma-3-4b-pt",+ "unsloth/gemma-3-4b-pt-bnb-4bit",),- "unsloth/gemma-3-12b-pt-bnb-4bit" : (+ "unsloth/gemma-3-12b-pt-unsloth-bnb-4bit" : ("unsloth/gemma-3-12b-pt","google/gemma-3-12b-pt",+ "unsloth/gemma-3-12b-pt-bnb-4bit",),- "unsloth/gemma-3-27b-pt-bnb-4bit" : (+ "unsloth/gemma-3-27b-pt-unsloth-bnb-4bit" : ("unsloth/gemma-3-27b-pt","google/gemma-3-27b-pt",+ "unsloth/gemma-3-27b-pt-bnb-4bit",),}diff --git a/unsloth/models/vision.py b/unsloth/models/vision.pyindex b214ecec846..73497e70a73 100644--- a/unsloth/models/vision.py+++ b/unsloth/models/vision.py@@ -245,22 +245,22 @@ class FastBaseModel:auto_processor = AutoProcessor if auto_model is AutoModelForVision2Seq else AutoTokenizertokenizer = auto_processor.from_pretrained(tokenizer_name,- padding_side = "left",+ padding_side = "right",token = token,)# Add padding side as wellif hasattr(tokenizer, "tokenizer"):- tokenizer.tokenizer.padding_side = "left"+ tokenizer.tokenizer.padding_side = "right"- # model, tokenizer = patch_tokenizer(model, tokenizer)- # model = post_patch_loss_function(model)+ model, tokenizer = patch_tokenizer(model, tokenizer)+ model = post_patch_loss_function(model)# Fix other stuff like BnB compute data types- # model, tokenizer = patch_model_and_tokenizer(- # model,- # tokenizer,- # downcast_rope = False,- # fix_embeddings = False,- # )+ model, tokenizer = patch_model_and_tokenizer(+ model,+ tokenizer,+ downcast_rope = False,+ fix_embeddings = False,+ )# Log Unsloth version for future fastpaths for inferenceif hasattr(model, "config"):@@ -297,10 +297,10 @@ class FastBaseModel:model.generate = types.MethodType(unsloth_base_fast_generate, model)# Post patches- # model = FastBaseModel.post_patch_model(- # model,- # use_gradient_checkpointing = use_gradient_checkpointing,- # )+ model = FastBaseModel.post_patch_model(+ model,+ use_gradient_checkpointing = use_gradient_checkpointing,+ )# Clear deleted GPU itemsfor _ in range(3):gc.collect()