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 tokenizer_utils.py

Daniel Han-Chen69cedf9fcb74
diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py
index 01ad2bff7f7..edd97175578 100644
--- a/unsloth/tokenizer_utils.py
+++ b/unsloth/tokenizer_utils.py
@@ -299,8 +299,10 @@ def load_correct_tokenizer(
)
if slow_tokenizer is not None:
- fast_tokenizer.add_bos_token = slow_tokenizer.add_bos_token
- fast_tokenizer.add_eos_token = slow_tokenizer.add_eos_token
+ if hasattr(fast_tokenizer "add_bos_token") and hasattr(slow_tokenizer "add_bos_token"):
+ fast_tokenizer.add_bos_token = slow_tokenizer.add_bos_token
+ if hasattr(fast_tokenizer "add_eos_token") and hasattr(slow_tokenizer "add_eos_token"):
+ fast_tokenizer.add_eos_token = slow_tokenizer.add_eos_token
# Confirm if slow and fast are equivalent!
if assert_same_tokenization(slow_tokenizer, fast_tokenizer):