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

[GH-ISSUE #264] heretic crashes when trying to download model on python 3.14 #153

Closed
opened 2026-11-01 04:18:04 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @mcDandy on GitHub (Apr 2, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/264

heretic google/gemma-4-31B-it
█░█░█▀▀░█▀▄░█▀▀░▀█▀░█░█▀▀ v1.2.0
█▀█░█▀▀░█▀▄░█▀▀░░█░░█░█░░
▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀▀▀ https://github.com/p-e-w/heretic

Detected 1 CUDA device(s):

  • GPU 0: NVIDIA GeForce RTX 5090

Loading model google/gemma-4-31B-it...
tokenizer_config.json: 2.07kB [00:00, 11.6MB/s]
C:\Program Files\Python314\Lib\site-packages\huggingface_hub\file_download.py:143: UserWarning: huggingface_hub cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\danda.cache\huggingface\hub\models--google--gemma-4-31B-it. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the HF_HUB_DISABLE_SYMLINKS_WARNING environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
warnings.warn(message)
Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: pip install huggingface_hub[hf_xet] or pip install hf_xet
tokenizer.json: 100%|██████████████████████████████████████████████████████████████| 32.2M/32.2M [01:39<00:00, 322kB/s]
chat_template.jinja: 12.0kB [00:00, 3.56MB/s]
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in _run_module_as_main:198 │
│ in _run_code:88 │
│ │
│ in :5 │
│ │
│ 2 from heretic.main import main │
│ 3 if name == 'main': │
│ 4 │ sys.argv[0] = sys.argv[0].removesuffix('.exe') │
│ ❱ 5 │ sys.exit(main()) │
│ 6 │
│ │
│ C:\Program Files\Python314\Lib\site-packages\heretic\main.py:891 in main │
│ │
│ 888 │ install() │
│ 889 │ │
│ 890 │ try: │
│ ❱ 891 │ │ run() │
│ 892 │ except BaseException as error: │
│ 893 │ │ # Transformers appears to handle KeyboardInterrupt (or BaseException) │
│ 894 │ │ # internally in some places, which can re-raise a different error in the handler │
│ │
│ C:\Program Files\Python314\Lib\site-packages\heretic\main.py:312 in run │
│ │
│ 309 │ │ elif choice is None or choice == "": │
│ 310 │ │ │ return │
│ 311 │ │
│ ❱ 312 │ model = Model(settings) │
│ 313 │ print() │
│ 314 │ print_memory_usage() │
│ 315 │
│ │
│ C:\Program Files\Python314\Lib\site-packages\heretic\model.py:68 in init │
│ │
│ 65 │ │ print() │
│ 66 │ │ print(f"Loading model [bold]{settings.model}[/]...") │
│ 67 │ │ │
│ ❱ 68 │ │ self.tokenizer = AutoTokenizer.from_pretrained( │
│ 69 │ │ │ settings.model, │
│ 70 │ │ │ trust_remote_code=settings.trust_remote_code, │
│ 71 │ │ ) │
│ │
│ C:\Program Files\Python314\Lib\site-packages\transformers\models\auto\tokenization_auto.py:1156 │
│ in from_pretrained │
│ │
│ 1153 │ │ │ │ raise ValueError( │
│ 1154 │ │ │ │ │ f"Tokenizer class {tokenizer_class_candidate} does not exist or is n │
│ 1155 │ │ │ │ ) │
│ ❱ 1156 │ │ │ return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *input │
│ 1157 │ │ │
│ 1158 │ │ # Otherwise we have to be creative. │
│ 1159 │ │ # if model is an encoder decoder, the encoder tokenizer class is used by default │
│ │
│ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:2113 in │
│ from_pretrained │
│ │
│ 2110 │ │ │ else: │
│ 2111 │ │ │ │ logger.info(f"loading file {file_path} from cache at {resolved_vocab_fil │
│ 2112 │ │ │
│ ❱ 2113 │ │ return cls._from_pretrained( │
│ 2114 │ │ │ resolved_vocab_files, │
│ 2115 │ │ │ pretrained_model_name_or_path, │
│ 2116 │ │ │ init_configuration, │
│ │
│ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:2359 in │
│ _from_pretrained │
│ │
│ 2356 │ │ │
│ 2357 │ │ # Instantiate the tokenizer. │
│ 2358 │ │ try: │
│ ❱ 2359 │ │ │ tokenizer = cls(*init_inputs, **init_kwargs) │
│ 2360 │ │ except import_protobuf_decode_error(): │
│ 2361 │ │ │ logger.info( │
│ 2362 │ │ │ │ "Unable to load tokenizer model from SPM, loading from TikToken will be │
│ │
│ C:\Program │
│ Files\Python314\Lib\site-packages\transformers\models\gemma\tokenization_gemma_fast.py:100 in │
│ init │
│ │
│ 97 │ │ add_eos_token=False, │
│ 98 │ │ **kwargs, │
│ 99 │ ): │
│ ❱ 100 │ │ super().init( │
│ 101 │ │ │ vocab_file=vocab_file, │
│ 102 │ │ │ tokenizer_file=tokenizer_file, │
│ 103 │ │ │ clean_up_tokenization_spaces=clean_up_tokenization_spaces, │
│ │
│ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_fast.py:178 in │
│ init │
│ │
│ 175 │ │ │ kwargs.setdefault("pad_to_multiple_of", _padding["pad_to_multiple_of"]) │
│ 176 │ │ │
│ 177 │ │ # We call this after having initialized the backend tokenizer because we update │
│ ❱ 178 │ │ super().init(**kwargs) │
│ 179 │ │ self._tokenizer.encode_special_tokens = self.split_special_tokens │
│ 180 │ │ │
│ 181 │ │ added_tokens_decoder_hash = {hash(repr(token)) for token in self.added_tokens_de │
│ │
│ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:1472 in │
│ init │
│ │
│ 1469 │ │ super().init(**kwargs) │
│ 1470 │ │ │
│ 1471 │ │ self.extra_special_tokens = kwargs.pop("extra_special_tokens", {}) │
│ ❱ 1472 │ │ self._set_model_specific_special_tokens(special_tokens=self.extra_special_tokens │
│ 1473 │ │
│ 1474 │ @property │
│ 1475 │ def max_len_single_sentence(self) -> int: │
│ │
│ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:1210 in │
│ _set_model_specific_special_tokens │
│ │
│ 1207 │ │ This allows us to dynamically add new model-type specific tokens after initializ │
│ 1208 │ │ For example: if the model tokenizers is multimodal, we can support special image │
│ 1209 │ │ """ │
│ ❱ 1210 │ │ self.SPECIAL_TOKENS_ATTRIBUTES = self.SPECIAL_TOKENS_ATTRIBUTES + list(special_t │
│ 1211 │ │ for key, value in special_tokens.items(): │
│ 1212 │ │ │ if isinstance(value, (str, AddedToken)): │
│ 1213 │ │ │ │ self._special_tokens_map[key] = value │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'list' object has no attribute 'keys'

Originally created by @mcDandy on GitHub (Apr 2, 2026). Original GitHub issue: https://github.com/p-e-w/heretic/issues/264 heretic google/gemma-4-31B-it █░█░█▀▀░█▀▄░█▀▀░▀█▀░█░█▀▀ v1.2.0 █▀█░█▀▀░█▀▄░█▀▀░░█░░█░█░░ ▀░▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀▀▀ https://github.com/p-e-w/heretic Detected 1 CUDA device(s): * GPU 0: NVIDIA GeForce RTX 5090 Loading model google/gemma-4-31B-it... tokenizer_config.json: 2.07kB [00:00, 11.6MB/s] C:\Program Files\Python314\Lib\site-packages\huggingface_hub\file_download.py:143: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\danda\.cache\huggingface\hub\models--google--gemma-4-31B-it. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations. To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development warnings.warn(message) Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet` tokenizer.json: 100%|██████████████████████████████████████████████████████████████| 32.2M/32.2M [01:39<00:00, 322kB/s] chat_template.jinja: 12.0kB [00:00, 3.56MB/s] ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ in _run_module_as_main:198 │ │ in _run_code:88 │ │ │ │ in <module>:5 │ │ │ │ 2 from heretic.main import main │ │ 3 if __name__ == '__main__': │ │ 4 │ sys.argv[0] = sys.argv[0].removesuffix('.exe') │ │ ❱ 5 │ sys.exit(main()) │ │ 6 │ │ │ │ C:\Program Files\Python314\Lib\site-packages\heretic\main.py:891 in main │ │ │ │ 888 │ install() │ │ 889 │ │ │ 890 │ try: │ │ ❱ 891 │ │ run() │ │ 892 │ except BaseException as error: │ │ 893 │ │ # Transformers appears to handle KeyboardInterrupt (or BaseException) │ │ 894 │ │ # internally in some places, which can re-raise a different error in the handler │ │ │ │ C:\Program Files\Python314\Lib\site-packages\heretic\main.py:312 in run │ │ │ │ 309 │ │ elif choice is None or choice == "": │ │ 310 │ │ │ return │ │ 311 │ │ │ ❱ 312 │ model = Model(settings) │ │ 313 │ print() │ │ 314 │ print_memory_usage() │ │ 315 │ │ │ │ C:\Program Files\Python314\Lib\site-packages\heretic\model.py:68 in __init__ │ │ │ │ 65 │ │ print() │ │ 66 │ │ print(f"Loading model [bold]{settings.model}[/]...") │ │ 67 │ │ │ │ ❱ 68 │ │ self.tokenizer = AutoTokenizer.from_pretrained( │ │ 69 │ │ │ settings.model, │ │ 70 │ │ │ trust_remote_code=settings.trust_remote_code, │ │ 71 │ │ ) │ │ │ │ C:\Program Files\Python314\Lib\site-packages\transformers\models\auto\tokenization_auto.py:1156 │ │ in from_pretrained │ │ │ │ 1153 │ │ │ │ raise ValueError( │ │ 1154 │ │ │ │ │ f"Tokenizer class {tokenizer_class_candidate} does not exist or is n │ │ 1155 │ │ │ │ ) │ │ ❱ 1156 │ │ │ return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *input │ │ 1157 │ │ │ │ 1158 │ │ # Otherwise we have to be creative. │ │ 1159 │ │ # if model is an encoder decoder, the encoder tokenizer class is used by default │ │ │ │ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:2113 in │ │ from_pretrained │ │ │ │ 2110 │ │ │ else: │ │ 2111 │ │ │ │ logger.info(f"loading file {file_path} from cache at {resolved_vocab_fil │ │ 2112 │ │ │ │ ❱ 2113 │ │ return cls._from_pretrained( │ │ 2114 │ │ │ resolved_vocab_files, │ │ 2115 │ │ │ pretrained_model_name_or_path, │ │ 2116 │ │ │ init_configuration, │ │ │ │ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:2359 in │ │ _from_pretrained │ │ │ │ 2356 │ │ │ │ 2357 │ │ # Instantiate the tokenizer. │ │ 2358 │ │ try: │ │ ❱ 2359 │ │ │ tokenizer = cls(*init_inputs, **init_kwargs) │ │ 2360 │ │ except import_protobuf_decode_error(): │ │ 2361 │ │ │ logger.info( │ │ 2362 │ │ │ │ "Unable to load tokenizer model from SPM, loading from TikToken will be │ │ │ │ C:\Program │ │ Files\Python314\Lib\site-packages\transformers\models\gemma\tokenization_gemma_fast.py:100 in │ │ __init__ │ │ │ │ 97 │ │ add_eos_token=False, │ │ 98 │ │ **kwargs, │ │ 99 │ ): │ │ ❱ 100 │ │ super().__init__( │ │ 101 │ │ │ vocab_file=vocab_file, │ │ 102 │ │ │ tokenizer_file=tokenizer_file, │ │ 103 │ │ │ clean_up_tokenization_spaces=clean_up_tokenization_spaces, │ │ │ │ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_fast.py:178 in │ │ __init__ │ │ │ │ 175 │ │ │ kwargs.setdefault("pad_to_multiple_of", _padding["pad_to_multiple_of"]) │ │ 176 │ │ │ │ 177 │ │ # We call this after having initialized the backend tokenizer because we update │ │ ❱ 178 │ │ super().__init__(**kwargs) │ │ 179 │ │ self._tokenizer.encode_special_tokens = self.split_special_tokens │ │ 180 │ │ │ │ 181 │ │ added_tokens_decoder_hash = {hash(repr(token)) for token in self.added_tokens_de │ │ │ │ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:1472 in │ │ __init__ │ │ │ │ 1469 │ │ super().__init__(**kwargs) │ │ 1470 │ │ │ │ 1471 │ │ self.extra_special_tokens = kwargs.pop("extra_special_tokens", {}) │ │ ❱ 1472 │ │ self._set_model_specific_special_tokens(special_tokens=self.extra_special_tokens │ │ 1473 │ │ │ 1474 │ @property │ │ 1475 │ def max_len_single_sentence(self) -> int: │ │ │ │ C:\Program Files\Python314\Lib\site-packages\transformers\tokenization_utils_base.py:1210 in │ │ _set_model_specific_special_tokens │ │ │ │ 1207 │ │ This allows us to dynamically add new model-type specific tokens after initializ │ │ 1208 │ │ For example: if the model tokenizers is multimodal, we can support special image │ │ 1209 │ │ """ │ │ ❱ 1210 │ │ self.SPECIAL_TOKENS_ATTRIBUTES = self.SPECIAL_TOKENS_ATTRIBUTES + list(special_t │ │ 1211 │ │ for key, value in special_tokens.items(): │ │ 1212 │ │ │ if isinstance(value, (str, AddedToken)): │ │ 1213 │ │ │ │ self._special_tokens_map[key] = value │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ AttributeError: 'list' object has no attribute 'keys'
Author
Owner

@p-e-w commented on GitHub (Apr 4, 2026):

Are you running the latest Heretic master? Python 3.14 support requires Transformers 5 I think, while Heretic 1.2 still uses Transformers 4.

<!-- gh-comment-id:4185967189 --> @p-e-w commented on GitHub (Apr 4, 2026): Are you running the latest Heretic master? Python 3.14 support requires Transformers 5 I think, while Heretic 1.2 still uses Transformers 4.
Author
Owner

@FeverKing commented on GitHub (Apr 7, 2026):

Are you running the latest Heretic master? Python 3.14 support requires Transformers 5 I think, while Heretic 1.2 still uses Transformers 4.

Same issue with the latest version of heretic.
I'm running it on macOS with MPS support, here's my env:

python 3.12.13
pytorch 2.11.0
transformers 4.57.6

Will be appreciate for your help.

<!-- gh-comment-id:4198196773 --> @FeverKing commented on GitHub (Apr 7, 2026): > Are you running the latest Heretic master? Python 3.14 support requires Transformers 5 I think, while Heretic 1.2 still uses Transformers 4. Same issue with the latest version of heretic. I'm running it on macOS with MPS support, here's my env: ``` python 3.12.13 pytorch 2.11.0 transformers 4.57.6 ``` Will be appreciate for your help.
Author
Owner

@FeverKing commented on GitHub (Apr 7, 2026):

Are you running the latest Heretic master? Python 3.14 support requires Transformers 5 I think, while Heretic 1.2 still uses Transformers 4.

Same issue with the latest version of heretic. I'm running it on macOS with MPS support, here's my env:

python 3.12.13
pytorch 2.11.0
transformers 4.57.6

Will be appreciate for your help.

Update, I found it's only appear when loading Gemma 4 seris model, this version works well with Qwen.
The command I ran causing the error is:

heretic google/gemma-4-E2B-it
<!-- gh-comment-id:4198256400 --> @FeverKing commented on GitHub (Apr 7, 2026): > > Are you running the latest Heretic master? Python 3.14 support requires Transformers 5 I think, while Heretic 1.2 still uses Transformers 4. > > Same issue with the latest version of heretic. I'm running it on macOS with MPS support, here's my env: > > ``` > python 3.12.13 > pytorch 2.11.0 > transformers 4.57.6 > ``` > > Will be appreciate for your help. Update, I found it's only appear when loading Gemma 4 seris model, this version works well with Qwen. The command I ran causing the error is: ``` heretic google/gemma-4-E2B-it ```
Author
Owner

@p-e-w commented on GitHub (Apr 7, 2026):

Same issue with the latest version of heretic.

That's not the latest version of Heretic.

The latest version of Heretic is the master branch of this repository. It uses Transformers 5, not transformers 4.57.6.

Are you getting the error with the master branch?

<!-- gh-comment-id:4198724960 --> @p-e-w commented on GitHub (Apr 7, 2026): > Same issue with the latest version of heretic. That's not the latest version of Heretic. The latest version of Heretic is the master branch of this repository. It uses Transformers 5, not `transformers 4.57.6`. Are you getting the error with the master branch?
Author
Owner

@FeverKing commented on GitHub (Apr 7, 2026):

Same issue with the latest version of heretic.

That's not the latest version of Heretic.

The latest version of Heretic is the master branch of this repository. It uses Transformers 5, not transformers 4.57.6.

Are you getting the error with the master branch?

Yes, I tried pip install the package and running from the source(master), both way throw the same exception.
So I tried to fix it myself, see PR #285
Thanks for your great work.

<!-- gh-comment-id:4199161159 --> @FeverKing commented on GitHub (Apr 7, 2026): > > Same issue with the latest version of heretic. > > That's not the latest version of Heretic. > > The latest version of Heretic is the master branch of this repository. It uses Transformers 5, not `transformers 4.57.6`. > > Are you getting the error with the master branch? Yes, I tried pip install the package and running from the source(master), both way throw the same exception. So I tried to fix it myself, see PR #285 Thanks for your great work.
Author
Owner

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

Closing as Gemma 4 is well supported now.

<!-- gh-comment-id:6124763948 --> @p-e-w commented on GitHub (Oct 12, 2026): Closing as Gemma 4 is well supported now.
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#153
No description provided.