Hugging FaceYiYi Xu, Alvaro Somoza, Dhruv Nair, Sayak PaulAnnouncement
Introducing Modular Diffusers - Composable Building Blocks for Diffusion Pipelines
Summary
Modular Diffusers introduces a composable alternative to Diffusers’ existing DiffusionPipeline for building diffusion workflows from reusable blocks. A ModularPipeline can load a workflow definition, load model components separately with settings such as bfloat16, and preserve the familiar inference API, while blocks for text encoding, image encoding, denoising, and decoding can be inspected, run independently, or rearranged. Custom Python blocks declare components, inputs, outputs, and computation logic; the example adds a Depth Anything V2 depth processor to a Qwen Image ControlNet workflow, with data flowing between compatible blocks. Blocks and complete pipelines can be published to the Hub, and Mellon can generate node interfaces from their consistent definitions. The post presents the system as an early, flexible direction and says Mellon is not ready for production use.
Context
The existing DiffusionPipeline remains available, but the post introduces a more flexible and composable alternative for creating diffusion workflows. The stated motivation is to let users mix and match reusable blocks, build tailored workflows, and connect those workflows to a node-based interface.
Approach / What changed
Modular Diffusers represents workflows as blocks with defined components, inputs, outputs, and computation logic. Blocks can be inspected, independently initialized as pipelines, added, removed, or rearranged; ComponentsManager handles memory across multiple pipelines. Custom blocks and complete pipeline definitions can be published to the Hub, while Mellon derives node interfaces from each block’s consistent properties.
Takeaways
A ModularPipeline separates workflow definition from component loading: from_pretrained defines the workflow, while load_components loads model weights and supports settings such as torch_dtype and quantization.
Custom blocks declare expected components, inputs, intermediate outputs, and __call__ computation. In the example, a Depth Anything V2 block supplies control_image data to a Qwen Image ControlNet workflow.
Mellon can load Hub-hosted custom blocks and generate their node interfaces from the block definition, but the integration is described as early development and not ready for production use.
Source and freshness
- Source
- huggingface.co
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.