No description
Find a file
Orwa Diraneyya cdab77dafe
README: laptop conversion (--object-info, Studio wrapper), ws-live pickup
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 06:18:40 +02:00
custom_nodes/comfy-vast-fixups comfy-vast-fixups: re-enable comfy_kitchen's cuda backend that ComfyUI disables below cu130 2026-10-18 02:47:50 +02:00
.gitignore keep CLAUDE.md out of the repo 2026-10-17 20:21:04 +02:00
civitai-get update, 1000% AI generated 2026-10-15 22:16:02 +02:00
comfy-deps comfy-deps: update ComfyUI-Manager and install every custom node pack's requirements/install.py into the venv; provision.sh calls it 2026-10-17 02:40:21 +02:00
comfy-endpoint comfy-endpoint: bake each exposed widget's control spec into _meta.studio 2026-10-18 22:51:07 +02:00
comfy-fetch-models comfy-fetch-models: read LoRA names inside Power Lora Loader dict widgets 2026-10-17 21:18:57 +02:00
comfy-wrapper-patch comfy-wrapper-patch: add Result.comfyui_job_id to the stock API wrapper; run it from provision.sh 2026-10-18 00:11:55 +02:00
provision.sh ws-live: mount-like two-way sync of ComfyUI/user with the bucket (inotify push, periodic pull) 2026-10-19 05:33:11 +02:00
README.md README: laptop conversion (--object-info, Studio wrapper), ws-live pickup 2026-10-19 06:18:40 +02:00
ws-autopush update, 1000% AI generated 2026-10-15 22:16:02 +02:00
ws-env.sh selective ws-pull fetches only the endpoints of the selected base workflows 2026-10-18 01:35:16 +02:00
ws-excludes.txt ws-excludes: macOS Finder metadata (.DS_Store, ._*) never syncs 2026-10-18 23:30:32 +02:00
ws-live ws-live: own rclone flags for pull/push (the shared base sets -v, which clashed with -q) 2026-10-19 05:35:53 +02:00
ws-pull ws-pull: report how many sidecar models were added 2026-10-18 02:31:54 +02:00
ws-push ws-pull: WS_WORKFLOWS selective mode pulls user/, custom_nodes/ and only the models the named workflows reference 2026-10-17 03:05:38 +02:00

comfy-vast — the instance kit

Scripts that turn a Vast.ai instance running the stock vastai/comfy image into a ready ComfyUI box: pull the workspace from an R2 bucket, install what the venv is missing, patch two things the image gets wrong, push new material back, and publish annotated workflows as endpoints for the sibling project Comfy Vast Studio (the laptop page that runs them). The repository is cloned onto every instance as /root/tools.

Pieces

Script Does
provision.sh Vast's provisioning script: clone/pull this repo (+ aria2, inotify-tools), ws-pull, install the fixups symlink, comfy-deps, comfy-wrapper-patch, start ws-autopush and ws-live
ws-env.sh rclone remote from the template env, WS_* defaults, the filter builder
ws-pull bucket → /workspace, add/update only; selective with WS_WORKFLOWS (below)
ws-push /workspace → bucket, add/update only, never deletes (--mirror does, after a dry run and a prompt)
ws-autopush ws-push every WS_PUSH_INTERVAL seconds (600)
ws-live the mount's stand-in for ComfyUI/user (a Vast container cannot mount: no /dev/fuse, no CAP_SYS_ADMIN): every change under user/ is pushed within ~1 s (inotify; deletes included, a deleted folder is purged), and the bucket's user/ is pulled every 20 s with newer-wins. Workflows saved in the editor, endpoints converted on the laptop and published sidecars therefore meet within seconds
comfy-deps pip install every pack's requirements into /venv/main, update Manager, restart ComfyUI
comfy-fetch-models the models a workflow references → download or resolve against a bucket listing
civitai-get Civitai URL/id → the right models/ subfolder
comfy-endpoint annotated editor workflow → Studio endpoint (API format) + .source sidecar
comfy-wrapper-patch adds the missing comfyui_job_id field to the API wrapper's Result model and restarts it
custom_nodes/comfy-vast-fixups node-less pack that re-enables comfy_kitchen's CUDA backend (ComfyUI disables it below cu130; Ref2VA-VSA needs it)

Template env (Vast): RCLONE_CONFIG_R2_ACCESS_KEY_ID, RCLONE_CONFIG_R2_SECRET_ACCESS_KEY, RCLONE_CONFIG_R2_ENDPOINT, TOOLS_REPO (HTTPS clone URL of this repo), PROVISIONING_SCRIPT (raw URL of provision.sh), CIVITAI_TOKEN; optional WS_REMOTE, WS_WORKFLOWS, WS_INCLUDE.

Selective provisioning: WS_WORKFLOWS

With WS_WORKFLOWS="H3_LongTake_i2v.studio,ref2va_vsa.studio" (names under workflows/, .json implied, globs allowed) a pull fetches:

  1. all of user/ (every base workflow, every endpoint's .source sidecar, settings), all custom_nodes/, models/ultralytics/, plus any WS_INCLUDE globs;
  2. the models the named base workflows reference;
  3. only the endpoints whose .source line 1 names one of those bases (an endpoint without a sidecar is pulled when its file name matches a pattern), and
  4. the extra models listed on those sidecars' lines 2+.

Endpoints whose models were not pulled therefore never appear in the Studio. All bases are always pulled, so WS_WORKFLOWS="other" ws-pull on a running box extends it with another base, its models and its endpoint. A plain ws-pull fetches everything.

The sidecar endpoints/<name>.source:

H3_LongTake_i2v.studio.json      # line 1: the base workflow, relative to user/default/workflows/
loras/H3_*.safetensors           # lines 2+: extra models the endpoint needs, relative to ComfyUI/models/
unet/alternative.safetensors     # globs allowed, blank lines and # comments ignored

comfy-endpoint writes line 1 (and rewrites only line 1 on a reconvert); the lines below are yours. comfy-endpoint --set-source "<Endpoint>" <base> writes line 1 for an endpoint made by hand. The Studio's Publish adds blocks of its own for presets, # preset: <name> … # end preset: <name>, and only ever rewrites those; a file it cannot find in the bucket is written as # not in bucket: …. Repeated paths across blocks are fine: the pull de-duplicates.

Manual: preparing a workflow for the converter

The Studio runs endpoints: API-format prompts with markers that say which values the page exposes. You make one from an ordinary editor workflow in three steps, all on the instance.

1. Make the workflow conform, in the editor

  • Fixed values are values: set them (e.g. dry_run = false) and leave them unmarked.
  • Ctrl+M / Ctrl+B are not inputs. A node that should be switchable from the page gets a {switch:name} marker (its mute state becomes the default); a node left muted without a switch is simply left out; a bypassed node without a switch or ? marker is refused.
  • Results must either come out of a saver node (type {out:video} or {out:image} into its filename prefix field) or from a node that reports its own saved files (the H3 LongTake nodes do).
  • A widget that was converted to an input (fed by a link) cannot be marked; disconnect it or mark the node that feeds it. Nodes that read the editor's graph (WidgetToString) must go.
  • If the file came as an API-format JSON (flat {"id": {"class_type", "inputs"}}, no nodes array), drop it on the canvas first; the frontend rebuilds a graph; check the links it recreated.

2. Annotate node titles

Append markers to the node's title (everything else in the title stays; several markers per title):

Marker Meaning
{in:duration@duration_seconds} expose this widget; its current value is the default; the page renders it from the node's spec (slider, toggle, dropdown, textarea)
{in:duration@duration_seconds[1..30:0.5]} same, with the slider's range (INT/FLOAT only; [min..max] or [min..max:step]; the default must lie inside)
{in:clip_duration@clip_frames[22..362:17 s/24]} same, shown and edited as raw ÷ 24 in "s" (any unit, any divisor); the page snaps to the step and sends the raw value, so a frame count reads as a duration
{in:clips@duration_seconds[1..8 = (clips*(clip_duration-5)+5)/24]} a derived input: the page shows clips (1–8, step 1 unless given) and the widget receives the expression, evaluated at run time over the form's other inputs in their raw units (+ - * / and parentheses; every name must be an input of the endpoint). The live result shows beside the control; the sidecar records it under derived
{in:prompt@prompts} a text widget: exposed, its text is stripped on publish
{in:start@image} on a LoadImage an image input
{in:face?@image} on a LoadImage an optional image: a job without it removes the node and leaves the consumer's input unconnected
{switch:refine} a toggle for this node; off = the node and everything downstream are left out
{in:loras} on a LoRA node the job's LoRA list replaces it (added automatically when missing)
{in:audio_vae@vae_name} on a loader names a model dropdown (otherwise auto-named after the field: unet, clip, vae, vae_2, gate_file …)
{out:video} in a saver's prefix field a result
same name on two nodes one control feeds both

Reserved names: seed, seeds, overrides, preset. Seeds need nothing: every seed/noise_seed is randomised per job unless the page gives one. Save the workflow as <name>.studio.json.

3. Convert

comfy-endpoint <name>.studio --name "Readable Endpoint Name"       # writes endpoints/<Name>.json + .source
comfy-endpoint <name>.studio --name "…" --dry-run                   # report only
comfy-endpoint <name>.studio --name "…" --force                     # reconvert after editing the base
comfy-endpoint <path> --name "…" --out <endpoints dir> --object-info URL|FILE   # from a laptop: pass paths, and a
                                                                    # ComfyUI /object_info to bake full specs

On the instance the script finds ComfyUI itself and bakes full control specs. On the laptop (the Studio mounts the bucket's workflows/ at ./workflows and wraps this script as comfy-endpoint, with --instance <id> to reach a connected instance's ComfyUI) specs are coarse unless --object-info points at a server or a saved file; ws-live on the instance picks the result up within seconds.

The report lists every control with its kind and default, what was stripped, and how many nodes the endpoint has. Every problem is reported at once; fix them in the editor and rerun. One known message: "cannot locate the value of 'x' in widgets_values … save it again" means the node pack added a widget since the file was saved; open and save the workflow in the editor to rebuild it. Autopush carries the endpoint and sidecar to the bucket; in the Studio press ↻ Refresh.

What the converter does for you

Model-file dropdowns become {in:…} slots (the endpoint carries no model names), LoRA entries are emptied, text slots blanked, Markdown/Note nodes dropped, widget values mapped through the editor's own inputs list (the image's converter pack mis-assigns them after link-only inputs), reroutes followed, muted nodes left out, and the result written in API format next to the .source sidecar. Each exposed widget's control spec (type, min/max/step, the options of non-model combos) is baked into the node's _meta.studio from ComfyUI's /object_info when a server is reachable (on the instance, or --object-info URL|FILE); converting on the laptop without one bakes coarse types, and a later reconvert on an instance upgrades them. Model-file lists are never baked.

Things the image gets wrong (and the kit fixes)

  • The API wrapper's Result model lacks comfyui_job_id; any prompt ComfyUI rejects instantly surfaces as a pydantic error instead of the cause. comfy-wrapper-patch.
  • ComfyUI 0.40 disables comfy_kitchen's CUDA backend when PyTorch is built against CUDA < 13 (the image is cu128); packs that require it fail with Backend 'cuda' is not available: disabled. custom_nodes/comfy-vast-fixups, symlinked by provision.sh. The durable alternative is a cu130 torch in /venv/main.
  • The wrapper inlines outputs as base64 only up to 10 MB and its progress stream rides a Cloudflare quick tunnel that drops after ~100 s of silence; the Studio downloads big results from ComfyUI's /view and polls /result after a drop.