1
0
Fork 0
mirror of https://github.com/p-e-w/heretic.git synced 2026-12-03 18:42:57 +07:00

[GH-ISSUE #533] [v2.0.0.dev0] Use of GGUF results in traceback instead of rejection in favor of Safetensors #231

Open
opened 2026-11-01 04:18:51 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @jvictors-tp on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/533

What I expected:

  • An error saying that GGUF files were not supported
  • and/or an suggestion to use a Safetensor models instead

What actually happened:

  • A traceback and a ValueError, saying that the backend tokenizer could not be initialized
  • A suggestion to use either sentencepiece or tiktoken

Why I think this is a bug:

  • It didn't reject me immediately, and just led me down a technical road. If GGUF is not supported or it isn't officially supported yet, Heretic should say so. More assertions, more defensive programming!

My environment:

  • Hardware: Mac M2 Pro
  • RAM: 32 GB
  • OS: MacOS 27.2

My shell output:

heretic google/gemma-4-26B-A4B-it-qat-q4_0-gguf

W1029 11:34:39.670000 76691 torch/distributed/elastic/multiprocessing/redirects.py:35] NOTE: Redirects are currently not supported in MacOs.
█░█░█▀▀░█▀▄░█▀▀░▀█▀░█░█▀▀  v2.0.0.dev0
█▀█░█▀▀░█▀▄░█▀▀░░█░░█░█░░  https://heretic-project.org
▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀▀▀  https://github.com/p-e-w/heretic

Detected 1 MPS device(s)
Driver Version: 27.2
* MPS 0: Apple Metal

