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
forced precision
Daniel Haneef49713e4be
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.pyindex 1a8fff9ada8..c13b2286f30 100644--- a/unsloth/models/_utils.py+++ b/unsloth/models/_utils.py@@ -986,8 +986,8 @@ def _unsloth_pre_compute_loss(self, model, inputs, *args, **kwargs):"Read more on gradient accumulation issues here: https://unsloth.ai/blog/gradient")pass- with torch.autocast(device_type = "cuda", dtype = torch.float32):- outputs = self._old_compute_loss(model, inputs, *args, **kwargs)+ # with torch.autocast(device_type = "cuda", dtype = torch.float32):+ outputs = self._old_compute_loss(model, inputs, *args, **kwargs)return outputspassdiff --git a/unsloth/models/vision.py b/unsloth/models/vision.pyindex 73497e70a73..26e9edffd3e 100644--- a/unsloth/models/vision.py+++ b/unsloth/models/vision.py@@ -65,6 +65,9 @@ __all__ = ["FastBaseModel",]+global FORCE_FLOAT32+FORCE_FLOAT32 = ["gemma3"]+def unsloth_base_fast_generate(self,@@ -178,6 +181,14 @@ class FastBaseModel:assert(dtype == torch.float16 or dtype == torch.bfloat16 or dtype == torch.float32)+ global FORCE_FLOAT32+ os.environ["UNSLOTH_FORCE_FLOAT32"] = "0"+ for disable_name in FORCE_FLOAT32:+ if disable_name.lower() == model_type_arch.lower() and dtype == torch.float16:+ print(f"Unsloth: Using float16 precision for {model_type_arch} won't work! Using float32.")+ os.environ["UNSLOTH_FORCE_FLOAT32"] = "1"+ break+bnb_config = Noneif full_finetuning and (load_in_4bit or load_in_8bit):print("Unsloth: You selected full finetuning support, but 4bit / 8bit is enabled - disabling LoRA / QLoRA.")