Introducing Modular Diffusers - Composable Building Blocks for Diffusion Pipelines
About this article
We’re on a journey to advance and democratize artificial intelligence through open source and open science.
Back to Articles Introducing Modular Diffusers - Composable Building Blocks for Diffusion Pipelines Published March 5, 2026 Update on GitHub Upvote 4 YiYi Xu YiYiXu Follow Alvaro Somoza OzzyGT Follow Dhruv Nair dn6 Follow Sayak Paul sayakpaul Follow Modular Diffusers introduces a new way to build diffusion pipelines by composing reusable blocks. Instead of writing entire pipelines from scratch, you can mix and match blocks to create workflows tailored to your needs! This complements the existing DiffusionPipeline class with a more flexible, composable alternative. In this post, we'll walk through how Modular Diffusers works — from the familiar API to run a modular pipeline, to building fully custom blocks and composing them into your own workflow. We'll also show how it integrates with Mellon, a node-based visual workflow interface that you can use to wire Modular Diffusers blocks together. Table of contents Quickstart Custom Blocks Modular Repositories Community Pipelines Integration with Mellon Quickstart Here is a simple example of how to run inference with FLUX.2 Klein 4B using pre-built blocks: import torch from diffusers import ModularPipeline # Create a modular pipeline - this only defines the workflow, model weights have not been loaded yet pipe = ModularPipeline.from_pretrained( "black-forest-labs/FLUX.2-klein-4B" ) # Now load the model weights — configure dtype, quantization, etc in this step pipe.load_components(torch_dtype=torch.bfloat16) pipe.to("cuda") # Gene...