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 weird tokenizer issue

Daniel Han66a1345421f8
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index 2a5b71d3998..0c51c174f0e 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-__version__ = "2025.2.11"
+__version__ = "2025.2.12"
__all__ = [
"SUPPORTS_BFLOAT16",
diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py
index 404fce319f5..048bee7797e 100644
--- a/unsloth/tokenizer_utils.py
+++ b/unsloth/tokenizer_utils.py
@@ -259,6 +259,7 @@ pass
def assert_same_tokenization(slow_tokenizer, fast_tokenizer):
# Get eos_token, bos_token etc
+ if not hasattr(slow_tokenizer, "all_special_tokens"): return True
dir_names = dir(slow_tokenizer)
special_tokens = list(filter(None, (
getattr(slow_tokenizer, x) for x in dir_names
@@ -503,12 +504,14 @@ def _load_correct_tokenizer(
cache_dir = cache_dir,
)
except:
- pass
+ slow_tokenizer = None
# print(
# f"Unsloth: {tokenizer_name} has no tokenizer.model file.\n"\
# "Just informing you about this - this is not a critical error."
# )
pass
+ # Unsure why this occurs!
+ if type(slow_tokenizer) is bool: slow_tokenizer = None
fast_tokenizer = AutoTokenizer.from_pretrained(
tokenizer_name,