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 vision.py

Daniel Hanc43a785e7ca7
diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py
index 1f2d99d2acc..db140c4aed5 100644
--- a/unsloth/models/vision.py
+++ b/unsloth/models/vision.py
@@ -169,17 +169,17 @@ def unsloth_base_fast_generate(
autocaster = torch.autocast(device_type = "cuda", dtype = dtype)
# Prepare LoRA
- state_dict = convert_lora_modules(self, dtype = dtype)
+ # state_dict = convert_lora_modules(self, dtype = dtype)
# Set compile dynamic shapes
- # torch._dynamo.mark_static(input_ids, 0)
- # torch._dynamo.mark_dynamic(input_ids, 1)
- # if "attention_mask" in kwargs:
- # torch._dynamo.mark_static(kwargs["attention_mask"], 0)
- # torch._dynamo.mark_dynamic(kwargs["attention_mask"], 1)
- # if "token_type_ids" in kwargs:
- # torch._dynamo.mark_static(kwargs["token_type_ids"], 0)
- # torch._dynamo.mark_dynamic(kwargs["token_type_ids"], 1)
+ torch._dynamo.mark_static(input_ids, 0)
+ torch._dynamo.mark_dynamic(input_ids, 1)
+ if "attention_mask" in kwargs:
+ torch._dynamo.mark_static(kwargs["attention_mask"], 0)
+ torch._dynamo.mark_dynamic(kwargs["attention_mask"], 1)
+ if "token_type_ids" in kwargs:
+ torch._dynamo.mark_static(kwargs["token_type_ids"], 0)
+ torch._dynamo.mark_dynamic(kwargs["token_type_ids"], 1)
# Fix generation_config
# Use hybrid if sliding window seen, otherwise try static
@@ -212,7 +212,7 @@ def unsloth_base_fast_generate(
output = self._old_generate(*args, **kwargs)
finally:
pass
- return_lora_modules(self, state_dict, torch.float32)
+ # return_lora_modules(self, state_dict, torch.float32)
pass
FastBaseModel.for_training(self)