Skip to content

Huggingface Hub version increased causing import error #41970

@harveyz0

Description

@harveyz0

System Info

python-transformers 4.56.2-1
python-huggingface-hub 1:1.0.1-1
Python 3.13.7

I'm on Arch Linux with hugging face and transformers installed from the AUR.

If I do the version bump in the dependency_versions_table.py then I can get the transformers env to run

- `transformers` version: 4.56.2
- Platform: Linux-6.12.56-1-lts-x86_64-with-glibc2.42
- Python version: 3.13.7
- Huggingface_hub version: 1.0.1
- Safetensors version: 0.6.2
- Accelerate version: not installed
- Accelerate config: not found
- DeepSpeed version: not installed
- PyTorch version (accelerator?): 2.9.0 (CUDA)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA RTX 6000 Ada Generation

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Run import transformers anywhere. I tried going into dependency_versions_table.py and just bumping the version but then I get a different error from the SentenceTransformer code I'm trying to run.

>>> import transformers
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    import transformers
  File "/usr/lib/python3.13/site-packages/transformers/__init__.py", line 27, in <module>
    from . import dependency_versions_check
  File "/usr/lib/python3.13/site-packages/transformers/dependency_versions_check.py", line 57, in <module>
    require_version_core(deps[pkg])
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/transformers/utils/versions.py", line 117, in require_version_core
    return require_version(requirement, hint)
  File "/usr/lib/python3.13/site-packages/transformers/utils/versions.py", line 111, in require_version
    _compare_versions(op, got_ver, want_ver, requirement, pkg, hint)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/transformers/utils/versions.py", line 44, in _compare_versions
    raise ImportError(
        f"{requirement} is required for a normal functioning of this module, but found {pkg}=={got_ver}.{hint}"
    )
ImportError: huggingface-hub>=0.34.0,<1.0 is required for a normal functioning of this module, but found huggingface-hub==1.0.1.
Try: `pip install transformers -U` or `pip install -e '.[dev]'` if you're working with git main

Error after version bump

>>> t = SentenceTransformer("nomic-ai/nomic-embed-code", device="cuda")
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████| 6/6 [00:00<00:00,  8.65it/s]
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/huggingface_hub/utils/_http.py", line 550, in hf_raise_for_status
    response.raise_for_status()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/httpx/_models.py", line 829, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://huggingface.co/api/models/nomic-ai/nomic-embed-code/tree/main/additional_chat_templates?recursive=false&expand=false'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<python-input-7>", line 1, in <module>
    t = SentenceTransformer("nomic-ai/nomic-embed-code", device="cuda")
  File "/usr/lib/python3.13/site-packages/sentence_transformers/SentenceTransformer.py", line 327, in __init__
    modules, self.module_kwargs = self._load_sbert_model(
                                  ~~~~~~~~~~~~~~~~~~~~~~^
        model_name_or_path,
        ^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
        config_kwargs=config_kwargs,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/sentence_transformers/SentenceTransformer.py", line 2305, in _load_sbert_model                                                                                                07:08:01 [3/276]
    module = module_class.load(
        model_name_or_path,
    ...<11 lines>...
        backend=self.backend,
    )
  File "/usr/lib/python3.13/site-packages/sentence_transformers/models/Transformer.py", line 365, in load
    return cls(model_name_or_path=model_name_or_path, **init_kwargs)
  File "/usr/lib/python3.13/site-packages/sentence_transformers/models/Transformer.py", line 102, in __init__
    self.tokenizer = AutoTokenizer.from_pretrained(
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        tokenizer_name_or_path if tokenizer_name_or_path is not None else model_name_or_path,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        cache_dir=cache_dir,
        ^^^^^^^^^^^^^^^^^^^^
        **tokenizer_args,
        ^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/transformers/models/auto/tokenization_auto.py", line 1125, in from_pretrained
    return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/transformers/tokenization_utils_base.py", line 2012, in from_pretrained
    for template in list_repo_templates(
                    ~~~~~~~~~~~~~~~~~~~^
        pretrained_model_name_or_path,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        cache_dir=cache_dir,
        ^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/usr/lib/python3.13/site-packages/transformers/utils/hub.py", line 169, in list_repo_templates
    for entry in list_repo_tree(
                 ~~~~~~~~~~~~~~^
        repo_id=repo_id,
        ^^^^^^^^^^^^^^^^
    ...<2 lines>...
        recursive=False,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/huggingface_hub/hf_api.py", line 3080, in list_repo_tree
    for path_info in paginate(path=tree_url, headers=headers, params={"recursive": recursive, "expand": expand}):
                     ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/huggingface_hub/utils/_pagination.py", line 37, in paginate
    hf_raise_for_status(r)
    ~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.13/site-packages/huggingface_hub/utils/_http.py", line 564, in hf_raise_for_status
    raise _format(RemoteEntryNotFoundError, message, response) from e
huggingface_hub.errors.RemoteEntryNotFoundError: 404 Client Error. (Request ID: Root=1-6905ea11-200d6a394af082017e2bc2af;3b81023e-1bd5-4133-861f-7c1bb98a0071)

Entry Not Found for url: https://huggingface.co/api/models/nomic-ai/nomic-embed-code/tree/main/additional_chat_templates?recursive=false&expand=false.
additional_chat_templates does not exist on "main"

Expected behavior

It creates the model objects like it did before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions