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.

adallow float32 dtype in FastLanguageModel (#3204)

DoubleMathew651970094d9a
diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py
index 3aed8654f81..96e71075e6d 100644
--- a/unsloth/models/loader.py
+++ b/unsloth/models/loader.py
@@ -145,7 +145,8 @@ class FastLanguageModel(FastLlamaModel):
if token is None: token = get_token()
if isinstance(dtype, str) and dtype in ["float16", "bfloat16"]:
dtype = getattr(torch, dtype)
- assert (dtype is None or dtype == torch.float16 or dtype == torch.bfloat16)
+ assert (dtype is None or dtype == torch.float16 or dtype == torch.bfloat16
+ or dtype == torch.float32)
if use_gradient_checkpointing == "unsloth":
patch_unsloth_smart_gradient_checkpointing(dtype = dtype)