adallow float32 dtype in FastLanguageModel (#3204)

This commit is contained in:
DoubleMathew 2025-08-21 18:54:39 -05:00 committed by GitHub
commit cdf63907e6

View file

@ -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)