from dataclasses import replace from diffusers.modular_pipelines import ModularPipelineBlocks class ResolvableBlock(ModularPipelineBlocks): """Leaf block whose generic component specs can carry the model repository's resolved classes and location. `Pixal3DBlocks(components_repo=...)` fills `component_overrides`, so a sub-block popped out of the pipeline still loads the right custom classes from the right repository. """ component_overrides = {} def resolve(self, specs): return [ replace(spec, **self.component_overrides[spec.name]) if spec.name in self.component_overrides else spec for spec in specs ]