hf-hub icon indicating copy to clipboard operation
hf-hub copied to clipboard

🐛 hf-hub does not properly follow repo redirections with auth (after eg. renaming)

Open DanielHesslow opened this issue 8 months ago • 1 comments

👋 Hey

This Works:

    let api = ApiBuilder::from_env()
        .build()
        .unwrap();
    let repo = api.model("meta-llama/Llama-3.1-8B".to_string());
    repo.download("config.json").unwrap();

While this Fails:

    let api = ApiBuilder::from_env()
        .build()
        .unwrap();
    let repo = api.model("meta-llama/Meta-Llama-3.1-8B".to_string());
    repo.download("config.json").unwrap();

called Result::unwrap() on an Err value: RequestError(Status(401, Response[status: 401, status_text: Unauthorized, url: https://huggingface.co/meta-llama/Llama-3.1-8B/resolve/main/config.json]))

In python both works as expected:

from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="meta-llama/Llama-3.1-8B", filename="config.json")
hf_hub_download(repo_id="meta-llama/Meta-Llama-3.1-8B", filename="config.json")

Cheers, Daniel

DanielHesslow avatar Apr 23 '25 17:04 DanielHesslow

can repro

julien-c avatar Apr 23 '25 17:04 julien-c

Fixed https://github.com/huggingface/hf-hub/pull/110

Narsil avatar Jun 16 '25 09:06 Narsil