Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/diffusers/commands/custom_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ def run(self):
spec = importlib.util.spec_from_file_location(module_name, str(self.block_module_name))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
getattr(module, child_class)().save_pretrained(os.getcwd())
block = getattr(module, child_class)()
block.save_pretrained(os.getcwd())
# `ModularPipeline.from_pretrained` (and therefore `diffusers-cli run`) loads a repo
# through `modular_model_index.json`, which only the pipeline-level save writes — without
# it the packaged repo is importable as blocks but not runnable as a pipeline.
block.init_pipeline().save_pretrained(os.getcwd())

def _choose_block(self, candidates, chosen=None):
for cls, base in candidates:
Expand Down
Loading
Loading