From 71655dfa98427c5286e90fc4c2e169e27978fae7 Mon Sep 17 00:00:00 2001 From: SolitaryThinker Date: Sat, 6 Jun 2026 20:30:21 -0700 Subject: [PATCH] [misc] cosmos3 PORT_STATUS: PR1 progress (arch config, framework parity ref) --- tests/local_tests/cosmos3/PORT_STATUS.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/local_tests/cosmos3/PORT_STATUS.md b/tests/local_tests/cosmos3/PORT_STATUS.md index 341d18db8..a0e8d7507 100644 --- a/tests/local_tests/cosmos3/PORT_STATUS.md +++ b/tests/local_tests/cosmos3/PORT_STATUS.md @@ -13,7 +13,7 @@ ## Current Phase -- phase: `Phase 1 done (reference = cosmos_framework, full omni); feasibility = framework runnable for component parity with light deps` +- phase: `PR1 (video core): arch config + framework parity-reference harness landed; native DiT module rewrite next` - status: `in_progress` - owner: `orchestrator` - last_updated: `2026-06-06` @@ -86,3 +86,14 @@ - Prep (weights/reference/env editable installs) done in MAIN worktree; symlinked into this worktree. Env installs (`diffusers-cosmos3`, `cosmos-framework`) are in shared `fv-main`. - Next: resolve E001 (env), then Phase 1 reference study of `diffusers_cosmos3` pipeline/transformer, then Phase 3 reuse gate (VAE/scheduler/tokenizer) + component dispatch (transformer, vision_encoder, sound_tokenizer). - diffusers 0.36.0 imports the shim OK; checkpoint saved with 0.37.1 — watch `from_pretrained` needs (bump within FastVideo's `diffusers>=0.33.1` pin if required). + +### PR1 (video core) progress — 2026-06-06 +- Arch config 1:1 with checkpoint, committed `9567efdf0`. +- Framework parity-reference harness committed `dd97efda3`: `tests/local_tests/cosmos3/test_cosmos3_reference_forward.py` builds a tiny `Cosmos3VFMNetwork` on CPU/float32 (SDPA monkeypatch; flash2/3/natten are CUDA-only) and forwards `packed_seq -> {last_hidden_state, preds_vision}`. 23 tests pass in fv-cosmos3. This is the ground-truth side for DiT parity. Run: `cd && -m pytest tests/local_tests/cosmos3/test_cosmos3_reference_forward.py -q`. +- THREE naming conventions to bridge: + 1. framework-native (`Cosmos3VFMNetwork`): `language_model.model.layers.{i}.self_attn.{q,k,v,o}_proj(+ _moe_gen)`, `{q,k}_norm(+_moe_gen)`, `mlp(+_moe_gen)`, `vae2llm`/`llm2vae`, `time_embedder.mlp.{0,2}`. + 2. diffusers checkpoint (on disk, what we load): `layers.{i}.self_attn.{to_q,to_k,to_v,to_out}` + `{add_q,add_k,add_v}_proj`/`to_add_out`, `{norm_q,norm_k,norm_added_q,norm_added_k}`, `mlp`/`mlp_moe_gen`, `proj_in`/`proj_out`, `time_embedder.linear_{1,2}`. + 3. FastVideo DiT (our choice). Conversion maps (2)->(3); the DiT parity test copies (1)->(3). +- BaseDiT signature is `__init__(self, config: DiTConfig, hf_config: dict)`; the branch `Cosmos3VFMTransformer` uses `fastvideo_args`/SimpleNamespace and does NOT conform — rewrite to conform + match the checkpoint key surface (single `layers` dual-pathway, not split language_model/gen_layers). +- Native layers (per cosmos2_5): `ReplicatedLinear`/`MLP`/`RMSNorm` (fastvideo.layers.*), `LocalAttention`/`DistributedAttention` (fastvideo.attention), `apply_rotary_emb` (use_real_unbind_dim=-2 for Cosmos). EntryClass at module bottom; class attrs bound from config; 3D-MRoPE has no reusable util — adapt Cosmos25RotaryPosEmbed. +- NEXT: write native `fastvideo/models/dits/cosmos3.py` + fastvideo-vs-framework forward parity test (copy framework weights into the FastVideo DiT, compare outputs), then conversion script (diffusers checkpoint -> FastVideo) + strict-load, then video pipeline/packing.