Skip to content

cp: fix(diffusion): reuse warm HF cache instead of re-downloading models (2747) into r0.5.0 - #2754

Merged
akoumpa merged 1 commit into
r0.5.0from
cherry-pick-2747-r0.5.0
Jun 24, 2026
Merged

cp: fix(diffusion): reuse warm HF cache instead of re-downloading models (2747) into r0.5.0#2754
akoumpa merged 1 commit into
r0.5.0from
cherry-pick-2747-r0.5.0

Conversation

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

beep boop [🤖]: Hi @pthombre 👋,

we've cherry picked #2747 into  for you! 🚀

Please review and approve this cherry pick by your convenience!

…2747)

* fix(diffusion): reuse warm HF cache instead of re-downloading models

The diffusers bridge and preprocessing processors passed bare repo ids to
diffusers' from_pretrained, which resolves in online mode by default and
re-validates (and can re-download) a warm HF_HOME over the network on every
run. The transformers bridge avoids this by pre-resolving the repo to a local
snapshot dir; port the same discipline to the diffusion path.

- Add resolve_diffusion_model_dir() helper: returns local paths unchanged,
  downloads once only on a cold cache when online, then resolves the local
  snapshot with local_files_only=True so from_pretrained does no network I/O.
- Use it in NeMoAutoDiffusionPipeline.from_pretrained and from_config.
- Use it in the flux, flux2, hunyuan, qwen_image, and wan processors.
- Add unit tests for the helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pranav Prashant Thombre <pthombre@nvidia.com>

* fix(diffusion): make HF cache resolver patchable and keep diffuser tests offline

The cache-resolution helper imported snapshot_download inside the function
body, so test_hf_cache.py's patch of the module-level name failed at setup.
Bind it at module scope (guarded by the optional-dep check) so it is
patchable, with identical runtime behavior.

The auto_diffusion_pipeline from_pretrained/from_config tests mock
DiffusionPipeline but not the newly added resolve_diffusion_model_dir call,
so they reached the Hub for fake repo ids (401). Add an autouse fixture that
resolves repo ids to a passthrough, keeping the unit tests offline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pranav Prashant Thombre <pthombre@nvidia.com>

---------

Signed-off-by: Pranav Prashant Thombre <pthombre@nvidia.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
@svcnvidia-nemo-ci
svcnvidia-nemo-ci requested a review from a team as a code owner June 24, 2026 06:57
@svcnvidia-nemo-ci svcnvidia-nemo-ci added cherry-pick Run CICD Trigger Testing CICD labels Jun 24, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor Author

/ok to test a0fedc8

@copy-pr-bot

copy-pr-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@akoumpa
akoumpa merged commit 8751227 into r0.5.0 Jun 24, 2026
77 of 79 checks passed
@akoumpa
akoumpa deleted the cherry-pick-2747-r0.5.0 branch June 24, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick Run CICD Trigger Testing CICD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants