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

Daniel Han47a2492f87c2
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index cb694168919..2375fff4d86 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -1017,12 +1017,13 @@ def _unsloth_pre_compute_loss(self, model, inputs, *args, **kwargs):
)
pass
- if os.environ.get("UNSLOTH_FORCE_FLOAT32", "0") == "0":
- autocaster = contextlib.nullcontext()
- else:
- autocaster = torch.autocast(device_type = "cuda", dtype = torch.float32)
- with autocaster:
- outputs = self._old_compute_loss(model, inputs, *args, **kwargs)
+ # if os.environ.get("UNSLOTH_FORCE_FLOAT32", "0") == "0":
+ # autocaster = contextlib.nullcontext()
+ # else:
+ # autocaster = torch.autocast(device_type = "cuda", dtype = torch.float32)
+ # with autocaster:
+ # outputs = self._old_compute_loss(model, inputs, *args, **kwargs)
+ outputs = self._old_compute_loss(model, inputs, *args, **kwargs)
return outputs
pass