Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Fix Gemma 3N (#2854)

Daniel Han9ad09f9ab2a8
diff --git a/pyproject.toml b/pyproject.toml
index 46c7fc46028..74e1ccc1909 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -37,7 +37,7 @@ triton = [
]
huggingface = [
- "unsloth_zoo>=2025.6.7",
+ "unsloth_zoo>=2025.6.8",
"packaging",
"tyro",
"transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3",
@@ -381,7 +381,7 @@ colab-ampere-torch220 = [
"flash-attn>=2.6.3",
]
colab-new = [
- "unsloth_zoo>=2025.6.7",
+ "unsloth_zoo>=2025.6.8",
"packaging",
"tyro",
"transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3",
diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py
index 39ff1fd2bb2..53c54974241 100644
--- a/unsloth/models/vision.py
+++ b/unsloth/models/vision.py
@@ -440,12 +440,12 @@ class FastBaseModel:
for jj, (name, module) in enumerate(model.named_modules()):
exec(custom_datatype)
pass
- # Clear deleted GPU items
- for _ in range(3):
- gc.collect()
- if DEVICE_TYPE == "cuda": torch.cuda.empty_cache()
- elif DEVICE_TYPE == "xpu": torch.xpu.empty_cache()
- pass
+ pass
+ # Clear deleted GPU items
+ for _ in range(3):
+ gc.collect()
+ if DEVICE_TYPE == "cuda": torch.cuda.empty_cache()
+ elif DEVICE_TYPE == "xpu": torch.xpu.empty_cache()
pass
# Counteract saved tokenizers
@@ -562,7 +562,7 @@ class FastBaseModel:
finetune_mlp_modules = True,
layers_to_transform = None,
layers_pattern = None,
- use_gradient_checkpointing = True,
+ use_gradient_checkpointing = "unsloth",
random_state = 3407,
max_seq_length = 2048, # not used anymore
use_rslora = False,