diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index 01ad2bff7f..edd9717557 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):