Loading model google/gemma-4-26B-A4B-it-qat-q4_0-gguf...
Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/user/venv-heretic/bin/heretic:6 in <module>                                           │
│                                                                                                  │
│   3 from heretic.main import main                                                                │
│   4 if __name__ == '__main__':                                                                   │
│   5 │   sys.argv[0] = sys.argv[0].removesuffix('.exe')                                           │
│ ❱ 6 │   sys.exit(main())                                                                         │
│   7                                                                                              │
│                                                                                                  │
│ /Users/user/venv-heretic/lib/python3.14/site-packages/heretic/main.py:1474 in main           │
│                                                                                                  │
│   1471 │   install()                                                                             │
│   1472 │                                                                                         │
│   1473 │   try:                                                                                  │
│ ❱ 1474 │   │   run()                                                                             │
│   1475 │   except BaseException as error:                                                        │
│   1476 │   │   # Transformers appears to handle KeyboardInterrupt (or BaseException)             │
│   1477 │   │   # internally in some places, which can re-raise a different error in the handler  │
│                                                                                                  │
│ /Users/user/venv-heretic/lib/python3.14/site-packages/heretic/main.py:414 in run             │
│                                                                                                  │
│    411 │   │   │   backend = JournalFileBackend(study_checkpoint_file, lock_obj=lock_obj)        │
│    412 │   │   │   storage = JournalStorage(backend)                                             │
│    413 │                                                                                         │
│ ❱  414 │   model = Model(settings)                                                               │
│    415 │   print()                                                                               │
│    416 │   print_memory_usage()                                                                  │
│    417                                                                                           │
│                                                                                                  │
│ /Users/user/venv-heretic/lib/python3.14/site-packages/heretic/model.py:136 in __init__       │
│                                                                                                  │
│   133 │   │   # according to the documentation.                                                  │
│   134 │   │   self.tokenizer = cast(                                                             │
│   135 │   │   │   PreTrainedTokenizerBase,                                                       │
│ ❱ 136 │   │   │   AutoTokenizer.from_pretrained(                                                 │
│   137 │   │   │   │   settings.model,                                                            │
│   138 │   │   │   │   **self.revision_kwargs,                                                    │
│   139 │   │   │   ),                                                                             │
│                                                                                                  │
│ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/models/auto/tokenization_ │
│ auto.py:1008 in from_pretrained                                                                  │
│                                                                                                  │
│   1005 │   │   │   │   │   or not _use_mistral_format(pretrained_model_name_or_path, mistral_fo  │
│   1006 │   │   │   │   ):                                                                        │
│   1007 │   │   │   │   │   tokenizer_class = TokenizersBackend                                   │
│ ❱ 1008 │   │   │   │   return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *i  │
│   1009 │   │                                                                                     │
│   1010 │   │   # Fallback: try tokenizer_class from tokenizer_config.json                        │
│   1011 │   │   tokenizer_config_class = tokenizer_config.get("tokenizer_class", None)            │
│                                                                                                  │
│ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/tokenization_utils_base.p │
│ y:1768 in from_pretrained                                                                        │
│                                                                                                  │
│   1765 │   │   │   if file_id not in resolved_vocab_files:                                       │
│   1766 │   │   │   │   continue                                                                  │
│   1767 │   │                                                                                     │
│ ❱ 1768 │   │   return cls._from_pretrained(                                                      │
│   1769 │   │   │   resolved_vocab_files,                                                         │
│   1770 │   │   │   pretrained_model_name_or_path,                                                │
│   1771 │   │   │   init_configuration,                                                           │
│                                                                                                  │
│ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/tokenization_utils_base.p │
│ y:1962 in _from_pretrained                                                                       │
│                                                                                                  │
│   1959 │   │   init_kwargs = cls.convert_to_native_format(**init_kwargs)                         │
│   1960 │   │                                                                                     │
│   1961 │   │   try:                                                                              │
│ ❱ 1962 │   │   │   tokenizer = cls(*init_inputs, **init_kwargs)                                  │
│   1963 │   │   except import_protobuf_decode_error():                                            │
│   1964 │   │   │   raise RuntimeError(                                                           │
│   1965 │   │   │   │   "Unable to load tokenizer model from SPM, loading from TikToken will be   │
│                                                                                                  │
│ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/tokenization_utils_tokeni │
│ zers.py:413 in __init__                                                                          │
│                                                                                                  │
│    410 │   │   │   elif isinstance(vocab, list) and vocab and isinstance(vocab[0], (tuple, list  │
│    411 │   │   │   │   fast_tokenizer = TokenizerFast(Unigram(vocab=vocab, unk_id=kwargs.get("u  │
│    412 │   │   elif self._tokenizer is None:                                                     │
│ ❱  413 │   │   │   raise ValueError(                                                             │
│    414 │   │   │   │   "Couldn't instantiate the backend tokenizer from one of: \n"              │
│    415 │   │   │   │   "(1) a `tokenizers` library serialization file, \n"                       │
│    416 │   │   │   │   "(2) a slow tokenizer instance to convert or \n"                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Couldn't instantiate the backend tokenizer from one of: 
(1) a `tokenizers` library serialization file, 
(2) a slow tokenizer instance to convert or 
(3) an equivalent slow tokenizer class to instantiate and convert. 
You need to have sentencepiece or tiktoken installed to convert a slow tokenizer to a fast one.
^C
Originally created by @jvictors-tp on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/p-e-w/heretic/issues/533 What I expected: - An error saying that GGUF files were not supported - and/or an suggestion to use a Safetensor models instead What actually happened: - A traceback and a ValueError, saying that the backend tokenizer could not be initialized - A suggestion to use either `sentencepiece` or `tiktoken` Why I think this is a bug: - It didn't reject me immediately, and just led me down a technical road. If GGUF is not supported or it isn't officially supported _yet_, Heretic should say so. More assertions, more defensive programming! My environment: - Hardware: Mac M2 Pro - RAM: 32 GB - OS: MacOS 27.2 My shell output: ``` heretic google/gemma-4-26B-A4B-it-qat-q4_0-gguf W1029 11:34:39.670000 76691 torch/distributed/elastic/multiprocessing/redirects.py:35] NOTE: Redirects are currently not supported in MacOs. █░█░█▀▀░█▀▄░█▀▀░▀█▀░█░█▀▀ v2.0.0.dev0 █▀█░█▀▀░█▀▄░█▀▀░░█░░█░█░░ https://heretic-project.org ▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀▀▀ https://github.com/p-e-w/heretic Detected 1 MPS device(s) Driver Version: 27.2 * MPS 0: Apple Metal Loading model google/gemma-4-26B-A4B-it-qat-q4_0-gguf... Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads. ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /Users/user/venv-heretic/bin/heretic:6 in <module> │ │ │ │ 3 from heretic.main import main │ │ 4 if __name__ == '__main__': │ │ 5 │ sys.argv[0] = sys.argv[0].removesuffix('.exe') │ │ ❱ 6 │ sys.exit(main()) │ │ 7 │ │ │ │ /Users/user/venv-heretic/lib/python3.14/site-packages/heretic/main.py:1474 in main │ │ │ │ 1471 │ install() │ │ 1472 │ │ │ 1473 │ try: │ │ ❱ 1474 │ │ run() │ │ 1475 │ except BaseException as error: │ │ 1476 │ │ # Transformers appears to handle KeyboardInterrupt (or BaseException) │ │ 1477 │ │ # internally in some places, which can re-raise a different error in the handler │ │ │ │ /Users/user/venv-heretic/lib/python3.14/site-packages/heretic/main.py:414 in run │ │ │ │ 411 │ │ │ backend = JournalFileBackend(study_checkpoint_file, lock_obj=lock_obj) │ │ 412 │ │ │ storage = JournalStorage(backend) │ │ 413 │ │ │ ❱ 414 │ model = Model(settings) │ │ 415 │ print() │ │ 416 │ print_memory_usage() │ │ 417 │ │ │ │ /Users/user/venv-heretic/lib/python3.14/site-packages/heretic/model.py:136 in __init__ │ │ │ │ 133 │ │ # according to the documentation. │ │ 134 │ │ self.tokenizer = cast( │ │ 135 │ │ │ PreTrainedTokenizerBase, │ │ ❱ 136 │ │ │ AutoTokenizer.from_pretrained( │ │ 137 │ │ │ │ settings.model, │ │ 138 │ │ │ │ **self.revision_kwargs, │ │ 139 │ │ │ ), │ │ │ │ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/models/auto/tokenization_ │ │ auto.py:1008 in from_pretrained │ │ │ │ 1005 │ │ │ │ │ or not _use_mistral_format(pretrained_model_name_or_path, mistral_fo │ │ 1006 │ │ │ │ ): │ │ 1007 │ │ │ │ │ tokenizer_class = TokenizersBackend │ │ ❱ 1008 │ │ │ │ return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *i │ │ 1009 │ │ │ │ 1010 │ │ # Fallback: try tokenizer_class from tokenizer_config.json │ │ 1011 │ │ tokenizer_config_class = tokenizer_config.get("tokenizer_class", None) │ │ │ │ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/tokenization_utils_base.p │ │ y:1768 in from_pretrained │ │ │ │ 1765 │ │ │ if file_id not in resolved_vocab_files: │ │ 1766 │ │ │ │ continue │ │ 1767 │ │ │ │ ❱ 1768 │ │ return cls._from_pretrained( │ │ 1769 │ │ │ resolved_vocab_files, │ │ 1770 │ │ │ pretrained_model_name_or_path, │ │ 1771 │ │ │ init_configuration, │ │ │ │ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/tokenization_utils_base.p │ │ y:1962 in _from_pretrained │ │ │ │ 1959 │ │ init_kwargs = cls.convert_to_native_format(**init_kwargs) │ │ 1960 │ │ │ │ 1961 │ │ try: │ │ ❱ 1962 │ │ │ tokenizer = cls(*init_inputs, **init_kwargs) │ │ 1963 │ │ except import_protobuf_decode_error(): │ │ 1964 │ │ │ raise RuntimeError( │ │ 1965 │ │ │ │ "Unable to load tokenizer model from SPM, loading from TikToken will be │ │ │ │ /Users/user/venv-heretic/lib/python3.14/site-packages/transformers/tokenization_utils_tokeni │ │ zers.py:413 in __init__ │ │ │ │ 410 │ │ │ elif isinstance(vocab, list) and vocab and isinstance(vocab[0], (tuple, list │ │ 411 │ │ │ │ fast_tokenizer = TokenizerFast(Unigram(vocab=vocab, unk_id=kwargs.get("u │ │ 412 │ │ elif self._tokenizer is None: │ │ ❱ 413 │ │ │ raise ValueError( │ │ 414 │ │ │ │ "Couldn't instantiate the backend tokenizer from one of: \n" │ │ 415 │ │ │ │ "(1) a `tokenizers` library serialization file, \n" │ │ 416 │ │ │ │ "(2) a slow tokenizer instance to convert or \n" │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ValueError: Couldn't instantiate the backend tokenizer from one of: (1) a `tokenizers` library serialization file, (2) a slow tokenizer instance to convert or (3) an equivalent slow tokenizer class to instantiate and convert. You need to have sentencepiece or tiktoken installed to convert a slow tokenizer to a fast one. ^C ```
Author
Owner

@p-e-w commented on GitHub (Oct 30, 2026):

Yes, we're going to improve the experience for loading GGUF models post-2.0.

See also #453.

<!-- gh-comment-id:6523725185 --> @p-e-w commented on GitHub (Oct 30, 2026): Yes, we're going to improve the experience for loading GGUF models post-2.0. See also #453.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
p-e-w/heretic#231
No description provided.