CoolFace
Modelpublic

diffusers/FLUX.2-klein-4B-modular

sourceHugging Faceupdated 8mo agoView on Hugging Face
4likes22downloads
Model Card

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. 1.Drag a Dynamic Block Node from the ModularDiffusers section
  2. 2.Enter diffusers/FLUX.2-klein-4B-modular and click "LOAD CUSTOM BLOCK"
  3. 3.The node will show your configured inputs (prompt, image, numinferencesteps) and outputs (images)

Supported Mellon Types

TypeInput/OutputDescription
imageBothImage (PIL Image)
textboxInputText input
numberInputNumeric input
sliderInputSlider for numeric values
dropdownInputDropdown selection
checkboxInputBoolean toggle
textBothText display