diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 9c5a7b68be..fee6dd730d 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -546,8 +546,9 @@ class FastModel(FastBaseModel): os.environ["UNSLOTH_FORCE_CUSTOM_DTYPE"] = "torch.float16;if name.endswith(('_proj', 'fc1', 'fc2', 'codebook', 'head')): module.to(torch.float16)" elif "olmo-2" in model_name.lower() and transformers_version < Version("4.50.0.dev0"): raise RuntimeError("Unsloth: OLMo-2 only works on transformers >= 4.50.0." + NIGHTLY) - elif "whisper" in model_name.lower(): - os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" # Whisper fails + elif auto_model is not None: + # All other models need to disable static cache + os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" pass if USE_MODELSCOPE and not os.path.exists(model_name):