Skip to content

[Modular] Allow custom blocks to be saved to local_dir - #12381

Merged
DN6 merged 2 commits into
mainfrom
custom-block-local-code
Oct 31, 2025
Merged

[Modular] Allow custom blocks to be saved to local_dir#12381
DN6 merged 2 commits into
mainfrom
custom-block-local-code

Conversation

@DN6

@DN6DN6 commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

What does this PR do?

Make it so that custom blocks can be saved to local_dir so that they are easy to edit.

Fixes # (issue)

Before submitting

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.

module_file=module_file,
class_name=class_name,
**hub_kwargs,
**kwargs,

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Removing this since it's not used anywhere downstream.

@DN6
DN6 requested a review from yiyixuxuSeptember 24, 2025 09:07
@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.

@DN6

DN6 commented Oct 30, 2025

Copy link
Copy Markdown
CollaboratorAuthor

cc: @yiyixuxu gentle ping

@yiyixuxu

Copy link
Copy Markdown
Collaborator

ohh but i thought you have a pretrained_model_name_or_path that's local, it would work already?

florence-2-custom-block is a local directory i have here

>>>fromdiffusersimportModularPipelineBlocksModularDiffusersiscurrentlyanexperimentalfeatureunderactivedevelopment. TheAPIissubjecttobreakingchangesinfuturereleases.
>>>blocks=ModularPipelineBlocks.from_pretrained("florence-2-custom-block", trust_remote_code=True)
`trust_remote_code`isenabled. Downloadingcodefromflorence-2-custom-block. Pleaseensureyoutrustthecontentsofthisrepository>>>blocksFlorence2ImageAnnotatorBlock {
"_class_name": "Florence2ImageAnnotatorBlock",
"_diffusers_version": "0.36.0.dev0"
}

@DN6

DN6 commented Oct 31, 2025

Copy link
Copy Markdown
CollaboratorAuthor

@yiyixuxu This is for saving to a local dir from the Hub. Loading from local works currently.

@yiyixuxu

Copy link
Copy Markdown
Collaborator

ohh so when you do from_pretrained() it will also save to a local directory, got it

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

@DN6
DN6 merged commit d54622c into mainOct 31, 2025
16 of 18 checks passed
@DN6DN6 added the roadmap Add to current release roadmap label Nov 10, 2025
@DN6DN6 moved this from In Progress to Done in Diffusers RoadmapNov 10, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

roadmapAdd to current release roadmap

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants

@DN6@HuggingFaceDocBuilderDev@yiyixuxu