File size: 1,979 Bytes
b116921
 
 
 
4eb635d
b116921
4eb635d
b116921
 
0b528b3
b116921
4eb635d
 
 
b116921
4eb635d
 
 
 
 
 
 
b116921
4eb635d
b116921
4eb635d
 
 
b116921
4eb635d
 
0b528b3
4eb635d
 
 
0b528b3
 
 
4eb635d
 
b116921
4eb635d
0b528b3
4eb635d
 
 
 
b116921
4eb635d
b116921
4eb635d
b116921
4eb635d
 
 
 
b116921
 
4eb635d
b116921
4eb635d
0b528b3
4eb635d
b116921
4eb635d
b116921
4eb635d
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
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 |