Review huggingface_hub
integration
#2592
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR:
timm
is compatible withhuggingface_hub
v0.x and v1.xAt first I just wanted to check that the current implementation was compatible with the upcoming
huggingface_hub
v1.0 release (see huggingface/huggingface_hub#3340). This is indeed the case (breaking changes should not affect timm). However I took the advantage to update thehuggingface_hub
integration, and especially:file_exists
instead ofget_hf_file_metadata
+hf_hub_url
in order to check if the repo user is uploading to has a READMEv0.17.0
which has been release in Sept' 2023 and introducedfile_exists
utility. I don't think this bump is a major problem as it's 2 years old.repo_id
manually usingrepo_type_and_id_from_hf_id
as this is already done by thecreate_repo
return value (since Dec' 2022 so included inv0.17+
)HfApi
instead of individual methods when uploading a modeltimm
(only done forhf_hub_download
so far)token
once and for all => previously theget_hf_file_metadata(hf_hub_url(repo_id=repo_id, filename="README.md", revision=revision))
was necessarily failing in case of private repo since token was not forwarded