Skip to content

feat: Cosmos3 videogen worker on public cosmos-framework (overlay)#14

Merged
Johan-de-R merged 5 commits into
mainfrom
johan/cosmos3-framework-worker
Jul 9, 2026
Merged

feat: Cosmos3 videogen worker on public cosmos-framework (overlay)#14
Johan-de-R merged 5 commits into
mainfrom
johan/cosmos3-framework-worker

Conversation

@Johan-de-R

Copy link
Copy Markdown

Summary

  • Moves Cosmos3 serving off the retired private EA fork (deepinfra/cosmos3) onto NVIDIA's public cosmos-framework, pinned at 463ac142.
  • Overlay layout (same idea as examples/diffusers for LTX/FastWan): worker.py + Dockerfile (clones upstream at the pin, applies patches/) + patches/0001 (encoder -threads cap, EA PR fix: cosmos3 worker.py /opt/app path + CodeQL except:pass (follow-up to #14) #19 re-applied). No DeepInfra copy of the framework repo exists — this directory is the whole reviewable delta.
  • worker.py is the EA worker with only the six import lines renamed (cosmos3.*cosmos_framework.*); dynamo registration, request/response schemas, gloo idle-watchdog fix, torchrun relaunch, standalone mode unchanged. All symbols verified present/compatible in the public framework.
  • Free upstream wins: native public-checkpoint loading (kills 16 EA shim PRs), discarded-parallelism-config bug fixed, guardrails default ON, AVAE audio tokenizer released.

Validation

  • py_compile on worker.py and the patched handler.
  • Patch applies cleanly at the pin.
  • Next (separate step, gated): image build with HF_TOKEN, then Nano parity run on 1 reserved H100 vs NVIDIA's official 207.8s (720p/189f, H100-80GB) before any prod rollout.

🤖 Generated with Claude Code

Serving overlay for nvidia/Cosmos3-Nano and Cosmos3-Super on NVIDIA's public
cosmos-framework, replacing the retired private EA fork (deepinfra/cosmos3):

- worker.py: ported from the EA fork (import renames only); dynamo
  registration, schemas, gloo control-plane fix, torchrun relaunch and
  standalone mode unchanged.
- Dockerfile: overlay build — clones cosmos-framework at a pinned ref,
  applies patches/, mirrors upstream's build, bakes worker + HF prefetch
  (incl. gated Cosmos-Guardrail1 for default-on guardrails).
- patches/0001: encoder -threads cap (EA PR #19 re-applied).

The 16 EA-era weight/code mismatch shims are obsolete upstream (native
diffusers loading, AVAE released, parallelism-config bug fixed, guardrails
default on). See examples/cosmos3/README.md for provenance.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added feat documentation Improvements or additions to documentation labels Jul 7, 2026


# Valid model_mode values for action modalities.
_ACTION_MODES = frozenset({"forward_dynamics", "inverse_dynamics", "policy"})
w, h = int(parts[0]), int(parts[1])
if (w, h) in _SIZE_TO_RES_AR:
res, ar = _SIZE_TO_RES_AR[(w, h)]
except ValueError:
Johan-de-R and others added 4 commits July 7, 2026 23:14
ARG values are recorded in image layer history, so a token passed that way
is readable by anyone who can pull from the registry. The secret mount is
available only during the RUN and never persists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- patches/0002: video guardrail runner drops the RetinaFace face-blur
  postprocessor, which unconditionally pixelates every detected face in every
  output frame (breaks the product; it is a privacy/anti-deepfake measure, not
  a content-safety control). The content-safety value stays: text-prompt
  guardrail (Blocklist + Qwen3Guard) is unchanged, and upstream already
  disables VideoContentSafetyFilter.
  Removal explicitly authorized by Johan (product owner) 2026-07-08. Flagged as
  potentially relevant to likeness/NCII/deepfake obligations; to be confirmed
  with legal as a follow-up (not a rollout blocker per Johan).
- patches/0001 (encode-params): -threads cap plus explicit BT.709 signaling
  (colorspace+primaries+trc + limited range); conversion target and tag set
  together. Verified to round-trip identically to untagged on a compliant
  decoder — correctness hygiene, not a fix for a confirmed visible defect.
- Dockerfile: apply patches + copy worker LAST (after the ~11GB gated prefetch),
  relying on the editable install, so patch iterations rebuild in seconds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
In-image A/B on a color test card, both decoded as BT.709 by a compliant
decoder:
  fw-v1 untagged (current): red 253,0,0  green 0,255,0  skin 239,193,165  (~exact)
  bt709/tv tagged (patch):  red 255,23,0 green 0,215,0 skin 243,196,163   (err up to 40)

Setting -colorspace/-color_range as imageio output flags TAGS the stream but
does not correctly drive the RGB->YUV conversion, so tag and pixels disagree
(the mislabel trap). The untagged output already round-trips cleanly on a
compliant decoder, so there is no confirmed visible defect to fix here anyway.
0001 reverts to the thread-cap-only change. Proper color signaling (force the
conversion via a scale filter matched to the tag) is deferred to its own task,
gated on first confirming an actual browser-rendering problem exists.

fw-v2 = face-blur removal (0002) + encoder thread cap (0001). No color change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…red imports)

Formatting-only: black + isort reflow, and # noqa: E402 on the imports that
must follow init_script() (the required init-before-heavy-imports pattern,
same as cosmos_framework's own scripts). No behavior change — the built
fw-v2 image (from the pre-format worker.py) is byte-behavior-identical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Johan-de-R
Johan-de-R merged commit 9fcbba2 into main Jul 9, 2026
13 of 15 checks passed
Johan-de-R added a commit that referenced this pull request Jul 9, 2026
fix: cosmos3 worker.py /opt/app path + CodeQL except:pass (follow-up to #14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants