gpt-oss manually call temporary patch (#3104)

Co-authored-by: Mathew Mathew <mathew@Mathews-MacBook-Pro.local>
This commit is contained in:
DoubleMathew 2025-08-06 14:13:35 -05:00 committed by GitHub
commit 92c024df79

View file

@ -592,6 +592,19 @@ class FastModel(FastBaseModel):
"os.environ['TRITON_F32_DEFAULT'] = 'ieee';"
elif "gpt-oss" in lowered_model_name:
os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1"
# the temporary patches for init need UNSLOTH_MODEL_NAME to be set
# which doesn't happen at import so manually call here
# before creating the compiled cache
try:
from unsloth_zoo.temporary_patches.gpt_oss import (
patch_GptOssExperts_MXFP4,
patch_GptOssExperts_bitsandbytes,
)
patch_GptOssExperts_MXFP4()
patch_GptOssExperts_bitsandbytes()
except:
pass
else:
for check_model_name in DISABLE_COMPILE_MODEL_NAMES:
if check_model_name in lowered_model_name: