Skip to content

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Sep 30, 2025

TL;DR:

  • timm is compatible with huggingface_hub v0.x and v1.x
  • bump minimal version (still very lax)
  • fix a bug when upload to private repo
  • clean some stuff

At 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 the huggingface_hub integration, and especially:

  • use file_exists instead of get_hf_file_metadata + hf_hub_url in order to check if the repo user is uploading to has a README
  • bump minimal version to v0.17.0 which has been release in Sept' 2023 and introduced file_exists utility. I don't think this bump is a major problem as it's 2 years old.
  • do not recreate repo_id manually using repo_type_and_id_from_hf_id as this is already done by the create_repo return value (since Dec' 2022 so included in v0.17+)
  • use HfApi instead of individual methods when uploading a model
    • => allows to set custom user-agent for timm (only done for hf_hub_download so far)
    • => allow to pass token once and for all => previously the get_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

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@rwightman rwightman merged commit 0645384 into huggingface:main Sep 30, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants