From cdf63907e6a71e6a052b7fa8ca8cb2136cb828eb Mon Sep 17 00:00:00 2001 From: DoubleMathew Date: Thu, 21 Aug 2025 18:54:39 -0500 Subject: [PATCH] adallow float32 dtype in FastLanguageModel (#3204) --- unsloth/models/loader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 3aed8654f8..96e71075e6 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)