Skip to content

[Bug]: download HF model failed when HF_TOKEN is empty string #20350

@Levi080513

Description

@Levi080513

Your current environment

The output of python collect_env.py
Your output of `python collect_env.py` here

🐛 Describe the bug

ERROR 07-01 23:05:48 [config.py:103] Error retrieving file list: 401 Client Error: Unauthorized for url: https://huggingface.co/api/models/Qwen/Qwen2.5-1.5B-Instruct/tree/main?recursive=True&expand=False

https://github.com/huggingface/huggingface_hub/blob/99baddf1df46c073166b50962dfaeee4c1e28847/src/huggingface_hub/utils/_auth.py#L207

huggingface_hub will clean the empty string token when get from other source, should we keep doing the same thing ?

Currently we only get it from the environment variable but do not handle the empty string scenario.

token=os.getenv('HF_TOKEN', None))

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions