diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 9bd0fc17ad..7f2c2db105 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.6.7" +__version__ = "2025.6.8" __all__ = [ "SUPPORTS_BFLOAT16", diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index 184be83539..34bf05cd8d 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -544,8 +544,10 @@ 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 lowered_model_name and transformers_version < Version("4.50.0.dev0"): raise RuntimeError("Unsloth: OLMo-2 only works on transformers >= 4.50.0." + NIGHTLY) - elif "gemma-3n" in lowered_model_name and transformers_version < Version("4.53.0"): - raise RuntimeError("Unsloth: Gemma 3N only works on transformers >= 4.53.0" + LATEST) + elif "gemma-3n" in lowered_model_name: + os.environ["UNSLOTH_DISABLE_STATIC_GENERATION"] = "1" + if transformers_version < Version("4.53.0"): + raise RuntimeError("Unsloth: Gemma 3N only works on transformers >= 4.53.0" + LATEST) else: for check_model_name in DISABLE_COMPILE_MODEL_NAMES: if check_model_name in lowered_model_name: