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] qwen3-guard tokenizer (#3959)

Datta Nimmaturi5cf7b4e34f4d
diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py
index 0136e3498ed..087a9a7f8a8 100644
--- a/unsloth/tokenizer_utils.py
+++ b/unsloth/tokenizer_utils.py
@@ -602,7 +602,10 @@ def load_correct_tokenizer(
old_chat_template = getattr(tokenizer, "chat_template", None)
# Ignore mistral type models since they don't have an add_generation_prompt
- if "mistral" in str(getattr(tokenizer, "name_or_path", "")).lower():
+ if any(
+ s in str(getattr(tokenizer, "name_or_path", "")).lower()
+ for s in ["mistral", "qwen3guard"]
+ ):
chat_template = old_chat_template
# Also check Llama-2 old style models