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
Update vision.py
Daniel Han69ab65dfc7e2
diff --git a/unsloth/models/vision.py b/unsloth/models/vision.pyindex c5cd57de97e..0497ce43798 100644--- a/unsloth/models/vision.py+++ b/unsloth/models/vision.py@@ -177,25 +177,30 @@ def unsloth_base_fast_generate(if "attention_mask" in kwargs:torch._dynamo.mark_static(kwargs["attention_mask"], 0)torch._dynamo.mark_dynamic(kwargs["attention_mask"], 1)- if "pixel_values" in kwargs:- print(kwargs["pixel_values"].shape)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- cache_implementation = getattr(self.config, "cache_implementation", "static")+ # Use hybrid if sliding window seen, otherwise try static+ cache_implementation = getattr(self.config, "cache_implementation", None)+ if cache_implementation is None:+ swa = getattr(getattr(model.config, "text_config", model.config), "sliding_window", None)+ if swa == 0 or type(swa) is not int:+ cache_implementation = "static"+ else:+ cache_implementation = "hybrid"+ if getattr(self, "_supports_static_cache", True):+ cache_implementation = "static"+ else:+ cache_implementation = Noneif "generation_config" in kwargs:kwargs["generation_config"].cache_implementation = cache_implementationkwargs["generation_config"].compile_config = _compile_config- elif getattr(self, "_supports_static_cache", True):- kwargs["cache_implementation"] = cache_implementation- kwargs["compile_config"] = _compile_configelse:- kwargs["cache_implementation"] = "hybrid"+ kwargs["cache_implementation"] = cache_implementationkwargs["compile_config"] = _compile_configpass- print(kwargs)with torch.inference_mode(), autocaster:try: