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,92 @@
|
|
|
1
|
+
// ltxv i2v on Comfy Cloud — LTX-Video 2b (v0.9.5) image to video: a start image drives the first frame
|
|
2
|
+
// source template: ltxv_image_to_video.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/ltxv-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('walrus_1344x768.jpg'))
|
|
12
|
+
|
|
13
|
+
export const ltxvI2v = host.defineWorkflow({
|
|
14
|
+
id: 'ltxv-i2v',
|
|
15
|
+
vars: {
|
|
16
|
+
image,
|
|
17
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
18
|
+
prompt: v.prompt(
|
|
19
|
+
'A red fox moving gracefully, its russet coat vibrant against the white landscape, leaving perfect star-shaped prints behind as steam rises from its breath in the crisp winter air. The scene is wrapped in snow-muffled silence, broken only by the gentle murmur of water still flowing beneath the ice.\n- low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly',
|
|
20
|
+
),
|
|
21
|
+
seed: v.seed(42),
|
|
22
|
+
steps: v.int(30, { min: 1, max: 100 }),
|
|
23
|
+
cfg: v.float(3, { min: 0, max: 30 }),
|
|
24
|
+
length: v.int(97, { min: 9, max: 257 }),
|
|
25
|
+
fps: v.int(24, { min: 1, max: 60 }),
|
|
26
|
+
},
|
|
27
|
+
// async build: the input image is uploaded (hash-named, deduped) per run
|
|
28
|
+
build: async (b, vars, wf) => {
|
|
29
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
30
|
+
const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
|
|
31
|
+
|
|
32
|
+
const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'ltx-video-2b-v0.9.5.safetensors' })
|
|
33
|
+
const clip = b.CLIPLoader({ clip_name: 't5xxl_fp16.safetensors', type: 'ltxv', device: 'default' })
|
|
34
|
+
// the start image is encoded into the video latent's first frame; strength 0.15
|
|
35
|
+
// is the template's conditioning noise level, conditioning rides along
|
|
36
|
+
const video = b.LTXVImgToVideo({
|
|
37
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
38
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
39
|
+
vae: ckpt,
|
|
40
|
+
image: loaded,
|
|
41
|
+
width: 768,
|
|
42
|
+
height: 512,
|
|
43
|
+
length: vars.length,
|
|
44
|
+
batch_size: 1,
|
|
45
|
+
strength: 0.15,
|
|
46
|
+
})
|
|
47
|
+
// ltxv also conditions on the frame rate the model was trained against (template value)
|
|
48
|
+
const cond = b.LTXVConditioning({
|
|
49
|
+
positive: video.outputs.positive,
|
|
50
|
+
negative: video.outputs.negative,
|
|
51
|
+
frame_rate: 25,
|
|
52
|
+
})
|
|
53
|
+
const samples = b.SamplerCustom({
|
|
54
|
+
model: ckpt,
|
|
55
|
+
positive: cond.outputs.positive,
|
|
56
|
+
negative: cond.outputs.negative,
|
|
57
|
+
sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
|
|
58
|
+
// ltxv wants its dedicated sigma schedule, stretched from the latent's token count
|
|
59
|
+
sigmas: b.LTXVScheduler({
|
|
60
|
+
steps: vars.steps,
|
|
61
|
+
max_shift: 2.05,
|
|
62
|
+
base_shift: 0.95,
|
|
63
|
+
stretch: true,
|
|
64
|
+
terminal: 0.1,
|
|
65
|
+
latent: video.outputs.latent,
|
|
66
|
+
}),
|
|
67
|
+
latent_image: video.outputs.latent,
|
|
68
|
+
add_noise: true,
|
|
69
|
+
noise_seed: vars.seed,
|
|
70
|
+
cfg: vars.cfg,
|
|
71
|
+
})
|
|
72
|
+
b.SaveVideo({
|
|
73
|
+
video: b.CreateVideo({ images: b.VAEDecode({ samples: samples.outputs.output, vae: ckpt }), fps: vars.fps }),
|
|
74
|
+
filename_prefix: 'comfy-ts-zoo/ltxv-i2v',
|
|
75
|
+
format: 'auto',
|
|
76
|
+
codec: 'auto',
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
export default ltxvI2v
|
|
82
|
+
|
|
83
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
84
|
+
if (import.meta.main) {
|
|
85
|
+
requireCloudKey()
|
|
86
|
+
if (process.argv[2]) ltxvI2v.vars.image.set(process.argv[2])
|
|
87
|
+
if (process.argv[3]) ltxvI2v.vars.prompt.set(process.argv[3])
|
|
88
|
+
const execution = await ltxvI2v.run({ log: true })
|
|
89
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
90
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/ltxv-i2v`)
|
|
91
|
+
host.disconnect()
|
|
92
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// ltxv t2v on Comfy Cloud — LTX-Video 2b (v0.9) text to video, 97 frames @ 24fps ≈ 4s
|
|
2
|
+
// source template: ltxv_text_to_video.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/ltxv-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 ltxvT2v = host.defineWorkflow({
|
|
11
|
+
id: 'ltxv-t2v',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
"A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.\n- low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
|
|
16
|
+
),
|
|
17
|
+
seed: v.seed(42),
|
|
18
|
+
steps: v.int(30, { min: 1, max: 100 }),
|
|
19
|
+
cfg: v.float(3, { min: 0, max: 30 }),
|
|
20
|
+
size: v.size({ width: 768, height: 512 }),
|
|
21
|
+
length: v.int(97, { min: 9, max: 257 }),
|
|
22
|
+
fps: v.int(24, { min: 1, max: 60 }),
|
|
23
|
+
},
|
|
24
|
+
build: (b, vars) => {
|
|
25
|
+
const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'ltx-video-2b-v0.9.safetensors' })
|
|
26
|
+
const clip = b.CLIPLoader({ clip_name: 't5xxl_fp16.safetensors', type: 'ltxv', device: 'default' })
|
|
27
|
+
// ltxv also conditions on the frame rate the model was trained against (template value)
|
|
28
|
+
const cond = b.LTXVConditioning({
|
|
29
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
30
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
31
|
+
frame_rate: 25,
|
|
32
|
+
})
|
|
33
|
+
const latent = b.EmptyLTXVLatentVideo({
|
|
34
|
+
width: vars.size.width,
|
|
35
|
+
height: vars.size.height,
|
|
36
|
+
length: vars.length,
|
|
37
|
+
batch_size: 1,
|
|
38
|
+
})
|
|
39
|
+
const samples = b.SamplerCustom({
|
|
40
|
+
model: ckpt,
|
|
41
|
+
positive: cond.outputs.positive,
|
|
42
|
+
negative: cond.outputs.negative,
|
|
43
|
+
sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
|
|
44
|
+
// ltxv wants its dedicated sigma schedule, stretched from the latent's token count
|
|
45
|
+
sigmas: b.LTXVScheduler({
|
|
46
|
+
steps: vars.steps,
|
|
47
|
+
max_shift: 2.05,
|
|
48
|
+
base_shift: 0.95,
|
|
49
|
+
stretch: true,
|
|
50
|
+
terminal: 0.1,
|
|
51
|
+
latent,
|
|
52
|
+
}),
|
|
53
|
+
latent_image: latent,
|
|
54
|
+
add_noise: true,
|
|
55
|
+
noise_seed: vars.seed,
|
|
56
|
+
cfg: vars.cfg,
|
|
57
|
+
})
|
|
58
|
+
b.SaveVideo({
|
|
59
|
+
video: b.CreateVideo({ images: b.VAEDecode({ samples: samples.outputs.output, vae: ckpt }), fps: vars.fps }),
|
|
60
|
+
filename_prefix: 'comfy-ts-zoo/ltxv-t2v',
|
|
61
|
+
format: 'auto',
|
|
62
|
+
codec: 'auto',
|
|
63
|
+
})
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
export default ltxvT2v
|
|
68
|
+
|
|
69
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
70
|
+
if (import.meta.main) {
|
|
71
|
+
requireCloudKey()
|
|
72
|
+
if (process.argv[2]) ltxvT2v.vars.prompt.set(process.argv[2])
|
|
73
|
+
if (process.argv[3]) ltxvT2v.vars.seed.set(Number(process.argv[3]))
|
|
74
|
+
const execution = await ltxvT2v.run({ log: true })
|
|
75
|
+
// SaveVideo outputs land host side (no auto-download for video yet)
|
|
76
|
+
console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/ltxv-t2v`)
|
|
77
|
+
host.disconnect()
|
|
78
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// newbie t2i on Comfy Cloud — NewBie-Image Exp0.1 anime model (AuraFlow-style UNET, gemma3+jina dual CLIP)
|
|
2
|
+
// source template: image_newbieimage_exp0_1-t2i.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/newbie-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
|
+
// NewBie is instruction-tuned: both branches open with a fixed system prompt (from the template)
|
|
11
|
+
const POSITIVE_SYSTEM =
|
|
12
|
+
'You are an assistant designed to generate high-quality anime images with the highest degree of image-text alignment based on xml format textual prompts. <Prompt Start>\n'
|
|
13
|
+
const NEGATIVE_SYSTEM =
|
|
14
|
+
'You are an assistant designed to generate low-quality images based on textual prompts. <Prompt Start>\n'
|
|
15
|
+
|
|
16
|
+
export const newbieT2i = host.defineWorkflow({
|
|
17
|
+
id: 'newbie-t2i',
|
|
18
|
+
vars: {
|
|
19
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
20
|
+
prompt: v.prompt(
|
|
21
|
+
'masterpiece, best quality, newest, absurdres, 1girl, blue hair, long hair, ahoge, blue eyes, black witch hat, white and blue dress, pointing at viewer, swirling cerulean water vortex, glowing crystal petals, dramatic lighting, dutch angle, anime style illustration',
|
|
22
|
+
),
|
|
23
|
+
seed: v.seed(42),
|
|
24
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
25
|
+
cfg: v.float(5.5, { min: 0, max: 30 }),
|
|
26
|
+
size: v.size({ width: 1024, height: 1536 }),
|
|
27
|
+
},
|
|
28
|
+
build: (b, vars) => {
|
|
29
|
+
const clip = b.DualCLIPLoader({
|
|
30
|
+
clip_name1: 'gemma_3_4b_it_bf16.safetensors',
|
|
31
|
+
clip_name2: 'jina_clip_v2_bf16.safetensors',
|
|
32
|
+
type: 'newbie',
|
|
33
|
+
device: 'default',
|
|
34
|
+
})
|
|
35
|
+
const samples = b.KSampler({
|
|
36
|
+
model: b.ModelSamplingAuraFlow({
|
|
37
|
+
model: b.UNETLoader({ unet_name: 'NewBie-Image-Exp0.1-bf16.safetensors', weight_dtype: 'default' }),
|
|
38
|
+
shift: 6,
|
|
39
|
+
}),
|
|
40
|
+
positive: b.CLIPTextEncode({ clip, text: POSITIVE_SYSTEM + vars.prompt.positive }),
|
|
41
|
+
negative: b.CLIPTextEncode({ clip, text: NEGATIVE_SYSTEM + vars.prompt.negative }),
|
|
42
|
+
latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
43
|
+
seed: vars.seed,
|
|
44
|
+
steps: vars.steps,
|
|
45
|
+
cfg: vars.cfg,
|
|
46
|
+
sampler_name: 'res_multistep',
|
|
47
|
+
scheduler: 'simple',
|
|
48
|
+
denoise: 1,
|
|
49
|
+
})
|
|
50
|
+
b.SaveImage({
|
|
51
|
+
images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'ae.safetensors' }) }),
|
|
52
|
+
filename_prefix: 'comfy-ts-zoo/newbie-t2i',
|
|
53
|
+
})
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export default newbieT2i
|
|
58
|
+
|
|
59
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
60
|
+
if (import.meta.main) {
|
|
61
|
+
requireCloudKey()
|
|
62
|
+
if (process.argv[2]) newbieT2i.vars.prompt.set(process.argv[2])
|
|
63
|
+
if (process.argv[3]) newbieT2i.vars.seed.set(Number(process.argv[3]))
|
|
64
|
+
const execution = await newbieT2i.run({ log: true })
|
|
65
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
66
|
+
host.disconnect()
|
|
67
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// omnigen2 i2i on Comfy Cloud — OmniGen2 fp16 image edit, reference-latent dual CFG
|
|
2
|
+
// source template: image_omnigen2_image_edit.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/omnigen2-i2i.cflow.ts [path/to/image.png] ["edit prompt"] [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('bear_1024x1024.jpg'))
|
|
12
|
+
|
|
13
|
+
export const omnigen2I2i = host.defineWorkflow({
|
|
14
|
+
id: 'omnigen2-i2i',
|
|
15
|
+
vars: {
|
|
16
|
+
image,
|
|
17
|
+
prompt: v.prompt(
|
|
18
|
+
'Transform character into crystal material, transparent crystal texture, sparkling surface, prismatic light effects, magical appearance, elegant translucent look\n- deformed, blurry, over saturation, bad anatomy, disfigured, poorly drawn face, mutation, extra limb, ugly, poorly drawn hands, fused fingers',
|
|
19
|
+
),
|
|
20
|
+
seed: v.seed(42),
|
|
21
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
22
|
+
cfg: v.float(5, { min: 0, max: 30 }),
|
|
23
|
+
},
|
|
24
|
+
// async build: the input image is uploaded (hash-named, deduped) per run
|
|
25
|
+
build: async (b, vars, wf) => {
|
|
26
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
27
|
+
const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
|
|
28
|
+
|
|
29
|
+
const model = b.UNETLoader({ unet_name: 'omnigen2_fp16.safetensors', weight_dtype: 'default' })
|
|
30
|
+
const clip = b.CLIPLoader({ clip_name: 'qwen_2.5_vl_fp16.safetensors', type: 'omnigen2', device: 'default' })
|
|
31
|
+
const vae = b.VAELoader({ vae_name: 'ae.safetensors' })
|
|
32
|
+
|
|
33
|
+
// reference image → ~1MP; its size drives the output latent
|
|
34
|
+
const scaled = b.ImageScaleToTotalPixels({
|
|
35
|
+
image: loaded,
|
|
36
|
+
upscale_method: 'area',
|
|
37
|
+
megapixels: 1,
|
|
38
|
+
resolution_steps: 1,
|
|
39
|
+
})
|
|
40
|
+
const size = b.GetImageSize({ image: scaled })
|
|
41
|
+
const reference = b.VAEEncode({ pixels: scaled, vae })
|
|
42
|
+
|
|
43
|
+
// dual CFG: cond1/cond2 see the reference latent, the plain negative does not (template wiring)
|
|
44
|
+
const negative = b.CLIPTextEncode({ clip, text: vars.prompt.negative })
|
|
45
|
+
const samples = b.SamplerCustomAdvanced({
|
|
46
|
+
noise: b.RandomNoise({ noise_seed: vars.seed }),
|
|
47
|
+
guider: b.DualCFGGuider({
|
|
48
|
+
model,
|
|
49
|
+
cond1: b.ReferenceLatent({
|
|
50
|
+
conditioning: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
51
|
+
latent: reference,
|
|
52
|
+
}),
|
|
53
|
+
cond2: b.ReferenceLatent({ conditioning: negative, latent: reference }),
|
|
54
|
+
negative,
|
|
55
|
+
cfg_conds: vars.cfg,
|
|
56
|
+
cfg_cond2_negative: 2,
|
|
57
|
+
style: 'regular',
|
|
58
|
+
}),
|
|
59
|
+
sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
|
|
60
|
+
sigmas: b.BasicScheduler({ model, scheduler: 'simple', steps: vars.steps, denoise: 1 }),
|
|
61
|
+
latent_image: b.EmptySD3LatentImage({
|
|
62
|
+
width: size.outputs.width,
|
|
63
|
+
height: size.outputs.height,
|
|
64
|
+
batch_size: 1,
|
|
65
|
+
}),
|
|
66
|
+
})
|
|
67
|
+
b.SaveImage({
|
|
68
|
+
images: b.VAEDecode({ samples: samples.outputs.output, vae }),
|
|
69
|
+
filename_prefix: 'comfy-ts-zoo/omnigen2-i2i',
|
|
70
|
+
})
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
export default omnigen2I2i
|
|
75
|
+
|
|
76
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
77
|
+
if (import.meta.main) {
|
|
78
|
+
requireCloudKey()
|
|
79
|
+
if (process.argv[2]) omnigen2I2i.vars.image.set(process.argv[2])
|
|
80
|
+
if (process.argv[3]) omnigen2I2i.vars.prompt.set(process.argv[3])
|
|
81
|
+
if (process.argv[4]) omnigen2I2i.vars.seed.set(Number(process.argv[4]))
|
|
82
|
+
|
|
83
|
+
const execution = await omnigen2I2i.run({ log: true })
|
|
84
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
85
|
+
host.disconnect()
|
|
86
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// omnigen2 t2i on Comfy Cloud — OmniGen2 fp16, dual-CFG text to image
|
|
2
|
+
// source template: image_omnigen2_t2i.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/omnigen2-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 omnigen2T2i = host.defineWorkflow({
|
|
11
|
+
id: 'omnigen2-t2i',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
'A cat with a crown lounging on a velvet throne, royal atmosphere, luxurious fabric texture, regal pose, detailed fur, ornate crown, dramatic lighting\n- blurry, low quality, distorted, ugly, bad anatomy, deformed, poorly drawn',
|
|
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: 1024, height: 1024 }),
|
|
21
|
+
},
|
|
22
|
+
build: (b, vars) => {
|
|
23
|
+
const model = b.UNETLoader({ unet_name: 'omnigen2_fp16.safetensors', weight_dtype: 'default' })
|
|
24
|
+
const clip = b.CLIPLoader({ clip_name: 'qwen_2.5_vl_fp16.safetensors', type: 'omnigen2', device: 'default' })
|
|
25
|
+
const vae = b.VAELoader({ vae_name: 'ae.safetensors' })
|
|
26
|
+
|
|
27
|
+
// OmniGen2 samples through a dual-CFG guider; without a reference image cond2 doubles the negative
|
|
28
|
+
const negative = b.CLIPTextEncode({ clip, text: vars.prompt.negative })
|
|
29
|
+
const samples = b.SamplerCustomAdvanced({
|
|
30
|
+
noise: b.RandomNoise({ noise_seed: vars.seed }),
|
|
31
|
+
guider: b.DualCFGGuider({
|
|
32
|
+
model,
|
|
33
|
+
cond1: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
34
|
+
cond2: negative,
|
|
35
|
+
negative,
|
|
36
|
+
cfg_conds: vars.cfg,
|
|
37
|
+
cfg_cond2_negative: 2,
|
|
38
|
+
style: 'regular',
|
|
39
|
+
}),
|
|
40
|
+
sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
|
|
41
|
+
sigmas: b.BasicScheduler({ model, scheduler: 'simple', steps: vars.steps, denoise: 1 }),
|
|
42
|
+
latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
43
|
+
})
|
|
44
|
+
b.SaveImage({
|
|
45
|
+
images: b.VAEDecode({ samples: samples.outputs.output, vae }),
|
|
46
|
+
filename_prefix: 'comfy-ts-zoo/omnigen2-t2i',
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
export default omnigen2T2i
|
|
52
|
+
|
|
53
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
54
|
+
if (import.meta.main) {
|
|
55
|
+
requireCloudKey()
|
|
56
|
+
if (process.argv[2]) omnigen2T2i.vars.prompt.set(process.argv[2])
|
|
57
|
+
if (process.argv[3]) omnigen2T2i.vars.seed.set(Number(process.argv[3]))
|
|
58
|
+
|
|
59
|
+
const execution = await omnigen2T2i.run({ log: true })
|
|
60
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
61
|
+
host.disconnect()
|
|
62
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// ovis t2i on Comfy Cloud — Ovis 2.5 image (AuraFlow-style UNET, shift 3), text to image
|
|
2
|
+
// source template: image_ovis_text_to_image.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/ovis-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 ovisT2i = host.defineWorkflow({
|
|
11
|
+
id: 'ovis-t2i',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
'Child lying on bed with balloons, streamers, and plush toys, surreal dreamlike scene. Close-up, centered on the child and surrounding objects. Soft, diffused lighting.',
|
|
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: 1024, height: 1024 }),
|
|
21
|
+
},
|
|
22
|
+
build: (b, vars) => {
|
|
23
|
+
const clip = b.CLIPLoader({ clip_name: 'ovis_2.5.safetensors', type: 'ovis', device: 'default' })
|
|
24
|
+
const samples = b.KSampler({
|
|
25
|
+
model: b.ModelSamplingAuraFlow({
|
|
26
|
+
model: b.UNETLoader({ unet_name: 'ovis_image_bf16.safetensors', weight_dtype: 'default' }),
|
|
27
|
+
shift: 3,
|
|
28
|
+
}),
|
|
29
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
30
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
31
|
+
latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
32
|
+
seed: vars.seed,
|
|
33
|
+
steps: vars.steps,
|
|
34
|
+
cfg: vars.cfg,
|
|
35
|
+
sampler_name: 'euler',
|
|
36
|
+
scheduler: 'simple',
|
|
37
|
+
denoise: 1,
|
|
38
|
+
})
|
|
39
|
+
b.SaveImage({
|
|
40
|
+
images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'ae.safetensors' }) }),
|
|
41
|
+
filename_prefix: 'comfy-ts-zoo/ovis-t2i',
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
export default ovisT2i
|
|
47
|
+
|
|
48
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
49
|
+
if (import.meta.main) {
|
|
50
|
+
requireCloudKey()
|
|
51
|
+
if (process.argv[2]) ovisT2i.vars.prompt.set(process.argv[2])
|
|
52
|
+
if (process.argv[3]) ovisT2i.vars.seed.set(Number(process.argv[3]))
|
|
53
|
+
const execution = await ovisT2i.run({ log: true })
|
|
54
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
55
|
+
host.disconnect()
|
|
56
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// pixeldit t2i on Comfy Cloud — PixelDiT 1.3B, pixel-space diffusion (gemma 2 2B text encoder, no latent compression)
|
|
2
|
+
// source template: image_pixeldit_t2i.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/pixeldit-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 pixelditT2i = host.defineWorkflow({
|
|
11
|
+
id: 'pixeldit-t2i',
|
|
12
|
+
vars: {
|
|
13
|
+
// ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
|
|
14
|
+
prompt: v.prompt(
|
|
15
|
+
'A surreal architectural scene featuring a woman in a flowing white dress walking away from the viewer through a narrow canyon of smooth, organic beige rock formations, bright sunlight streaming from above, sharp shadows, clear deep blue sky, photorealistic, cinematic lighting\n- low quality, worst quality, over-saturated, blurry, deformed, watermark',
|
|
16
|
+
),
|
|
17
|
+
seed: v.seed(42),
|
|
18
|
+
steps: v.int(30, { min: 1, max: 60 }),
|
|
19
|
+
cfg: v.float(4, { min: 0, max: 30 }),
|
|
20
|
+
// the template's ResolutionSelector default: 1 megapixel, 1:1, snapped to a multiple of 8
|
|
21
|
+
size: v.size({ width: 1024, height: 1024 }),
|
|
22
|
+
},
|
|
23
|
+
build: (b, vars) => {
|
|
24
|
+
const clip = b.CLIPLoader({
|
|
25
|
+
clip_name: 'gemma_2_2b_it_elm_bf16.safetensors',
|
|
26
|
+
type: 'pixeldit',
|
|
27
|
+
device: 'default',
|
|
28
|
+
})
|
|
29
|
+
const samples = b.KSampler({
|
|
30
|
+
model: b.UNETLoader({ unet_name: 'pixeldit_1300m_1024px_bf16.safetensors', weight_dtype: 'default' }),
|
|
31
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
32
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
33
|
+
// pixel-space model: chroma-radiance latents ARE pixels, decoded by the identity "pixel_space" vae
|
|
34
|
+
latent_image: b.EmptyChromaRadianceLatentImage({
|
|
35
|
+
width: vars.size.width,
|
|
36
|
+
height: vars.size.height,
|
|
37
|
+
batch_size: 1,
|
|
38
|
+
}),
|
|
39
|
+
seed: vars.seed,
|
|
40
|
+
steps: vars.steps,
|
|
41
|
+
cfg: vars.cfg,
|
|
42
|
+
sampler_name: 'er_sde',
|
|
43
|
+
scheduler: 'simple',
|
|
44
|
+
denoise: 1,
|
|
45
|
+
})
|
|
46
|
+
b.SaveImage({
|
|
47
|
+
images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'pixel_space' }) }),
|
|
48
|
+
filename_prefix: 'comfy-ts-zoo/pixeldit-t2i',
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export default pixelditT2i
|
|
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]) pixelditT2i.vars.prompt.set(process.argv[2])
|
|
59
|
+
if (process.argv[3]) pixelditT2i.vars.seed.set(Number(process.argv[3]))
|
|
60
|
+
const execution = await pixelditT2i.run({ log: true })
|
|
61
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
62
|
+
host.disconnect()
|
|
63
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// qwen-image i2i on Comfy Cloud — Qwen-Image-Edit 2511, instruction-driven image editing
|
|
2
|
+
// source template: image_qwen_image_edit_2511.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/qwen-image-i2i.cflow.ts [path/to/image.png] ["edit instruction"]
|
|
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('bear_1024x1024.jpg'))
|
|
12
|
+
|
|
13
|
+
export const qwenImageI2i = host.defineWorkflow({
|
|
14
|
+
id: 'qwen-image-i2i',
|
|
15
|
+
vars: {
|
|
16
|
+
image,
|
|
17
|
+
prompt: v.prompt('turn this into a watercolor painting'),
|
|
18
|
+
seed: v.seed(42),
|
|
19
|
+
// template defaults: 40 steps / cfg 4 (its optional 4-step Lightning lora branch ships off, dropped here)
|
|
20
|
+
steps: v.int(40, { min: 1, max: 60 }),
|
|
21
|
+
cfg: v.float(4, { min: 0, max: 30 }),
|
|
22
|
+
},
|
|
23
|
+
// async build: the input image is uploaded (hash-named, deduped) per run
|
|
24
|
+
build: async (b, vars, wf) => {
|
|
25
|
+
const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
|
|
26
|
+
const scaled = b.FluxKontextImageScale({ image: await img.loadInWorkflow_viaLoadImageNode(wf) })
|
|
27
|
+
const clip = b.CLIPLoader({ clip_name: 'qwen_2.5_vl_7b_fp8_scaled.safetensors', type: 'qwen_image' })
|
|
28
|
+
const vae = b.VAELoader({ vae_name: 'qwen_image_vae.safetensors' })
|
|
29
|
+
// edit conditioning reads the input image itself: both branches reference it at timestep zero
|
|
30
|
+
const encode = (text: string) =>
|
|
31
|
+
b.FluxKontextMultiReferenceLatentMethod({
|
|
32
|
+
reference_latents_method: 'index_timestep_zero',
|
|
33
|
+
conditioning: b.TextEncodeQwenImageEditPlus({ prompt: text, clip, vae, image1: scaled }),
|
|
34
|
+
})
|
|
35
|
+
const model = b.CFGNorm({
|
|
36
|
+
model: b.ModelSamplingAuraFlow({
|
|
37
|
+
model: b.UNETLoader({ unet_name: 'qwen_image_edit_2511_fp8mixed.safetensors', weight_dtype: 'default' }),
|
|
38
|
+
shift: 3.1,
|
|
39
|
+
}),
|
|
40
|
+
strength: 1,
|
|
41
|
+
pre_cfg: false,
|
|
42
|
+
})
|
|
43
|
+
const samples = b.KSampler({
|
|
44
|
+
model,
|
|
45
|
+
positive: encode(vars.prompt.positive),
|
|
46
|
+
negative: encode(vars.prompt.negative),
|
|
47
|
+
latent_image: b.VAEEncode({ pixels: scaled, vae }),
|
|
48
|
+
seed: vars.seed,
|
|
49
|
+
steps: vars.steps,
|
|
50
|
+
cfg: vars.cfg,
|
|
51
|
+
sampler_name: 'euler',
|
|
52
|
+
scheduler: 'simple',
|
|
53
|
+
denoise: 1,
|
|
54
|
+
})
|
|
55
|
+
b.SaveImage({ images: b.VAEDecode({ samples, vae }), filename_prefix: 'comfy-ts-zoo/qwen-image-i2i' })
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export default qwenImageI2i
|
|
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]) qwenImageI2i.vars.image.set(process.argv[2])
|
|
65
|
+
if (process.argv[3]) qwenImageI2i.vars.prompt.set(process.argv[3])
|
|
66
|
+
const execution = await qwenImageI2i.run({ log: true })
|
|
67
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
68
|
+
host.disconnect()
|
|
69
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// qwen-image t2i on Comfy Cloud — Qwen-Image 20B fp8, AuraFlow-shift sampling
|
|
2
|
+
// source template: image_qwen_image.json (official workflow-templates)
|
|
3
|
+
// needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
|
|
4
|
+
// run directly: bun examples/comfy-cloud/qwen-image-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 qwenImageT2i = host.defineWorkflow({
|
|
11
|
+
id: 'qwen-image-t2i',
|
|
12
|
+
vars: {
|
|
13
|
+
prompt: v.prompt(
|
|
14
|
+
'a vibrant neon-lit Hong Kong street in the afternoon, 1980s style, overlapping Chinese and English signs, rain-washed pavement reflections, cinematic',
|
|
15
|
+
),
|
|
16
|
+
seed: v.seed(42),
|
|
17
|
+
// template defaults: 20 steps / cfg 4 (its optional 8-step Lightning lora branch ships off, dropped here)
|
|
18
|
+
steps: v.int(20, { min: 1, max: 60 }),
|
|
19
|
+
cfg: v.float(4, { min: 0, max: 30 }),
|
|
20
|
+
size: v.size({ width: 1328, height: 1328 }),
|
|
21
|
+
},
|
|
22
|
+
build: (b, vars) => {
|
|
23
|
+
const model = b.ModelSamplingAuraFlow({
|
|
24
|
+
model: b.UNETLoader({ unet_name: 'qwen_image_fp8_e4m3fn.safetensors', weight_dtype: 'default' }),
|
|
25
|
+
shift: 3.1,
|
|
26
|
+
})
|
|
27
|
+
const clip = b.CLIPLoader({ clip_name: 'qwen_2.5_vl_7b_fp8_scaled.safetensors', type: 'qwen_image' })
|
|
28
|
+
const vae = b.VAELoader({ vae_name: 'qwen_image_vae.safetensors' })
|
|
29
|
+
const samples = b.KSampler({
|
|
30
|
+
model,
|
|
31
|
+
positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
|
|
32
|
+
negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
|
|
33
|
+
latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
34
|
+
seed: vars.seed,
|
|
35
|
+
steps: vars.steps,
|
|
36
|
+
cfg: vars.cfg,
|
|
37
|
+
sampler_name: 'euler',
|
|
38
|
+
scheduler: 'simple',
|
|
39
|
+
denoise: 1,
|
|
40
|
+
})
|
|
41
|
+
b.SaveImage({ images: b.VAEDecode({ samples, vae }), filename_prefix: 'comfy-ts-zoo/qwen-image-t2i' })
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export default qwenImageT2i
|
|
46
|
+
|
|
47
|
+
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
48
|
+
if (import.meta.main) {
|
|
49
|
+
requireCloudKey()
|
|
50
|
+
if (process.argv[2]) qwenImageT2i.vars.prompt.set(process.argv[2])
|
|
51
|
+
if (process.argv[3]) qwenImageT2i.vars.seed.set(Number(process.argv[3]))
|
|
52
|
+
const execution = await qwenImageT2i.run({ log: true })
|
|
53
|
+
for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
|
|
54
|
+
host.disconnect()
|
|
55
|
+
}
|