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.

Update _utils.py

Daniel Han064ff70bc54a
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index 3686717b2ce..195fd5bb658 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -467,7 +467,7 @@ def patch_tokenizer(model, tokenizer):
check_pad_token = tokenizer(possible_pad_token, add_special_tokens = False).input_ids
if len(check_pad_token) != 1:
possible_pad_token = None
- if check_pad_token[0] >= model.config.vocab_size:
+ if model is not None and check_pad_token[0] >= model.config.vocab_size:
possible_pad_token = None
pass