huggingface_hub icon indicating copy to clipboard operation
huggingface_hub copied to clipboard

`HfApi.model_info(revision=)` does not resolve hash prefix

Open cccntu opened this issue 3 years ago • 2 comments

import huggingface_hub

huggingface_hub.__version__
'0.0.13'
from huggingface_hub import snapshot_download, HfApi
api = HfApi()

# success
api.model_info("flax-community/ft5-cnn-dm") 

# success
api.model_info(
    "flax-community/ft5-cnn-dm", revision="859350e337148108b32b6f9eef45d0d4c6b668a9"
)

# fail
api.model_info("flax-community/ft5-cnn-dm",revision='859350e')

Error message:

HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/api/models/flax-community/ft5-cnn-dm/revision/859350e

This is what snapshot_download calls internally, so snapshot_download would fail if only hash prefix is provided.

cccntu avatar Jul 16 '21 03:07 cccntu

Yep, we don't currently have this capability. If it is requested widely we will consider building it (it's on the server side so in the realm of @Pierrci )

Thanks!

julien-c avatar Jul 16 '21 13:07 julien-c

Note that we now have buttons to copy the full commit hash to clipboard on every commit list or page on hf.co:

(not a solve to this PR, but should alleviate its importance for the time being)

Screenshot 2021-10-21 at 18 51 05

Hope this helps

julien-c avatar Oct 21 '21 17:10 julien-c

Hi @julien-c,

I believe this issue can be closed?

When I try to replicate OP's problem, there is no 404 HTTPError anymore for https://huggingface.co/api/models/flax-community/ft5-cnn-dm/revision/859350e.

The server side fix must have been implemented.

martinbrose avatar Aug 13 '23 18:08 martinbrose

When I try to replicate OP's problem, there is no 404 HTTPError anymore

I confirm that I have been able to reproduce it and that the "problem" has been fixed server-side. Thanks for trying it out @martinbrose :)

Wauplin avatar Aug 16 '23 12:08 Wauplin

yes thanks for checking @martinbrose 🔥

julien-c avatar Aug 18 '23 15:08 julien-c