diffusers/FLUX.2-klein-4B-modular
422
1---2library_name: diffusers3---4 5# Flux2 Klein 4b Modular repo6 7This contains mellon config for A single-node Mellon block for the FLUX.2-klein-4B pipeline. 8 9 10## How to create a modular repo like this one?11 12load the pipeline and save it to a new Hub repository:13```python14from diffusers import ModularPipeline15 16pipe = ModularPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B")17pipe.save_pretrained(18 "local/dir",19 repo_id="your-username/flux2-klein-auto-blocks",20 push_to_hub=True21)22```23 24## Generate the Mellon Config25 26Create and push the Mellon configuration with your desired UI types:27```python28from diffusers.modular_pipelines.mellon_node_utils import MellonPipelineConfig29 30mellon_config = MellonPipelineConfig.from_custom_block(31 pipe.blocks,32 input_types={33 "prompt": "textbox",34 "image": "image",35 "num_inference_steps": "number",36 },37 output_types={38 "images": "image"39 }40)41 42mellon_config.save(43 "local/dir",44 repo_id="your-username/flux2-klein-auto-blocks",45 push_to_hub=True46)47```48 49## Review and Adjust50 51The generated `mellon_pipeline_config.json` may need adjustments. You can:52 53- Remove inputs you don't want exposed in the UI54- Add slider ranges for numeric inputs55- Add dropdown options for string inputs56- update default value for numeric inputs57 58 59## Use in Mellon60 611. Drag a **Dynamic Block Node** from the ModularDiffusers section622. Enter `diffusers/FLUX.2-klein-4B-modular` and click "LOAD CUSTOM BLOCK" 633. The node will show your configured inputs (prompt, image, num_inference_steps) and outputs (images)64 65## Supported Mellon Types66 67| Type | Input/Output | Description |68|------|--------------|-------------|69| `image` | Both | Image (PIL Image) |70| `textbox` | Input | Text input |71| `number` | Input | Numeric input |72| `slider` | Input | Slider for numeric values |73| `dropdown` | Input | Dropdown selection |74| `checkbox` | Input | Boolean toggle |75| `text` | Both | Text display |