SDXL Refiner 提示詞
使用精煉模型增強SDXL圖像。
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
需要付費 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({
"4": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "sd_xl_base_1.0.safetensors"
},
"_meta": {
"title": "Load Checkpoint - BASE"
}
},
"5": {
"class_type": "EmptyLatentImage",
"inputs": {
"batch_size": 1,
"height": 768,
"width": 1344
},
"_meta": {
"title": "Empty Latent Image"
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"4",
1
],
"text": "An atmospheric retro-fantasy illustration captured from an elevated bird's-eye perspective with a panoramic 24mm wide-angle lens. At the center, a colossal floating dodecahedron carved from rough, porous volcanic basalt and veined raw malachite hovers majestically. Intricate fractal cracks glow with deep interior smoldering embers, casting soft rim lighting across its weathered, matte stone facets. Flanking canyon ridges and staggered sandstone buttes stretch endlessly toward distant horizon lines, shrouded in low-lying ochre dust and golden atmospheric haze. Gentle late-afternoon sunbeams rake across the arid valley floor, creating long sweeping umber shadows and warm terracotta highlights. The rich, earthy palette balances burnt sienna, dusty sage green, and muted copper with the fiery molten core of the monolith. Deep cinematic shadows and diffused twilight haze emphasize the vast, quiet expanse around the solitary geometric relic."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"4",
1
],
"text": "text, watermark"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"10": {
"class_type": "KSamplerAdvanced",
"inputs": {
"add_noise": "enable",
"cfg": 8,
"end_at_step": 20,
"latent_image": [
"5",
0
],
"model": [
"4",
0
],
"negative": [
"7",
0
],
"noise_seed": 6767725640732,
"positive": [
"6",
0
],
"return_with_leftover_noise": "enable",
"sampler_name": "euler",
"scheduler": "normal",
"start_at_step": 0,
"steps": 25
},
"_meta": {
"title": "KSampler (Advanced) - BASE"
}
},
"11": {
"class_type": "KSamplerAdvanced",
"inputs": {
"add_noise": "disable",
"cfg": 8,
"end_at_step": 10000,
"latent_image": [
"10",
0
],
"model": [
"12",
0
],
"negative": [
"16",
0
],
"noise_seed": 0,
"positive": [
"15",
0
],
"return_with_leftover_noise": "disable",
"sampler_name": "euler",
"scheduler": "normal",
"start_at_step": 20,
"steps": 25
},
"_meta": {
"title": "KSampler (Advanced) - REFINER"
}
},
"12": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "sd_xl_refiner_1.0.safetensors"
},
"_meta": {
"title": "Load Checkpoint - REFINER"
}
},
"15": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"12",
1
],
"text": "An atmospheric retro-fantasy illustration captured from an elevated bird's-eye perspective with a panoramic 24mm wide-angle lens. At the center, a colossal floating dodecahedron carved from rough, porous volcanic basalt and veined raw malachite hovers majestically. Intricate fractal cracks glow with deep interior smoldering embers, casting soft rim lighting across its weathered, matte stone facets. Flanking canyon ridges and staggered sandstone buttes stretch endlessly toward distant horizon lines, shrouded in low-lying ochre dust and golden atmospheric haze. Gentle late-afternoon sunbeams rake across the arid valley floor, creating long sweeping umber shadows and warm terracotta highlights. The rich, earthy palette balances burnt sienna, dusty sage green, and muted copper with the fiery molten core of the monolith. Deep cinematic shadows and diffused twilight haze emphasize the vast, quiet expanse around the solitary geometric relic."
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"16": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"12",
1
],
"text": "text, watermark"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"17": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"11",
0
],
"vae": [
"12",
2
]
},
"_meta": {
"title": "VAE Decode"
}
},
"19": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"17",
0
]
},
"_meta": {
"title": "Save Image"
}
}
})
# 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("19"):
output.to_file(output.name)試試範例
關於此工作流程
此 ComfyUI 工作流程用於透過 refiner 模型,強化由 Stable Diffusion XL(SDXL)模型生成的圖片。它利用一系列節點產生更精緻的輸出,兼顧品質與觀感。工作流程先使用 CheckpointLoaderSimple 節點載入基礎 SDXL 模型,該節點會針對所選 SD 模型版本自動套用最佳化設定。接著,使用 EmptyLatentImage 節點生成初始 latent 圖,作為後續精修的畫布。
此工作流程的核心在於使用 CLIPTextEncode 節點解讀文字提示詞,來引導圖像生成流程。KSamplerAdvanced 節點會向影像加入可控雜訊,讓模型以迭代方式精修並提升輸出。精修完成後,VAEDecode 節點把 latent 資料轉換為可見影像格式,以便進行最後調整。最後由 SaveImage 節點將強化後影像以 PNG 格式保存。此工作流程特別適合需要高品質精修影像的創作者與設計師,因為它結合了 SDXL 模型與進階的精修技術。
問答
The KSamplerAdvanced node introduces controlled noise into the image, allowing the model to iteratively refine and enhance the visual output.
Yes, the workflow is designed to be compatible with SD1.5 and SD2.x models, but it's optimized for SDXL.
Recommended resolutions for SDXL include 1024x1024, 1152x896, 896x1152, 1216x832, 832x1216, 1344x768, 768x1344, 1536x640, and 640x1536.
When loading the workflow, manually select your local model in the CheckpointLoaderSimple node to ensure compatibility.