huggingface_hub
huggingface_hub copied to clipboard
`HfApi.model_info(revision=)` does not resolve hash prefix
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.
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!
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)

Hope this helps
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.
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 :)
yes thanks for checking @martinbrose 🔥