Nodes/Diffusion_pipe_in_ComfyUI/Flux Kontext模型配置器
ComfyUI Node

Flux Kontext模型配置器

Wire up Flux Kontext, BFL's image-editing model, for training

By TianDongL·Created 11 months ago·Updated 7 months ago· 69
Flux Kontext模型配置器
    • model_path
    diffusers_path
    transformer_path
    flux_shifttrue

    Flux Kontext is Black Forest Labs' follow-up to FLUX.1 - the one built for image editing and two-image conditioning, and the first major open editing model of its line. If you've seen the edit-workflow wars, Kontext is the reason a lot of open-weights editing workflows exist at all. FluxKontextModelNode is how this pack turns Kontext into a trainable base.

    What it does

    Model-config-node standard: paths in, model_path config out for GeneralConfig. Kontext shares FLUX.1-dev's VAE and text encoder, so the layout mirrors that: one folder, one optional file.

    • diffusers_path (required) - a full path to a FLUX.1-dev diffusers folder, e.g. /data/models/FLUX.1-dev. This supplies the VAE and text encoder, same trick as the Chroma node. If you already run Flux, you probably have this sitting on disk.
    • transformer_path (optional) - the Kontext single-file transformer, e.g. flux1-kontext-dev.safetensors. The tooltip calls this out as optional "to save space": leave it empty and the pack loads the transformer from the diffusers folder; fill it and it uses your single file instead. If you only have the single-file ComfyUI-style Kontext checkpoint, this is how you point at it.
    • flux_shift (optional, default true) - the resolution-dependent timestep shift. On for Kontext by default here, matching how the model behaves at inference.

    The output config is tagged type: "kontext" (well, flux_kontext family) so diffusion-pipe instantiates the right model class.

    Fitting it in

    Same skeleton as every run: FluxKontextModelNodeGeneralConfig.model_config, with adapter, dataset, and optimizer configs around it, then the Train node. The README table grants Kontext LoRA ✅, full fine-tune ✅, fp8 ✅. Kontext is an editing model, so your dataset will usually be paired - use EditModelDatasetPathNode rather than the plain dataset path node so the trainer sees source/target pairs, and pick an edit-capable model's example workflow as your starting point.

    Installing the pack

    Shared install, unchanged - Linux/WSL2 only, submodules mandatory:

    cd ComfyUI/custom_nodes/
    git clone --recurse-submodules https://github.com/TianDongL/Diffusion_pipe_in_ComfyUI.git
    git submodule update
    pip install -r Diffusion_pipe_in_ComfyUI/requirements.txt
    

    Restart and pull in the example workflow to see the canonical node wiring.

    Common issues

    The frequent mistake is treating Kontext like a from-scratch generator: you point it at a text-to-image dataset and wonder why the edits look nothing like your pairs. Kontext training wants edit pairs. Beyond that, the standard traps apply - diffusers_path must exist (the node errors if it's empty), full absolute paths, and the pack's WSL2 drive-letter convention (Z:/...). And if the transformer you want is only available as a single file, remember that's exactly what the optional transformer_path is for.

    CategoryDiffusion-Pipe/Model

    Inputs (3)

    NameTypeDefaultDescription
    diffusers_pathSTRINGFlux Dev diffusers模型文件夹的完整路径(如:/data/models/FLUX.1-dev,用于加载VAE和text encoder)
    transformer_pathoptSTRINGFlux Kontext单模型文件的完整路径(如:/data2/imagegen_models/flux-dev-single-files/flux1-kontext-dev.safetensors),可选填写以节省空间
    flux_shiftoptBOOLEANtrue分辨率相关的时间步偏移,向更多噪声偏移

    Outputs (1)

    NameTypeDescription
    model_pathmodel_path