Skip to content

[docs] discourage cross repo references for modular repos. - #15081

Open
sayakpaul wants to merge 4 commits into
mainfrom
discourage-cross-repo-references
Open

sayakpaul wants to merge 4 commits into
mainfrom
discourage-cross-repo-references

Conversation

@sayakpaul

Copy link
Copy Markdown
Member

Related to #14835.

Cc: @LysandreJik for visibility.

@sayakpaul
sayakpaul requested a review from yiyixuxu October 19, 2026 10:34
@github-actions github-actions Bot added documentation Improvements or additions to documentation size/S PR with diff < 50 LOC labels Oct 19, 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.

@yiyixuxu yiyixuxu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks a lot for the PR!
i left some comments, mainly I think we should try directly teach people the best practice

Comment thread docs/source/en/modular_diffusers/modular_pipeline.md Outdated
Comment thread docs/source/en/modular_diffusers/modular_pipeline.md Outdated
Comment thread docs/source/en/modular_diffusers/modular_pipeline.md Outdated
@sayakpaul
sayakpaul requested a review from yiyixuxu October 20, 2026 05:35
Load only what's new (or nothing at all). Only loaded components are saved; everything else stays a pointer to its original repository. Use this mode when you want to replace one component while continuing to load the others from their original repository. For example, save a custom transformer while the remaining components continue to load from the base repository.
Use this mode only when you intentionally want components to remain hosted in other repositories. Only loaded components are saved; everything else keeps a reference to its original repository. For example, save a custom transformer while the remaining components continue to load from the base repository. For new repositories, prefer [saving all components together](#save-a-self-contained-copy) and relying on shared caching for identical files.

```py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i think we can remove this section (Keep references to existing components) now if we don't want people to do this?

we did mention this briefly in the next section i think it is sufficient

A component's loading specification in `modular_model_index.json` can point to a different repository. For example, ...

however there are some content under this section that are still useful, so we can move them around a bit

for example

this bit, should probably go into #Save a self-contained copy section, no? it's really about to save a self-contained copy

Moving the files any other way doesn't rewrite the index. A copy downloaded with `hf download --local-dir` still works: when a pipeline is loaded from a local directory, every component whose files are present in that directory is loaded from it instead of the recorded repository. A copy uploaded with `hf upload` keeps pointing at the old location, so update the index manually in that case.

and then the last bit about custom code, not sure why it is in this section to begin with, we can give it a new section maybe? #Custom code?


Load custom code repositories with `trust_remote_code=True` as shown in [from_pretrained](#frompretrained). See [Custom blocks](./custom_blocks) for how to create and share your own.

### Referencing components in other repositories

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we move this up before or combine with Update an existing modular index -> since it's about update the modular_model_index.json to make it self-contained, so I think it needs this context first

This branch has not been deployed

No deployments
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 size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants