--- library_name: diffusers --- # Flux2 Klein 4b Modular repo This contains mellon config for A single-node Mellon block for the FLUX.2-klein-4B pipeline. ## How to create a modular repo like this one? load the pipeline and save it to a new Hub repository: ```python from diffusers import ModularPipeline pipe = ModularPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B") pipe.save_pretrained( "local/dir", repo_id="your-username/flux2-klein-auto-blocks", push_to_hub=True ) ``` ## Generate the Mellon Config Create and push the Mellon configuration with your desired UI types: ```python from diffusers.modular_pipelines.mellon_node_utils import MellonPipelineConfig mellon_config = MellonPipelineConfig.from_custom_block( pipe.blocks, input_types={ "prompt": "textbox", "image": "image", "num_inference_steps": "number", }, output_types={ "images": "image" } ) mellon_config.save( "local/dir", repo_id="your-username/flux2-klein-auto-blocks", push_to_hub=True ) ``` ## Review and Adjust The generated `mellon_pipeline_config.json` may need adjustments. You can: - Remove inputs you don't want exposed in the UI - Add slider ranges for numeric inputs - Add dropdown options for string inputs - update default value for numeric inputs ## Use in Mellon 1. Drag a **Dynamic Block Node** from the ModularDiffusers section 2. Enter `diffusers/FLUX.2-klein-4B-modular` and click "LOAD CUSTOM BLOCK" 3. The node will show your configured inputs (prompt, image, num_inference_steps) and outputs (images) ## Supported Mellon Types | Type | Input/Output | Description | |------|--------------|-------------| | `image` | Both | Image (PIL Image) | | `textbox` | Input | Text input | | `number` | Input | Numeric input | | `slider` | Input | Slider for numeric values | | `dropdown` | Input | Dropdown selection | | `checkbox` | Input | Boolean toggle | | `text` | Both | Text display |