Skip to content

[Generate] Avoid unconditionally downloading remote hub file - #48620

Merged
vasqu merged 6 commits into
mainfrom
fix-dw-unconditionally
Sep 8, 2026
Merged

vasqu merged 6 commits into
mainfrom
fix-dw-unconditionally

Conversation

@vasqu

@vasqu vasqu commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

CPU CI GPU run-slow

As per title

@vasqu

vasqu commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

cc @VI-Arthur @CyrilBurner

@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.

Comment thread src/transformers/generation/utils.py Outdated
Comment on lines +607 to +616
# Check for the existence of the file without actually downloading it
# (preventing unwanted downloads of files, even if not executed)
has_file_kwargs = {
"revision": kwargs.get("_commit_hash") or kwargs.get("revision") or "main",
"proxies": kwargs.get("proxies"),
"token": kwargs.get("token"),
"cache_dir": kwargs.get("cache_dir"),
"local_files_only": kwargs.get("local_files_only", False),
"repo_type": kwargs.get("repo_type"),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you just use the kwargs? Or just pop the one you don't need before coming here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea true that I kinda wanted to follow

# Prepare set of kwargs for hub functions
has_file_kwargs = {
"revision": revision,
"proxies": proxies,
"token": token,
"cache_dir": cache_dir,
"local_files_only": local_files_only,
}

but it's not really necessary / makes it bloated

@vasqu
vasqu marked this pull request as ready for review September 8, 2026 15:01
@vasqu
vasqu enabled auto-merge September 8, 2026 15:08
@vasqu
vasqu disabled auto-merge September 8, 2026 15:21
@vasqu
vasqu enabled auto-merge September 8, 2026 15:22
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 34241915238:1
Result: failure | Jobs: 2 | Tests: 23 | Failures: 1 | Duration: 2m 54s

@vasqu
vasqu added this pull request to the merge queue Sep 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 8, 2026
@vasqu
vasqu added this pull request to the merge queue Sep 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 8, 2026
@vasqu
vasqu added this pull request to the merge queue Sep 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 8, 2026
@vasqu
vasqu added this pull request to the merge queue Sep 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 8, 2026
@vasqu
vasqu added this pull request to the merge queue Sep 8, 2026
@vasqu
vasqu removed this pull request from the merge queue due to a manual request Sep 8, 2026
@vasqu
vasqu added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit cbc1651 Sep 8, 2026
312 of 319 checks passed
@vasqu
vasqu deleted the fix-dw-unconditionally branch September 8, 2026 19:11
@vasqu

vasqu commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Gh was messing with me, finally

sbucaille pushed a commit to sbucaille/transformers that referenced this pull request Sep 16, 2026
shanaiabuggy added a commit to NVIDIA-NeMo/nemo-compass that referenced this pull request Sep 21, 2026
## Summary

- Bump the optional `local-embedding` dependency from
`transformers==5.16.1` to `transformers==5.17.0` and refresh its
lockfile artifacts.
- Address the reported unauthorized remote-module cache write in
`GenerationMixin.load_custom_generate()`: 5.17.0 checks remote-code
consent before downloading the module.
- Regenerate the third-party inventory and preserved license notices for
the new version. No new dependencies or license types are introduced.

## Upstream fix

huggingface/transformers#48620

Although the supplied advisory lists affected versions only through
5.8.1, inspection of 5.16.1 shows the download still occurs before the
consent check. The 5.17.0 implementation contains the reordered consent
check, and its behavior was verified locally.

## Validation

- `pytest`: 321 passed (two existing LangSmith deprecation warnings).
- Ruff lint and formatting, ty, and copyright-header checks passed.
- Generated license freshness check passed for all 121 inventory
entries.
- Both workspace packages built successfully; license contents matched
in wheels, source distributions, and wheels rebuilt from source
distributions.
- Installed the optional local-embedding dependencies and verified
AutoModel/AutoTokenizer imports. A mocked remote-file existence check
with `trust_remote_code=False` raised the expected error without calling
`get_cached_module_file`.
- `git diff --check` passed.

No model weights were downloaded and full embedding inference was not
exercised.
Vidit-Ostwal pushed a commit to crewAIInc/crewAI that referenced this pull request Dec 4, 2026
- transformers 5.10.2 (locked) is affected by GHSA-x9r9-c232-4q39
  (CVE-2026-80047, high): load_custom_generate downloads
  custom_generate/generate.py before the trust_remote_code check.
- The advisory lists <= 5.8.1, but the fix (huggingface/transformers#48620)
  first shipped in 5.17.0, so scanners miss 5.9.0-5.16.1.
- Raise the floor in pyproject.toml to transformers>=5.17.0 so downstream
  installs can't resolve an affected release.
- Regenerated uv.lock with uv lock: transformers 5.20.2 (py<3.11) /
  5.24.1 (py>=3.11); also bumps hf-xet, huggingface-hub, tokenizers.

Co-authored-by: Vidit <[email protected]>
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