FLUX.2 [Klein] 4B 蒸餾版:圖片編輯
Klein 家族中速度最快的版本。專為互動式應用、實時預覽和對延遲敏感的生產場景打造。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"76": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"81": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_reference_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"94": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Flux2-Klein",
"images": [
"92:65",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"92:61": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"92:62": {
"class_type": "Flux2Scheduler",
"inputs": {
"height": [
"92:81",
1
],
"steps": 4,
"width": [
"92:81",
0
]
},
"_meta": {
"title": "Flux2Scheduler"
}
},
"92:63": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 1,
"model": [
"92:70",
0
],
"negative": [
"92:84:76",
0
],
"positive": [
"92:84:77",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"92:64": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"92:63",
0
],
"latent_image": [
"92:66",
0
],
"noise": [
"92:73",
0
],
"sampler": [
"92:61",
0
],
"sigmas": [
"92:62",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"92:65": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"92:64",
0
],
"vae": [
"92:72",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"92:66": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": [
"92:81",
1
],
"width": [
"92:81",
0
]
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"92:70": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux-2-klein-4b-fp8.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"92:71": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_3_4b.safetensors",
"device": "default",
"type": "flux2"
},
"_meta": {
"title": "Load CLIP"
}
},
"92:72": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"92:73": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 432262096973495
},
"_meta": {
"title": "RandomNoise"
}
},
"92:74": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"92:71",
0
],
"text": "Restyle the object in image 1 with the woven pattern and colours from the textile in image 2. Cover the whole enclosure and its lid with the stepped medallions and sunburst motifs, in the same vermilion red, cobalt blue, saffron yellow and black, as if the pattern were enamelled onto the surface. Let the motifs wrap naturally around the edges and follow the bevelled corners and the recessed seam, scaled so several full medallions fit across the top. Keep the object's exact shape, size, position and the round stone plinth beneath it unchanged. Keep the warm taupe studio backdrop, the soft overhead light and the gentle contact shadow from image 1. The finish is a smooth glossy glaze with soft reflections, crisp edges and no text."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"92:79:76": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"92:86",
0
],
"latent": [
"92:79:78",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"92:79:77": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"92:74",
0
],
"latent": [
"92:79:78",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"92:79:78": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"92:80",
0
],
"vae": [
"92:72",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"92:80": {
"class_type": "ImageScaleToTotalPixels",
"inputs": {
"image": [
"76",
0
],
"megapixels": 1,
"resolution_steps": 1,
"upscale_method": "nearest-exact"
},
"_meta": {
"title": "Scale Image to Total Pixels"
}
},
"92:81": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"92:80",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"92:84:76": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"92:79:76",
0
],
"latent": [
"92:84:78",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"92:84:77": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"92:79:77",
0
],
"latent": [
"92:84:78",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"92:84:78": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"92:85",
0
],
"vae": [
"92:72",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"92:85": {
"class_type": "ImageScaleToTotalPixels",
"inputs": {
"image": [
"81",
0
],
"megapixels": 1,
"resolution_steps": 1,
"upscale_method": "nearest-exact"
},
"_meta": {
"title": "Scale Image to Total Pixels"
}
},
"92:86": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"92:74",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
}
})
workflow.set_input("76", "image", client.assets.from_url("https://comfy.org/catalog-media/904478c3-f8cb-49d8-ae87-2d2a37c7c277/7da4b4ee-74cd-4e72-b27d-4f79fefa975c"))
workflow.set_input("81", "image", client.assets.from_url("https://comfy.org/catalog-media/8dca4d88-7b50-457a-9563-a094cc1750c2/634b4e77-cc50-4a50-81ac-87180de56035"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("94"):
output.to_file(output.name)試試範例
關於此工作流程
此 ComfyUI 工作流程名為「FLUX.2 [Klein] 4B Distilled: Image Edit」,著重於互動式應用與即時預覽的快速影像編輯。它使用 FLUX.2 Klein 模型,針對延遲敏感的生產環境進行最佳化,以速度為優先。工作流程包含多個關鍵節點,例如用於輸出儲存的「SaveImage」、用於輸入處理的「LoadImage」,以及一個識別碼為「7b34ab90-36f9-45ba-a665-71d418f0df18」的處理節點。此外也包含「MarkdownNote」節點,用於在工作流程內提供說明與指引。
在技術層面,此流程利用 FLUX.2 Klein 模型的效率優勢,能快速產生高品質的影像編輯結果。「Multiple input example」工作流程群組讓你可在不同輸入配置間切換,提升彈性與控制度。此設定特別適合需要在製作環境中快速調整與反覆迭代的使用者,例如在緊迫時程下工作的平面設計師或數位藝術家。
問答
FLUX.2 Klein 模型針對速度與效率做了最佳化,適合延遲要求高的情境,例如即時預覽與互動式編輯。
此工作流程主要針對單張圖片的即時編輯最佳化,但你可以透過迭代多張圖片(例如重複使用「LoadImage」節點)來改造成批次處理流程。
你可以在「7b34ab90-36f9-45ba-a665-71d418f0df18」節點中調整參數,以符合你的編輯需求。
有,請參考 Subgraph docs 了解子圖在工作流程中的運作方式。
相關工作流程
- Flux.2 Dev, Flux
Create a product mockup
- Flux, Flux.2
BFL FLUX.2 [max]: 物體替換
- CChroma, Flux
Chroma: 文生圖
- Flux
FLUX 3 Image Klein Distilled: Image Edit
- Flux
FLUX 3 Image Klein Distilled: Text to Image
- Flux
FLUX 3 Image Klein: Image Edit
- Flux
FLUX 3 Image Klein: Text to Image
- Flux
FLUX 3 影片:文字轉影片
- Flux
FLUX 3 影片:文字轉影片
- Flux.1 Kontext, Flux
Flux Kontext Dev 圖像編輯
- Flux
FLUX 虛擬試穿
- Flux, Flux.1
Flux.1 [專業版]:文生圖