Skip to content

[Modular] Avoid downloading weights when loading from an existing local path - #14797

Open
DN6 wants to merge 4 commits into
mainfrom
overwrite-index-local-dir
Open

DN6 wants to merge 4 commits into
mainfrom
overwrite-index-local-dir

Conversation

@DN6

@DN6 DN6 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

As discussed in here.

This PR:

  • Checks if a component is being loaded from a local path
  • If the component is a model, it checks if weight files exist in the local path. If it is a scheduler/tokenizer etc, it checks for the relevant configs in the local path.
  • If the component is determined to exist locally, we opt to load from there instead of the using the hub repo id.
  • If the component does not exist locally e.g. A text encoder pointing to another repo, it gets downloaded from the hub
# assuming you have run something like this beforehand
# hf download <repo-id> --local-dir <my local path>

pipe = ModularPipeline.from_pretrained(<my local path>)
pipe.load_components() # no longer re-downloads components

Fixes # (issue)

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?
  • Are you the author (or part of the team) of the model/pipeline (only applicable for model/pipeline related PRs)?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests modular-pipelines utils pipelines size/M PR with diff < 200 LOC labels Sep 17, 2026
@DN6 DN6 changed the title [Modular] [Modular] Avoid downloading weights when loading from local path Sep 17, 2026
@DN6 DN6 changed the title [Modular] Avoid downloading weights when loading from local path [Modular] Avoid downloading weights when loading from an existing local path Sep 17, 2026
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation modular-pipelines pipelines size/M PR with diff < 200 LOC tests utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants