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.

Typo

Daniel Hane4205ffad5a2
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index 46a5f45cfaf..b2f4b5c66eb 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -613,10 +613,10 @@ def patch_tokenizer(model, tokenizer):
# Edit all config with new pad token
current_model = model
- while hasattr(model, "model") and hasattr(model, "config"):
+ while hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
current_model = current_model.model
- if hasattr(model, "model") and hasattr(model, "config"):
+ if hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
pass
@@ -630,10 +630,10 @@ def patch_tokenizer(model, tokenizer):
# Edit all config with new pad token
current_model = model
- while hasattr(model, "model") and hasattr(model, "config"):
+ while hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
current_model = model
- if hasattr(model, "model") and hasattr(model, "config"):
+ if hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
pass
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py
index a53f52fe271..65e2d773e89 100644
--- a/unsloth/models/llama.py
+++ b/unsloth/models/llama.py
@@ -1849,12 +1849,12 @@ class FastLlamaModel:
# Fix up all vocab sizes
current_model = model
- while hasattr(model, "model") and hasattr(model, "config"):
- if hasattr(model.config, "vocab_size"):
+ while hasattr(current_model, "model") and hasattr(current_model, "config"):
+ if hasattr(current_model.config, "vocab_size"):
current_model.config.update({"vocab_size" : len(tokenizer)})
current_model = current_model.model
- if hasattr(model, "model") and hasattr(model, "config"):
- if hasattr(model.config, "vocab_size"):
+ if hasattr(current_model, "model") and hasattr(current_model, "config"):
+ if hasattr(current_model.config, "vocab_size"):
current_model.config.update({"vocab_size" : len(tokenizer)})
pass
pass