Skip to content

Reuse resolved Hub commits throughout loading - #47583

Closed
Wauplin wants to merge 1 commit into
huggingface:mainfrom
Wauplin:agent/propagate-hub-commit-hash
Closed

Reuse resolved Hub commits throughout loading#47583
Wauplin wants to merge 1 commit into
huggingface:mainfrom
Wauplin:agent/propagate-hub-commit-hash

Conversation

@Wauplin

@Wauplin Wauplin commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

CI

Related but not dependent on vllm-project/vllm#49990.

Summary

Propagate a Hub commit as soon as a top-level loader resolves one, then use that immutable revision for the remainder of the same load.

  • AutoTokenizer seeds _commit_hash from its resolved/passed model config before loading tokenizer metadata.
  • Auto and concrete processor, image, video, and feature-extractor paths carry the resolved commit through sequential file lookups and subcomponents.
  • Tokenizer and processor repository listings use the resolved commit.
  • cached_files uses _commit_hash for cache misses as well as cache hits, so a missing local file cannot fall back to resolving the original mutable revision again.
  • Specialized Bark and Ernie processor paths follow the same invariant.

Motivation

Transformers already records positive and negative Hub cache entries under an immutable commit. However, several loading paths either acquire _commit_hash too late or fail to pass it to later lookups. This causes repeated HEAD requests against main, including for optional files whose absence is already cached for the resolved commit.

This change keeps freshness scoped to a top-level call:

AutoTokenizer.from_pretrained("org/model", revision="main")
AutoTokenizer.from_pretrained("org/model", revision="main")

This still resolves the model config/ref twice. Within each invocation, subsequent same-repository lookups use that invocation's commit. There is no TTL or process-wide mutable-ref cache.

AI assistance

This draft was prepared with AI assistance. The submitting human should review and understand every changed line before marking it ready for review.

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Wauplin <lucainp@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, bark, ernie4_5_vl_moe

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 30272340679:1
Result: failure | Jobs: 16 | Tests: 163,419 | Failures: 290 | Duration: 15h 17m

@Wauplin

Wauplin commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

closing in favor of #47611

@Wauplin Wauplin closed this Jul 29, 2026
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.

2 participants