falcon force float32 on sm<75 machines (#3026)

This commit is contained in:
DoubleMathew 2025-07-22 15:18:42 -05:00 committed by GitHub
commit f2ef5bd16b

View file

@ -584,6 +584,11 @@ class FastModel(FastBaseModel):
if transformers_version < Version("4.53.0"):
raise RuntimeError("Unsloth: Gemma 3N only works on transformers >= 4.53.0" + LATEST)
elif "falcon-h1" in lowered_model_name:
os.environ["UNSLOTH_FORCE_CUSTOM_DTYPE"] = \
"float16;torch.float32;torch.float16;"\
"if name.endswith(('q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj', 'head')): module.to(torch.float16);"
os.environ["TRITON_F32_DEFAULT"] = "ieee"
else:
for check_model_name in DISABLE_COMPILE_MODEL_NAMES:
if check_model_name in lowered_model_name: