comfy-ts 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -11
- package/dist/cli.js +4 -4439
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +445 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7439 -340
- package/dist/index.d.ts +7457 -358
- package/dist/index.js +444 -172
- package/dist/index.js.map +1 -1
- package/dist/{run-tui-BFhba_oG.js → run-tui-BAdizWsO.js} +1244 -201
- package/dist/run-tui-BAdizWsO.js.map +1 -0
- package/dist/state-BYbxDgfr.js +5258 -0
- package/dist/state-BYbxDgfr.js.map +1 -0
- package/examples/README.md +32 -0
- package/examples/comfy-cloud/ace-step-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/anima-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/boogu-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/capybara-i2i.cflow.ts +85 -0
- package/examples/comfy-cloud/capybara-i2v.cflow.ts +90 -0
- package/examples/comfy-cloud/capybara-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/chroma-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/cloudHost.ts +41 -0
- package/examples/comfy-cloud/ernie-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/firered-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/flux1-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/flux1-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/flux2-i2i.cflow.ts +80 -0
- package/examples/comfy-cloud/flux2-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/hidream-i2i.cflow.ts +89 -0
- package/examples/comfy-cloud/hidream-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +93 -0
- package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +74 -0
- package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +80 -0
- package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +95 -0
- package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +60 -0
- package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/krea2-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/lens-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/longcat-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/longcat-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/ltxv-i2v.cflow.ts +92 -0
- package/examples/comfy-cloud/ltxv-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/newbie-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +86 -0
- package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/ovis-t2i.cflow.ts +56 -0
- package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +69 -0
- package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +55 -0
- package/examples/comfy-cloud/sd35-t2i.cflow.ts +48 -0
- package/examples/comfy-cloud/sdk.d.ts +445 -57
- package/examples/comfy-cloud/sdxl-t2i.cflow.ts +69 -0
- package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +53 -0
- package/examples/comfy-cloud/svd-i2v.cflow.ts +75 -0
- package/examples/comfy-cloud/wan21-i2v.cflow.ts +83 -0
- package/examples/comfy-cloud/wan21-t2v.cflow.ts +64 -0
- package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +69 -0
- package/examples/comfy-cloud/wan22-i2v.cflow.ts +107 -0
- package/examples/comfy-cloud/wan22-t2v.cflow.ts +98 -0
- package/examples/comfy-cloud/z-image-t2i.cflow.ts +62 -0
- package/examples/images/README.md +18 -0
- package/examples/images/bear_1024x1024.jpg +0 -0
- package/examples/images/deer_768x1344.jpg +0 -0
- package/examples/images/dog_512x512.jpg +0 -0
- package/examples/images/lioness_768x768.jpg +0 -0
- package/examples/images/pug_200x300.jpg +0 -0
- package/examples/images/walrus_1344x768.jpg +0 -0
- package/examples/{01-txt2img.cflow.ts → rvion/01-txt2img.cflow.ts} +1 -1
- package/examples/{02-img2img-upload.cflow.ts → rvion/02-img2img-upload.cflow.ts} +7 -18
- package/examples/{03-export-workflow-json.cflow.ts → rvion/03-export-workflow-json.cflow.ts} +1 -1
- package/examples/{04-krea2-turbo-t2i.cflow.ts → rvion/04-krea2-turbo-t2i.cflow.ts} +2 -2
- package/examples/rvion/05-comfy-cloud.cflow.ts +51 -0
- package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
- package/guide-for-agents.md +7 -1
- package/package.json +18 -4
- package/src/cli/tui/components/CopyOverlay.tsx +25 -0
- package/src/cli/tui/components/Header.tsx +9 -4
- package/src/cli/tui/components/HostPanel.tsx +3 -2
- package/src/cli/tui/components/HostsOverlay.tsx +33 -0
- package/src/cli/tui/components/PreviewPanel.tsx +9 -8
- package/src/cli/tui/components/StatusBar.tsx +39 -9
- package/src/cli/tui/components/TreePanel.tsx +17 -7
- package/src/cli/tui/components/TuiApp.tsx +65 -5
- package/src/cli/tui/discoverWorkflows.ts +7 -41
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +72 -0
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +288 -0
- package/src/cli/tui/imagePicker/fsListing.ts +48 -0
- package/src/cli/tui/imagePicker/pickerPrefs.ts +78 -0
- package/src/cli/tui/run-tui.tsx +49 -8
- package/src/cli/tui/state/DraftsSt.ts +3 -2
- package/src/cli/tui/state/ExecSt.ts +108 -12
- package/src/cli/tui/state/HostSt.ts +94 -10
- package/src/cli/tui/state/LorasSt.ts +14 -36
- package/src/cli/tui/state/PickerSt.ts +8 -2
- package/src/cli/tui/state/PreviewSt.ts +28 -2
- package/src/cli/tui/state/QueueSt.ts +2 -2
- package/src/cli/tui/state/SettingsSt.ts +25 -7
- package/src/cli/tui/state/TreeSt.ts +139 -36
- package/src/cli/tui/state/TuiSt.ts +53 -6
- package/src/cli/tui/state/WorkflowsSt.ts +14 -2
- package/src/cli/tui/treeRows.ts +165 -0
- package/src/exampleAssets.ts +56 -0
- package/src/graph/ComfyNode.ts +4 -1
- package/src/host/ComfyHost.ts +7 -0
- package/src/index.ts +7 -0
- package/src/manager/ComfyRegistry.ts +37 -9
- package/src/manager/generated/KnownComfyCustomNodeName.ts +23852 -1926
- package/src/manager/generated/KnownComfyPluginTitle.ts +6854 -236
- package/src/manager/generated/KnownComfyPluginURL.ts +3425 -111
- package/src/manager/generated/KnownModel_Base.ts +23 -7
- package/src/manager/generated/KnownModel_FileName.ts +421 -0
- package/src/manager/generated/KnownModel_Name.ts +421 -0
- package/src/manager/generated/KnownModel_SavePath.ts +34 -8
- package/src/manager/generated/KnownModel_Type.ts +18 -14
- package/src/manager/json/alter-list.json +221 -221
- package/src/manager/json/custom-node-list.json +61020 -21946
- package/src/manager/json/extension-node-map.json +81077 -31176
- package/src/manager/json/github-stats.json +29321 -12601
- package/src/manager/json/model-list.json +5935 -4997
- package/src/manager/loaders/parseReport.ts +55 -0
- package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +15 -49
- package/src/manager/loaders/step2_custom-node-list-loader.ts +38 -83
- package/src/manager/loaders/step3_extension-node-map-loader.ts +36 -142
- package/src/manager/loaders/step4_model-list-loader.ts +25 -36
- package/src/manager/loaders/step5_alter-list-loader.ts +29 -0
- package/src/manager/loaders/step6_github-stats-loader.ts +23 -0
- package/src/manager/script-update-manager.bun.ts +9 -1
- package/src/manager/types/ComfyManagerAlterInfo.ts +13 -0
- package/src/manager/types/ComfyManagerFileModelInfo.ts +7 -3
- package/src/manager/types/ComfyManagerFilePluginContent.ts +6 -9
- package/src/manager/types/ComfyManagerFilePluginList.ts +3 -3
- package/src/manager/types/ComfyManagerGithubStats.ts +9 -0
- package/src/manager/types/ComfyManagerPluginContentMetadata.ts +2 -3
- package/src/manager/types/ComfyManagerPluginInfo.ts +48 -34
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/sdk-generator/ComfySchema.ts +14 -1
- package/src/sdk-generator/comfyui-sdk-codegen.ts +15 -0
- package/src/sdk-generator/inputWidgetKind.ts +17 -0
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +106 -5
- package/src/vars/DefinedWorkflow.ts +28 -10
- package/dist/DefinedWorkflow-O3ynII3Y.js +0 -598
- package/dist/DefinedWorkflow-O3ynII3Y.js.map +0 -1
- package/dist/run-tui-BFhba_oG.js.map +0 -1
- package/examples/05-comfy-cloud.cflow.ts +0 -67
- package/src/utils/tryExtracting.ts +0 -41
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// sdxl t2i on Comfy Cloud — SDXL base + refiner, two stage KSamplerAdvanced handoff
|
|
2
|
+
// source template: sdxl_simple_example.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/sdxl-t2i.cflow.ts ["prompt"] [seed]
|
|
5
|
+
import { v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
export const sdxlT2i = host.defineWorkflow({
|
|
11
|
+
id: 'sdxl-t2i',
|
|
12
|
+
vars: {
|
|
13
|
+
prompt: v.prompt('evening sunset scenery blue sky nature, glass bottle with a galaxy in it\n- text, watermark'),
|
|
14
|
+
seed: v.seed(42),
|
|
15
|
+
steps: v.int(25, { min: 1, max: 60 }),
|
|
16
|
+
// base samples steps 0..refinerStart with leftover noise, refiner finishes refinerStart..steps
|
|
17
|
+
refinerStart: v.int(20, { min: 0, max: 60 }),
|
|
18
|
+
cfg: v.float(8, { min: 0, max: 30 }),
|
|
19
|
+
// SDXL trained resolutions: 1024x1024, 1152x896, 1216x832, 1344x768, 1536x640 (and flipped)
|
|
20
|
+
size: v.size({ width: 1024, height: 1024 }),
|
|
21
|
+
},
|
|
22
|
+
build: (b, vars) => {
|
|
23
|
+
const base = b.CheckpointLoaderSimple({ ckpt_name: 'sd_xl_base_1.0.safetensors' })
|
|
24
|
+
const refiner = b.CheckpointLoaderSimple({ ckpt_name: 'sd_xl_refiner_1.0.safetensors' })
|
|
25
|
+
const baseSamples = b.KSamplerAdvanced({
|
|
26
|
+
model: base,
|
|
27
|
+
positive: b.CLIPTextEncode({ clip: base, text: vars.prompt.positive }),
|
|
28
|
+
negative: b.CLIPTextEncode({ clip: base, text: vars.prompt.negative }),
|
|
29
|
+
latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
30
|
+
add_noise: 'enable',
|
|
31
|
+
noise_seed: vars.seed,
|
|
32
|
+
steps: vars.steps,
|
|
33
|
+
cfg: vars.cfg,
|
|
34
|
+
sampler_name: 'euler',
|
|
35
|
+
scheduler: 'normal',
|
|
36
|
+
start_at_step: 0,
|
|
37
|
+
end_at_step: vars.refinerStart,
|
|
38
|
+
return_with_leftover_noise: 'enable',
|
|
39
|
+
})
|
|
40
|
+
const samples = b.KSamplerAdvanced({
|
|
41
|
+
model: refiner,
|
|
42
|
+
positive: b.CLIPTextEncode({ clip: refiner, text: vars.prompt.positive }),
|
|
43
|
+
negative: b.CLIPTextEncode({ clip: refiner, text: vars.prompt.negative }),
|
|
44
|
+
latent_image: baseSamples,
|
|
45
|
+
add_noise: 'disable',
|
|
46
|
+
noise_seed: 0,
|
|
47
|
+
steps: vars.steps,
|
|
48
|
+
cfg: vars.cfg,
|
|
49
|
+
sampler_name: 'euler',
|
|
50
|
+
scheduler: 'normal',
|
|
51
|
+
start_at_step: vars.refinerStart,
|
|
52
|
+
end_at_step: 10000,
|
|
53
|
+
return_with_leftover_noise: 'disable',
|
|
54
|
+
})
|
|
55
|
+
b.SaveImage({ images: b.VAEDecode({ samples, vae: refiner }), filename_prefix: 'comfy-ts-zoo/sdxl-t2i' })
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export default sdxlT2i
|
|
60
|
+
|
|
61
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
62
|
+
if (import.meta.main) {
|
|
63
|
+
requireCloudKey()
|
|
64
|
+
if (process.argv[2]) sdxlT2i.vars.prompt.set(process.argv[2])
|
|
65
|
+
if (process.argv[3]) sdxlT2i.vars.seed.set(Number(process.argv[3]))
|
|
66
|
+
const execution = await sdxlT2i.run({ log: true })
|
|
67
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
68
|
+
host.disconnect()
|
|
69
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// stable-audio t2a on Comfy Cloud — Stable Audio Open 1.0 text to audio, up to ~47s, mp3 out
|
|
2
|
+
// source template: audio_stable_audio_example.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/stable-audio-t2a.cflow.ts ["prompt"] [seed]
|
|
5
|
+
import { v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
export const stableAudioT2a = host.defineWorkflow({
|
|
11
|
+
id: 'stable-audio-t2a',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt('heaven church electronic dance music'),
|
|
15
|
+
seed: v.seed(42),
|
|
16
|
+
seconds: v.float(47.6, { min: 1, max: 1000 }),
|
|
17
|
+
steps: v.int(50, { min: 1, max: 100 }),
|
|
18
|
+
},
|
|
19
|
+
build: (b, vars) => {
|
|
20
|
+
const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'stable-audio-open-1.0.safetensors' })
|
|
21
|
+
const clip = b.CLIPLoader({ clip_name: 't5-base.safetensors', type: 'stable_audio', device: 'default' })
|
|
22
|
+
const samples = b.KSampler({
|
|
23
|
+
model: ckpt,
|
|
24
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
25
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
26
|
+
latent_image: b.EmptyLatentAudio({ seconds: vars.seconds, batch_size: 1 }),
|
|
27
|
+
seed: vars.seed,
|
|
28
|
+
steps: vars.steps,
|
|
29
|
+
cfg: 4.98,
|
|
30
|
+
sampler_name: 'dpmpp_3m_sde_gpu',
|
|
31
|
+
scheduler: 'exponential',
|
|
32
|
+
denoise: 1,
|
|
33
|
+
})
|
|
34
|
+
b.SaveAudioMP3({
|
|
35
|
+
audio: b.VAEDecodeAudio({ samples, vae: ckpt }),
|
|
36
|
+
filename_prefix: 'comfy-ts-zoo/stable-audio-t2a',
|
|
37
|
+
quality: 'V0',
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export default stableAudioT2a
|
|
43
|
+
|
|
44
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
45
|
+
if (import.meta.main) {
|
|
46
|
+
requireCloudKey()
|
|
47
|
+
if (process.argv[2]) stableAudioT2a.vars.prompt.set(process.argv[2])
|
|
48
|
+
if (process.argv[3]) stableAudioT2a.vars.seed.set(Number(process.argv[3]))
|
|
49
|
+
const execution = await stableAudioT2a.run({ log: true })
|
|
50
|
+
// SaveAudio outputs land host side (no auto-download for audio yet)
|
|
51
|
+
console.log(`🟢 ${execution.status}: audio saved on the host under comfy-ts-zoo/stable-audio-t2a`)
|
|
52
|
+
host.disconnect()
|
|
53
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// svd i2v on Comfy Cloud — Stable Video Diffusion (svd_xt), 25 frames from a still image, no text prompt
|
|
2
|
+
// source template: txt_to_image_to_video.json (official workflow-templates), SDXL t2i half replaced by LoadImage
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/svd-i2v.cflow.ts [path/to/image.png] [seed]
|
|
5
|
+
import { asAbsolutePath, exampleImagePath, MediaImage, v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
// bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
|
|
11
|
+
const image = v.image(exampleImagePath('walrus_1344x768.jpg'))
|
|
12
|
+
|
|
13
|
+
export const svdI2v = host.defineWorkflow({
|
|
14
|
+
id: 'svd-i2v',
|
|
15
|
+
// no prompt var: SVD conditions on the image alone (clip vision), there is no text branch
|
|
16
|
+
vars: {
|
|
17
|
+
image,
|
|
18
|
+
seed: v.seed(42),
|
|
19
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
20
|
+
cfg: v.float(2.5, { min: 0, max: 30 }),
|
|
21
|
+
length: v.int(25, { min: 1, max: 25 }),
|
|
22
|
+
fps: v.int(10, { min: 1, max: 60 }),
|
|
23
|
+
motion: v.int(127, { min: 1, max: 1023 }),
|
|
24
|
+
},
|
|
25
|
+
// async build: the input image is uploaded (hash-named, deduped) per run
|
|
26
|
+
build: async (b, vars, wf) => {
|
|
27
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
28
|
+
const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
|
|
29
|
+
|
|
30
|
+
const ckpt = b.ImageOnlyCheckpointLoader({ ckpt_name: 'svd_xt.safetensors' })
|
|
31
|
+
// SVD_img2vid_Conditioning resizes init_image to width x height itself, no scale node needed
|
|
32
|
+
const video = b.SVD_img2vid_Conditioning({
|
|
33
|
+
clip_vision: ckpt,
|
|
34
|
+
init_image: loaded,
|
|
35
|
+
vae: ckpt,
|
|
36
|
+
width: 1024,
|
|
37
|
+
height: 576,
|
|
38
|
+
video_frames: vars.length,
|
|
39
|
+
motion_bucket_id: vars.motion,
|
|
40
|
+
fps: 6,
|
|
41
|
+
augmentation_level: 0,
|
|
42
|
+
})
|
|
43
|
+
const samples = b.KSampler({
|
|
44
|
+
model: b.VideoLinearCFGGuidance({ model: ckpt, min_cfg: 1 }),
|
|
45
|
+
positive: video.outputs.positive,
|
|
46
|
+
negative: video.outputs.negative,
|
|
47
|
+
latent_image: video.outputs.latent,
|
|
48
|
+
seed: vars.seed,
|
|
49
|
+
steps: vars.steps,
|
|
50
|
+
cfg: vars.cfg,
|
|
51
|
+
sampler_name: 'euler',
|
|
52
|
+
scheduler: 'karras',
|
|
53
|
+
denoise: 1,
|
|
54
|
+
})
|
|
55
|
+
b.SaveVideo({
|
|
56
|
+
video: b.CreateVideo({ images: b.VAEDecode({ samples, vae: ckpt }), fps: vars.fps }),
|
|
57
|
+
filename_prefix: 'comfy-ts-zoo/svd-i2v',
|
|
58
|
+
format: 'auto',
|
|
59
|
+
codec: 'auto',
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export default svdI2v
|
|
65
|
+
|
|
66
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
67
|
+
if (import.meta.main) {
|
|
68
|
+
requireCloudKey()
|
|
69
|
+
if (process.argv[2]) svdI2v.vars.image.set(process.argv[2])
|
|
70
|
+
if (process.argv[3]) svdI2v.vars.seed.set(Number(process.argv[3]))
|
|
71
|
+
const execution = await svdI2v.run({ log: true })
|
|
72
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
73
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/svd-i2v`)
|
|
74
|
+
host.disconnect()
|
|
75
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// wan21 i2v on Comfy Cloud — Wan 2.1 14B 480p image to video: start image + CLIP vision steer the motion
|
|
2
|
+
// source template: image_to_video_wan.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/wan21-i2v.cflow.ts [path/to/image.png] ["prompt"]
|
|
5
|
+
import { asAbsolutePath, exampleImagePath, MediaImage, v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
// bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
|
|
11
|
+
const image = v.image(exampleImagePath('dog_512x512.jpg'))
|
|
12
|
+
|
|
13
|
+
export const wan21I2v = host.defineWorkflow({
|
|
14
|
+
id: 'wan21-i2v',
|
|
15
|
+
vars: {
|
|
16
|
+
image,
|
|
17
|
+
// the `- ` line is the template's own wan negative (standard Chinese quality list)
|
|
18
|
+
prompt: v.prompt(
|
|
19
|
+
'a cute anime girl with massive fennec ears and a big fluffy tail wearing a maid outfit turning around\n- 色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走',
|
|
20
|
+
),
|
|
21
|
+
seed: v.seed(42),
|
|
22
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
23
|
+
length: v.int(33, { min: 1, max: 241 }),
|
|
24
|
+
fps: v.int(16, { min: 1, max: 60 }),
|
|
25
|
+
},
|
|
26
|
+
// async build: the start image is uploaded (hash-named, deduped) per run
|
|
27
|
+
build: async (b, vars, wf) => {
|
|
28
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
29
|
+
const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
|
|
30
|
+
|
|
31
|
+
const model = b.ModelSamplingSD3({
|
|
32
|
+
model: b.UNETLoader({ unet_name: 'wan2.1_i2v_480p_14B_fp16.safetensors', weight_dtype: 'default' }),
|
|
33
|
+
shift: 8,
|
|
34
|
+
})
|
|
35
|
+
const clip = b.CLIPLoader({ clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' })
|
|
36
|
+
const vae = b.VAELoader({ vae_name: 'wan_2.1_vae.safetensors' })
|
|
37
|
+
|
|
38
|
+
// 512x512 from the template; the model is 480p class
|
|
39
|
+
const wan = b.WanImageToVideo({
|
|
40
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
41
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
42
|
+
vae,
|
|
43
|
+
width: 512,
|
|
44
|
+
height: 512,
|
|
45
|
+
length: vars.length,
|
|
46
|
+
batch_size: 1,
|
|
47
|
+
clip_vision_output: b.CLIPVisionEncode({
|
|
48
|
+
clip_vision: b.CLIPVisionLoader({ clip_name: 'clip_vision_h.safetensors' }),
|
|
49
|
+
image: loaded,
|
|
50
|
+
crop: 'none',
|
|
51
|
+
}),
|
|
52
|
+
start_image: loaded,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const samples = b.KSampler({
|
|
56
|
+
model,
|
|
57
|
+
positive: wan.outputs.positive,
|
|
58
|
+
negative: wan.outputs.negative,
|
|
59
|
+
latent_image: wan.outputs.latent,
|
|
60
|
+
seed: vars.seed,
|
|
61
|
+
steps: vars.steps,
|
|
62
|
+
cfg: 6,
|
|
63
|
+
sampler_name: 'uni_pc',
|
|
64
|
+
scheduler: 'simple',
|
|
65
|
+
denoise: 1,
|
|
66
|
+
})
|
|
67
|
+
const video = b.CreateVideo({ images: b.VAEDecode({ samples, vae }), fps: vars.fps })
|
|
68
|
+
b.SaveVideo({ video, filename_prefix: 'comfy-ts-zoo/wan21-i2v', format: 'auto', codec: 'auto' })
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
export default wan21I2v
|
|
73
|
+
|
|
74
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
75
|
+
if (import.meta.main) {
|
|
76
|
+
requireCloudKey()
|
|
77
|
+
if (process.argv[2]) wan21I2v.vars.image.set(process.argv[2])
|
|
78
|
+
if (process.argv[3]) wan21I2v.vars.prompt.set(process.argv[3])
|
|
79
|
+
const execution = await wan21I2v.run({ log: true })
|
|
80
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
81
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/wan21-i2v`)
|
|
82
|
+
host.disconnect()
|
|
83
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// wan21 t2v on Comfy Cloud — Wan 2.1 1.3B text to video, 480p, 33 frames at 16 fps
|
|
2
|
+
// source template: text_to_video_wan.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/wan21-t2v.cflow.ts ["prompt"] [seed]
|
|
5
|
+
import { v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
export const wan21T2v = host.defineWorkflow({
|
|
11
|
+
id: 'wan21-t2v',
|
|
12
|
+
vars: {
|
|
13
|
+
// the `- ` line is the template's own wan negative (standard Chinese quality list)
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
'a fox moving quickly in a beautiful winter scenery nature trees mountains daytime tracking camera\n- 色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走',
|
|
16
|
+
),
|
|
17
|
+
seed: v.seed(42),
|
|
18
|
+
steps: v.int(30, { min: 1, max: 60 }),
|
|
19
|
+
cfg: v.float(6, { min: 0, max: 30 }),
|
|
20
|
+
size: v.size({ width: 832, height: 480 }),
|
|
21
|
+
length: v.int(33, { min: 1, max: 241 }),
|
|
22
|
+
fps: v.int(16, { min: 1, max: 60 }),
|
|
23
|
+
},
|
|
24
|
+
build: (b, vars) => {
|
|
25
|
+
const model = b.ModelSamplingSD3({
|
|
26
|
+
model: b.UNETLoader({ unet_name: 'wan2.1_t2v_1.3B_fp16.safetensors', weight_dtype: 'default' }),
|
|
27
|
+
shift: 8,
|
|
28
|
+
})
|
|
29
|
+
const clip = b.CLIPLoader({ clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' })
|
|
30
|
+
const vae = b.VAELoader({ vae_name: 'wan_2.1_vae.safetensors' })
|
|
31
|
+
const samples = b.KSampler({
|
|
32
|
+
model,
|
|
33
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
34
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
35
|
+
latent_image: b.EmptyHunyuanLatentVideo({
|
|
36
|
+
width: vars.size.width,
|
|
37
|
+
height: vars.size.height,
|
|
38
|
+
length: vars.length,
|
|
39
|
+
batch_size: 1,
|
|
40
|
+
}),
|
|
41
|
+
seed: vars.seed,
|
|
42
|
+
steps: vars.steps,
|
|
43
|
+
cfg: vars.cfg,
|
|
44
|
+
sampler_name: 'uni_pc',
|
|
45
|
+
scheduler: 'simple',
|
|
46
|
+
denoise: 1,
|
|
47
|
+
})
|
|
48
|
+
const video = b.CreateVideo({ images: b.VAEDecode({ samples, vae }), fps: vars.fps })
|
|
49
|
+
b.SaveVideo({ video, filename_prefix: 'comfy-ts-zoo/wan21-t2v', format: 'auto', codec: 'auto' })
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export default wan21T2v
|
|
54
|
+
|
|
55
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
56
|
+
if (import.meta.main) {
|
|
57
|
+
requireCloudKey()
|
|
58
|
+
if (process.argv[2]) wan21T2v.vars.prompt.set(process.argv[2])
|
|
59
|
+
if (process.argv[3]) wan21T2v.vars.seed.set(Number(process.argv[3]))
|
|
60
|
+
const execution = await wan21T2v.run({ log: true })
|
|
61
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
62
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/wan21-t2v`)
|
|
63
|
+
host.disconnect()
|
|
64
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// wan22-5b t2v on Comfy Cloud — Wan 2.2 5B ti2v, one compact model, 5s @ 24fps 1280x704
|
|
2
|
+
// source template: video_wan2_2_5B_ti2v.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/wan22-5b-t2v.cflow.ts ["prompt"] [seed]
|
|
5
|
+
import { v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
export const wan225bT2v = host.defineWorkflow({
|
|
11
|
+
id: 'wan22-5b-t2v',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
'Low contrast. In a retro 1970s-style subway station, a street musician plays in dim colors and rough textures. He wears an old jacket, playing guitar with focus. Commuters hurry by, and a small crowd gathers to listen. The camera slowly moves right, capturing the blend of music and city noise, with old subway signs and mottled walls in the background.\n- 色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走',
|
|
16
|
+
),
|
|
17
|
+
seed: v.seed(42),
|
|
18
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
19
|
+
cfg: v.float(5, { min: 0, max: 30 }),
|
|
20
|
+
size: v.size({ width: 1280, height: 704 }),
|
|
21
|
+
length: v.int(121, { min: 1, max: 321 }),
|
|
22
|
+
fps: v.int(24, { min: 1, max: 60 }),
|
|
23
|
+
},
|
|
24
|
+
build: (b, vars) => {
|
|
25
|
+
const clip = b.CLIPLoader({ clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' })
|
|
26
|
+
const vae = b.VAELoader({ vae_name: 'wan2.2_vae.safetensors' })
|
|
27
|
+
const model = b.ModelSamplingSD3({
|
|
28
|
+
model: b.UNETLoader({ unet_name: 'wan2.2_ti2v_5B_fp16.safetensors', weight_dtype: 'default' }),
|
|
29
|
+
shift: 8,
|
|
30
|
+
})
|
|
31
|
+
// ti2v latent: wire a start_image here and the same graph does image to video
|
|
32
|
+
const latent = b.Wan22ImageToVideoLatent({
|
|
33
|
+
vae,
|
|
34
|
+
width: vars.size.width,
|
|
35
|
+
height: vars.size.height,
|
|
36
|
+
length: vars.length,
|
|
37
|
+
batch_size: 1,
|
|
38
|
+
})
|
|
39
|
+
const samples = b.KSampler({
|
|
40
|
+
model,
|
|
41
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
42
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
43
|
+
latent_image: latent,
|
|
44
|
+
seed: vars.seed,
|
|
45
|
+
steps: vars.steps,
|
|
46
|
+
cfg: vars.cfg,
|
|
47
|
+
sampler_name: 'uni_pc',
|
|
48
|
+
scheduler: 'simple',
|
|
49
|
+
denoise: 1,
|
|
50
|
+
})
|
|
51
|
+
b.SaveVideo({
|
|
52
|
+
video: b.CreateVideo({ images: b.VAEDecode({ samples, vae }), fps: vars.fps }),
|
|
53
|
+
filename_prefix: 'comfy-ts-zoo/wan22-5b-t2v',
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export default wan225bT2v
|
|
59
|
+
|
|
60
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
61
|
+
if (import.meta.main) {
|
|
62
|
+
requireCloudKey()
|
|
63
|
+
if (process.argv[2]) wan225bT2v.vars.prompt.set(process.argv[2])
|
|
64
|
+
if (process.argv[3]) wan225bT2v.vars.seed.set(Number(process.argv[3]))
|
|
65
|
+
const execution = await wan225bT2v.run({ log: true })
|
|
66
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
67
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/wan22-5b-t2v`)
|
|
68
|
+
host.disconnect()
|
|
69
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// wan22 i2v on Comfy Cloud — Wan 2.2 14B image to video, two experts: high noise then low noise, 5s @ 16fps
|
|
2
|
+
// source template: video_wan2_2_14B_i2v.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/wan22-i2v.cflow.ts [path/to/image.png] ["prompt"]
|
|
5
|
+
import { asAbsolutePath, exampleImagePath, MediaImage, v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
// bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
|
|
11
|
+
const image = v.image(exampleImagePath('lioness_768x768.jpg'))
|
|
12
|
+
|
|
13
|
+
export const wan22I2v = host.defineWorkflow({
|
|
14
|
+
id: 'wan22-i2v',
|
|
15
|
+
vars: {
|
|
16
|
+
image,
|
|
17
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
18
|
+
prompt: v.prompt(
|
|
19
|
+
'The white dragon warrior stands still, eyes full of determination and strength. The camera slowly moves closer or circles around the warrior, highlighting the powerful presence and heroic spirit of the character.\n- 色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走',
|
|
20
|
+
),
|
|
21
|
+
seed: v.seed(42),
|
|
22
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
23
|
+
length: v.int(81, { min: 1, max: 321 }),
|
|
24
|
+
fps: v.int(16, { min: 1, max: 60 }),
|
|
25
|
+
},
|
|
26
|
+
// async build: the start image is uploaded (hash-named, deduped) per run
|
|
27
|
+
build: async (b, vars, wf) => {
|
|
28
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
29
|
+
const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
|
|
30
|
+
|
|
31
|
+
const clip = b.CLIPLoader({ clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' })
|
|
32
|
+
const vae = b.VAELoader({ vae_name: 'wan_2.1_vae.safetensors' })
|
|
33
|
+
// wan2.2 14B is a mixture of two experts: the high-noise model denoises the
|
|
34
|
+
// template's switchable lightx2v 4-step fast lora branch ships off, dropped here
|
|
35
|
+
// first half of the steps, the low-noise model finishes (shift 5 on both)
|
|
36
|
+
const highModel = b.ModelSamplingSD3({
|
|
37
|
+
model: b.UNETLoader({
|
|
38
|
+
unet_name: 'wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors',
|
|
39
|
+
weight_dtype: 'default',
|
|
40
|
+
}),
|
|
41
|
+
shift: 5,
|
|
42
|
+
})
|
|
43
|
+
const lowModel = b.ModelSamplingSD3({
|
|
44
|
+
model: b.UNETLoader({ unet_name: 'wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors', weight_dtype: 'default' }),
|
|
45
|
+
shift: 5,
|
|
46
|
+
})
|
|
47
|
+
// conditioning + start-image latent come pre-packaged from the same node
|
|
48
|
+
const video = b.WanImageToVideo({
|
|
49
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
50
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
51
|
+
vae,
|
|
52
|
+
width: 640,
|
|
53
|
+
height: 640,
|
|
54
|
+
length: vars.length,
|
|
55
|
+
batch_size: 1,
|
|
56
|
+
start_image: loaded,
|
|
57
|
+
})
|
|
58
|
+
const mid = Math.floor(vars.steps / 2)
|
|
59
|
+
const stage1 = b.KSamplerAdvanced({
|
|
60
|
+
model: highModel,
|
|
61
|
+
positive: video.outputs.positive,
|
|
62
|
+
negative: video.outputs.negative,
|
|
63
|
+
latent_image: video.outputs.latent,
|
|
64
|
+
add_noise: 'enable',
|
|
65
|
+
noise_seed: vars.seed,
|
|
66
|
+
steps: vars.steps,
|
|
67
|
+
cfg: 3.5,
|
|
68
|
+
sampler_name: 'euler',
|
|
69
|
+
scheduler: 'simple',
|
|
70
|
+
start_at_step: 0,
|
|
71
|
+
end_at_step: mid,
|
|
72
|
+
return_with_leftover_noise: 'enable',
|
|
73
|
+
})
|
|
74
|
+
const samples = b.KSamplerAdvanced({
|
|
75
|
+
model: lowModel,
|
|
76
|
+
positive: video.outputs.positive,
|
|
77
|
+
negative: video.outputs.negative,
|
|
78
|
+
latent_image: stage1,
|
|
79
|
+
add_noise: 'disable',
|
|
80
|
+
noise_seed: 0,
|
|
81
|
+
steps: vars.steps,
|
|
82
|
+
cfg: 3.5,
|
|
83
|
+
sampler_name: 'euler',
|
|
84
|
+
scheduler: 'simple',
|
|
85
|
+
start_at_step: mid,
|
|
86
|
+
end_at_step: vars.steps,
|
|
87
|
+
return_with_leftover_noise: 'disable',
|
|
88
|
+
})
|
|
89
|
+
b.SaveVideo({
|
|
90
|
+
video: b.CreateVideo({ images: b.VAEDecode({ samples, vae }), fps: vars.fps }),
|
|
91
|
+
filename_prefix: 'comfy-ts-zoo/wan22-i2v',
|
|
92
|
+
})
|
|
93
|
+
},
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
export default wan22I2v
|
|
97
|
+
|
|
98
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
99
|
+
if (import.meta.main) {
|
|
100
|
+
requireCloudKey()
|
|
101
|
+
if (process.argv[2]) wan22I2v.vars.image.set(process.argv[2])
|
|
102
|
+
if (process.argv[3]) wan22I2v.vars.prompt.set(process.argv[3])
|
|
103
|
+
const execution = await wan22I2v.run({ log: true })
|
|
104
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
105
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/wan22-i2v`)
|
|
106
|
+
host.disconnect()
|
|
107
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// wan22 t2v on Comfy Cloud — Wan 2.2 14B text to video, two experts: high noise then low noise, 5s @ 16fps
|
|
2
|
+
// source template: video_wan2_2_14B_t2v.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/wan22-t2v.cflow.ts ["prompt"] [seed]
|
|
5
|
+
import { v } from 'comfy-ts'
|
|
6
|
+
import { cloudHost, requireCloudKey } from './cloudHost.ts'
|
|
7
|
+
|
|
8
|
+
const host = await cloudHost()
|
|
9
|
+
|
|
10
|
+
export const wan22T2v = host.defineWorkflow({
|
|
11
|
+
id: 'wan22-t2v',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
'Beautiful young European woman with honey blonde hair gracefully turning her head back over shoulder, gentle smile, bright eyes looking at camera. Hair flowing in slow motion as she turns. Soft natural lighting, clean background, cinematic slow-motion portrait.\n- 色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走',
|
|
16
|
+
),
|
|
17
|
+
seed: v.seed(42),
|
|
18
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
19
|
+
cfg: v.float(3.5, { min: 0, max: 30 }),
|
|
20
|
+
size: v.size({ width: 640, height: 640 }),
|
|
21
|
+
length: v.int(81, { min: 1, max: 321 }),
|
|
22
|
+
fps: v.int(16, { min: 1, max: 60 }),
|
|
23
|
+
},
|
|
24
|
+
build: (b, vars) => {
|
|
25
|
+
const clip = b.CLIPLoader({ clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' })
|
|
26
|
+
const vae = b.VAELoader({ vae_name: 'wan_2.1_vae.safetensors' })
|
|
27
|
+
// wan2.2 14B is a mixture of two experts: the high-noise model denoises the
|
|
28
|
+
// template's switchable lightx2v 4-step fast lora branch ships off, dropped here
|
|
29
|
+
// first half of the steps, the low-noise model finishes (shift 5 on both)
|
|
30
|
+
const highModel = b.ModelSamplingSD3({
|
|
31
|
+
model: b.UNETLoader({
|
|
32
|
+
unet_name: 'wan2.2_t2v_high_noise_14B_fp8_scaled.safetensors',
|
|
33
|
+
weight_dtype: 'default',
|
|
34
|
+
}),
|
|
35
|
+
shift: 5,
|
|
36
|
+
})
|
|
37
|
+
const lowModel = b.ModelSamplingSD3({
|
|
38
|
+
model: b.UNETLoader({ unet_name: 'wan2.2_t2v_low_noise_14B_fp8_scaled.safetensors', weight_dtype: 'default' }),
|
|
39
|
+
shift: 5,
|
|
40
|
+
})
|
|
41
|
+
const positive = b.CLIPTextEncode({ clip, text: vars.prompt.positive })
|
|
42
|
+
const negative = b.CLIPTextEncode({ clip, text: vars.prompt.negative })
|
|
43
|
+
const latent = b.EmptyHunyuanLatentVideo({
|
|
44
|
+
width: vars.size.width,
|
|
45
|
+
height: vars.size.height,
|
|
46
|
+
length: vars.length,
|
|
47
|
+
batch_size: 1,
|
|
48
|
+
})
|
|
49
|
+
const mid = Math.floor(vars.steps / 2)
|
|
50
|
+
const stage1 = b.KSamplerAdvanced({
|
|
51
|
+
model: highModel,
|
|
52
|
+
positive,
|
|
53
|
+
negative,
|
|
54
|
+
latent_image: latent,
|
|
55
|
+
add_noise: 'enable',
|
|
56
|
+
noise_seed: vars.seed,
|
|
57
|
+
steps: vars.steps,
|
|
58
|
+
cfg: vars.cfg,
|
|
59
|
+
sampler_name: 'euler',
|
|
60
|
+
scheduler: 'simple',
|
|
61
|
+
start_at_step: 0,
|
|
62
|
+
end_at_step: mid,
|
|
63
|
+
return_with_leftover_noise: 'enable',
|
|
64
|
+
})
|
|
65
|
+
const samples = b.KSamplerAdvanced({
|
|
66
|
+
model: lowModel,
|
|
67
|
+
positive,
|
|
68
|
+
negative,
|
|
69
|
+
latent_image: stage1,
|
|
70
|
+
add_noise: 'disable',
|
|
71
|
+
noise_seed: 0,
|
|
72
|
+
steps: vars.steps,
|
|
73
|
+
cfg: vars.cfg,
|
|
74
|
+
sampler_name: 'euler',
|
|
75
|
+
scheduler: 'simple',
|
|
76
|
+
start_at_step: mid,
|
|
77
|
+
end_at_step: vars.steps,
|
|
78
|
+
return_with_leftover_noise: 'disable',
|
|
79
|
+
})
|
|
80
|
+
b.SaveVideo({
|
|
81
|
+
video: b.CreateVideo({ images: b.VAEDecode({ samples, vae }), fps: vars.fps }),
|
|
82
|
+
filename_prefix: 'comfy-ts-zoo/wan22-t2v',
|
|
83
|
+
})
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export default wan22T2v
|
|
88
|
+
|
|
89
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
90
|
+
if (import.meta.main) {
|
|
91
|
+
requireCloudKey()
|
|
92
|
+
if (process.argv[2]) wan22T2v.vars.prompt.set(process.argv[2])
|
|
93
|
+
if (process.argv[3]) wan22T2v.vars.seed.set(Number(process.argv[3]))
|
|
94
|
+
const execution = await wan22T2v.run({ log: true })
|
|
95
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
96
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/wan22-t2v`)
|
|
97
|
+
host.disconnect()
|
|
98
|
+
}
|