Flux Kontext模型配置器
Wire up Flux Kontext, BFL's image-editing model, for training
- model_path
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: FluxKontextModelNode → GeneralConfig.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.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| diffusers_path | STRING | Flux Dev diffusers模型文件夹的完整路径(如:/data/models/FLUX.1-dev,用于加载VAE和text encoder) | |
| transformer_pathopt | STRING | Flux Kontext单模型文件的完整路径(如:/data2/imagegen_models/flux-dev-single-files/flux1-kontext-dev.safetensors),可选填写以节省空间 | |
| flux_shiftopt | BOOLEAN | true | 分辨率相关的时间步偏移,向更多噪声偏移 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model_path | model_path | — |