Wan萬相 2.1 區域性重繪
使用Wan萬相2.1區域性重繪從起始幀和結束幀產生影片。
關於
此工作流程利用 Wan 2.1 以「局部修補」為基礎的影片擴散,將一對圖片轉成一段短且連貫的影片。你提供起始影格與結束影格;WanFunInpaintToVideo 節點會引導模型在兩者之間合成運動,同時維持由圖片錨定的主體與場景細節。文字提示詞(透過 CLIPTextEncode)用於引導風格與內容,而負片提示詞可用來抑制瑕疵。
底層流程中,Step1 會載入核心元件:UNETLoader(Wan2.1 / Wan)、VAELoader/VAEDecode 用於潛空間與像素空間的轉換,以及 CLIPLoader 用於文字條件設定。起始/結束影格透過 LoadImage 匯入,並用 CLIPVisionLoader + CLIPVisionEncode 編碼,為 UNet 產生影像條件設定。KSampler 透過 ModelSamplingSD3 使用正確的 sigma 排程來驅動擴散過程,並由 CFGZeroStar 與 SkipLayerGuidanceDiT 穩定引導。Attention Booster 群組會套用 UNetTemporalAttentionMultiply 以加強跨影格的時間一致性。最後,CreateVideo 組合影格並由 SaveVideo 輸出完成的片段。
您提供的內容
- 正在讀取工作流程
在 ComfyUI 中執行。 此工作流程無法在此頁面上執行。請在已載入所有內容的 Comfy Cloud 中開啟,或下載到您自己的 ComfyUI。
在 Cloud 中試用工作流程內部
節點圖的唯讀預覽。請在 Comfy Cloud 中開啟,或下載後編輯節點。
Loading the graph
Open full-size workflow preview從程式碼使用此工作流程
可行時會根據工作流程圖和輸入內容產生;否則會顯示儲存的範例。執行可能產生費用的程式碼前,請檢查認證資訊和端點。
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({
"3": {
"class_type": "KSampler",
"inputs": {
"cfg": 6,
"denoise": 1,
"latent_image": [
"76",
2
],
"model": [
"66",
0
],
"negative": [
"76",
1
],
"positive": [
"76",
0
],
"sampler_name": "uni_pc",
"scheduler": "simple",
"seed": 622093119444720,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"38",
0
],
"text": "Fashion photography, a inflated man wearing Balenciaga clothes, fashion magazine, Balenciaga style, studio, photographer by Hugo, On-Camera Flash"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"38",
0
],
"text": "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"3",
0
],
"vae": [
"39",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"37": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "wan2.1_fun_inp_1.3B_bf16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"38": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "wan"
},
"_meta": {
"title": "Load CLIP"
}
},
"39": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "wan_2.1_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"49": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "clip_vision_h.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"51": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"49",
0
],
"crop": "none",
"image": [
"52",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"52": {
"class_type": "LoadImage",
"inputs": {
"image": "wan2.1_fun_inp_start_image.png"
},
"_meta": {
"title": "Start_image"
}
},
"65": {
"class_type": "SkipLayerGuidanceDiT",
"inputs": {
"double_layers": "9,10",
"end_percent": 0.8000000000000002,
"model": [
"37",
0
],
"rescaling_scale": 0,
"scale": 3,
"single_layers": "9,10",
"start_percent": 0.01
},
"_meta": {
"title": "SkipLayerGuidanceDiT"
}
},
"66": {
"class_type": "CFGZeroStar",
"inputs": {
"model": [
"68",
0
]
},
"_meta": {
"title": "CFGZeroStar"
}
},
"67": {
"class_type": "ModelSamplingSD3",
"inputs": {
"model": [
"65",
0
],
"shift": 5.000000000000001
},
"_meta": {
"title": "ModelSamplingSD3"
}
},
"68": {
"class_type": "UNetTemporalAttentionMultiply",
"inputs": {
"cross_structural": 1.2,
"cross_temporal": 1.3,
"model": [
"67",
0
],
"self_structural": 1,
"self_temporal": 1
},
"_meta": {
"title": "UNetTemporalAttentionMultiply"
}
},
"72": {
"class_type": "LoadImage",
"inputs": {
"image": "wan2.1_fun_inp_end_image.png"
},
"_meta": {
"title": "End_image"
}
},
"76": {
"class_type": "WanFunInpaintToVideo",
"inputs": {
"batch_size": 1,
"clip_vision_output": [
"51",
0
],
"end_image": [
"72",
0
],
"height": 768,
"length": 81,
"negative": [
"7",
0
],
"positive": [
"6",
0
],
"start_image": [
"52",
0
],
"vae": [
"39",
0
],
"width": 480
},
"_meta": {
"title": "WanFunInpaintToVideo"
}
},
"79": {
"class_type": "CreateVideo",
"inputs": {
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": 16,
"images": [
"8",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"80": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/ComfyUI",
"format": "auto",
"format.codec": "auto",
"video": [
"79",
0
]
},
"_meta": {
"title": "Save Video"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
需要。此工作流程的目的就是在兩個錨點之間合成動作。為了更好結果,請提供清晰、光線良好的起始影格,以及在視覺上與起始影格一致的結束影格。
稍微增加步數、把 UNetTemporalAttentionMultiply 微幅上調(例如 +0.1)、若細節不穩定則降低 CFG,並在迭代時固定 seed。也請確保兩張圖片解析度一致、構圖相近。
請保持 ModelSamplingSD3 連到 KSampler,以維持 Wan 2.1 的正確排程。除非你確定需要不同 sampler,否則建議只調整步數、seed 與引導強度(並保持 CFGZeroStar 與 SkipLayerGuidanceDiT 啟用)。
起始與結束影格請用相同解析度。中等尺寸(例如短邊 512–768)能兼顧細節與 VRAM。更大的影格會增加記憶體與渲染時間。