diff --git a/fastvideo2/evidence/goldens/train-rl-main/inner0.npz b/fastvideo2/evidence/goldens/train-rl-main/inner0.npz new file mode 100644 index 000000000..8091731ab Binary files /dev/null and b/fastvideo2/evidence/goldens/train-rl-main/inner0.npz differ diff --git a/fastvideo2/evidence/goldens/train-rl-main/inner1.npz b/fastvideo2/evidence/goldens/train-rl-main/inner1.npz new file mode 100644 index 000000000..a22635b6e Binary files /dev/null and b/fastvideo2/evidence/goldens/train-rl-main/inner1.npz differ diff --git a/fastvideo2/evidence/goldens/train-rl-main/manifest.json b/fastvideo2/evidence/goldens/train-rl-main/manifest.json new file mode 100644 index 000000000..38dce99ad --- /dev/null +++ b/fastvideo2/evidence/goldens/train-rl-main/manifest.json @@ -0,0 +1,20 @@ +{ + "fastvideo_commit": "c459a1897899ffcec3be7765534d81000b9bb9c1", + "steps": 2, + "config": "diffusion_nft single-frame: 2 outer x 2 batches x 4 timesteps, pickscore+clipscore, crush-smol prompts, beta .1 kl 1e-4 lr 3e-5", + "probe": { + "param_dtype": "torch.float32", + "decay_type": 1, + "ntt": 1000, + "nft_beta": 0.1, + "kl_beta": 0.0001, + "adv_clip_max": 5.0, + "adv_mode": "all", + "max_grad_norm": 1.0 + }, + "gate_yaml": "method:\n _target_: fastvideo.train.methods.rl.diffusion_nft.DiffusionNFTMethod\n adv_clip_max: 5\n adv_mode: all\n beta: 0.1\n decay_type: 1\n ema:\n decay: 0.9\n enabled: false\n update_after_step: 0\n validation: true\n kl_beta: 0.0001\n max_grad_norm: 1.0\n num_batches_per_epoch: 2\n num_inner_epochs: 1\n num_video_per_prompt: 2\n reward_fn:\n clipscore: 1.0\n pickscore: 1.0\n sample_train_batch_size: 2\n sampling:\n flow_shift: inherit\n num_steps: 4\n scheduler: flow_match_euler\n trajectory: ode\n terminal_progress: false\n timestep_fraction: 1.0\n train_batch_size: 2\n validation:\n batch_size: 16\n data_path: null\n every_steps: 1000000\n log_samples: true\n num_prompts: 16\n num_steps: 40\n seed: 42\nmodels:\n old:\n _target_: fastvideo.train.models.wan.WanModel\n disable_custom_init_weights: true\n init_from: Wan-AI/Wan2.1-T2V-1.3B-Diffusers\n trainable: false\n reference:\n _target_: fastvideo.train.models.wan.WanModel\n disable_custom_init_weights: true\n init_from: Wan-AI/Wan2.1-T2V-1.3B-Diffusers\n trainable: false\n student:\n _target_: fastvideo.train.models.wan.WanModel\n init_from: Wan-AI/Wan2.1-T2V-1.3B-Diffusers\n trainable: true\npipeline:\n flow_shift: 8\ntraining:\n checkpoint:\n checkpoints_total_limit: 3\n output_dir: /tmp/fv2_rl_capture\n training_state_checkpointing_steps: 1000000\n data:\n data_path: /home/willlin/.cache/huggingface/hub/datasets--wlsaidhi--crush-smol_processed_t2v/snapshots/67dd07f2163ad2b3397f8b3d8125b67ca452dc85/combined_parquet_dataset\n dataloader_num_workers: 0\n num_frames: 1\n num_height: 448\n num_latent_t: 1\n num_width: 832\n preprocessed_data_type: t2v\n seed: 42\n train_batch_size: 1\n training_cfg_rate: 0.0\n distributed:\n hsdp_replicate_dim: 1\n hsdp_shard_dim: 1\n num_gpus: 1\n sp_size: 1\n tp_size: 1\n loop:\n gradient_accumulation_steps: 2\n max_train_steps: 2\n model:\n enable_gradient_checkpointing_type: null\n optimizer:\n betas:\n - 0.9\n - 0.999\n learning_rate: 3.0e-05\n lr_scheduler: constant\n lr_warmup_steps: 0\n weight_decay: 0.0001\n tracker:\n project_name: diffusion_nft_wan\n run_name: wan2.1_diffusion_nft_pick_clip\n", + "torch": "2.12.0+cu130", + "gpu": "NVIDIA GB200", + "self_noise_max": 0.04484055485020377, + "self_noise_note": "max |total_loss| spread over 3 identical-seed capture runs (all steps)" +} diff --git a/fastvideo2/evidence/goldens/train-rl-main/samples0.npz b/fastvideo2/evidence/goldens/train-rl-main/samples0.npz new file mode 100644 index 000000000..e70623df9 Binary files /dev/null and b/fastvideo2/evidence/goldens/train-rl-main/samples0.npz differ diff --git a/fastvideo2/evidence/goldens/train-rl-main/samples1.npz b/fastvideo2/evidence/goldens/train-rl-main/samples1.npz new file mode 100644 index 000000000..bb2e23f21 Binary files /dev/null and b/fastvideo2/evidence/goldens/train-rl-main/samples1.npz differ diff --git a/fastvideo2/evidence/goldens/train-rl-main/steps.json b/fastvideo2/evidence/goldens/train-rl-main/steps.json new file mode 100644 index 000000000..23bb3a350 --- /dev/null +++ b/fastvideo2/evidence/goldens/train-rl-main/steps.json @@ -0,0 +1,408 @@ +[ + { + "items": [ + { + "prompts": [ + "A large metal cylinder is seen pressing down on a pile of colorful candies, flattening them as if they were under a hydraulic press. The candies are crushed and broken into small pieces, creating a mess on the table.", + "A large metal cylinder is seen pressing down on a pile of colorful candies, flattening them as if they were under a hydraulic press. The candies are crushed and broken into small pieces, creating a mess on the table." + ] + }, + { + "prompts": [ + "A pizza is being crushed by a hydraulic press, causing the toppings to spread out and the crust to crumble.", + "A pizza is being crushed by a hydraulic press, causing the toppings to spread out and the crust to crumble." + ] + } + ], + "inner": [ + { + "timestep_idx": 0, + "row_idx": [ + 1, + 3 + ], + "timestep": [ + 803.7713623046875, + 60.20697021484375 + ], + "losses": { + "total_loss": 5.342502646625078, + "policy_loss": 5.342502646625078, + "unweighted_policy_loss": 1.0685005293250156, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1357421875 + } + }, + { + "timestep_idx": 1, + "row_idx": [ + 1, + 3 + ], + "timestep": [ + 941.8340454101562, + 1000.0 + ], + "losses": { + "total_loss": 13.446108607202637, + "policy_loss": 13.446108607202637, + "unweighted_policy_loss": 2.6892217214405276, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1357421875 + } + }, + { + "timestep_idx": 2, + "row_idx": [ + 1, + 3 + ], + "timestep": [ + 60.20697021484375, + 803.7713623046875 + ], + "losses": { + "total_loss": 4.515896192359375, + "policy_loss": 4.515896192359375, + "unweighted_policy_loss": 0.9031792384718751, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1357421875 + } + }, + { + "timestep_idx": 3, + "row_idx": [ + 1, + 3 + ], + "timestep": [ + 1000.0, + 941.8340454101562 + ], + "losses": { + "total_loss": 14.399518803001467, + "policy_loss": 14.399518803001467, + "unweighted_policy_loss": 2.8799037606002935, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1357421875 + } + }, + { + "timestep_idx": 0, + "row_idx": [ + 2, + 0 + ], + "timestep": [ + 941.8340454101562, + 941.8340454101562 + ], + "losses": { + "total_loss": 13.118073008759543, + "policy_loss": 13.118073008759543, + "unweighted_policy_loss": 2.6236146017519086, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1845703125 + } + }, + { + "timestep_idx": 1, + "row_idx": [ + 2, + 0 + ], + "timestep": [ + 1000.0, + 1000.0 + ], + "losses": { + "total_loss": 18.29075873703107, + "policy_loss": 18.29075873703107, + "unweighted_policy_loss": 3.6581517474062135, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1845703125 + } + }, + { + "timestep_idx": 2, + "row_idx": [ + 2, + 0 + ], + "timestep": [ + 60.20697021484375, + 60.20697021484375 + ], + "losses": { + "total_loss": 1.6802980970623111, + "policy_loss": 1.6802980970623111, + "unweighted_policy_loss": 0.33605961941246226, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1845703125 + } + }, + { + "timestep_idx": 3, + "row_idx": [ + 2, + 0 + ], + "timestep": [ + 803.7713623046875, + 803.7713623046875 + ], + "losses": { + "total_loss": 7.296204002432377, + "policy_loss": 7.296204002432377, + "unweighted_policy_loss": 1.4592408004864756, + "kl_div_loss": 0.0, + "old_deviate": 0.0, + "old_kl_div": 0.0, + "x0_norm": 0.1845703125 + } + } + ], + "rewards": { + "clipscore": [ + 0.13153909146785736, + 0.20024922490119934, + 0.14863893389701843, + 0.2340940237045288 + ], + "pickscore": [ + 0.6811658143997192, + 0.7108843326568604, + 0.7316142916679382, + 0.7339301109313965 + ], + "avg": [ + 0.8127049207687378, + 0.9111335277557373, + 0.8802531957626343, + 0.9680241346359253 + ] + }, + "old_decay": 0.001, + "advantages_shape": [ + 4, + 4 + ] + }, + { + "items": [ + { + "prompts": [ + "The video shows a stack of caramelized sugar cubes being flattened as if they were under a hydraulic press, resulting in a messy pile of broken sugar on the table.", + "The video shows a stack of caramelized sugar cubes being flattened as if they were under a hydraulic press, resulting in a messy pile of broken sugar on the table." + ] + }, + { + "prompts": [ + "The video shows a hydraulic press flattening objects as if they were under a hydraulic press. The press is shown in action, compressing two colorful objects that resemble sandwiches. The press is yellow and black striped, and the objects being flattened are placed on a metal plate. The background is green, and the press is moving down, compressing the objects.", + "The video shows a hydraulic press flattening objects as if they were under a hydraulic press. The press is shown in action, compressing two colorful objects that resemble sandwiches. The press is yellow and black striped, and the objects being flattened are placed on a metal plate. The background is green, and the press is moving down, compressing the objects." + ] + } + ], + "inner": [ + { + "timestep_idx": 0, + "row_idx": [ + 1, + 2 + ], + "timestep": [ + 941.8340454101562, + 1000.0 + ], + "losses": { + "total_loss": 12.398794127316185, + "policy_loss": 12.398782623619743, + "unweighted_policy_loss": 2.479756524723949, + "kl_div_loss": 0.11474609375, + "old_deviate": 2.8848648071289062e-05, + "old_kl_div": 0.11474609375, + "x0_norm": 0.232421875 + } + }, + { + "timestep_idx": 1, + "row_idx": [ + 1, + 2 + ], + "timestep": [ + 60.20697021484375, + 941.8340454101562 + ], + "losses": { + "total_loss": 5.758004918792544, + "policy_loss": 5.758003212609587, + "unweighted_policy_loss": 1.1516006425219176, + "kl_div_loss": 0.01708984375, + "old_deviate": 0.00015544891357421875, + "old_kl_div": 0.0169677734375, + "x0_norm": 0.232421875 + } + }, + { + "timestep_idx": 2, + "row_idx": [ + 1, + 2 + ], + "timestep": [ + 1000.0, + 803.7713623046875 + ], + "losses": { + "total_loss": 10.294339807390942, + "policy_loss": 10.29431918418385, + "unweighted_policy_loss": 2.05886383683677, + "kl_div_loss": 0.2060546875, + "old_deviate": 3.147125244140625e-05, + "old_kl_div": 0.205078125, + "x0_norm": 0.232421875 + } + }, + { + "timestep_idx": 3, + "row_idx": [ + 1, + 2 + ], + "timestep": [ + 803.7713623046875, + 60.20697021484375 + ], + "losses": { + "total_loss": 3.6922912036167417, + "policy_loss": 3.69229043248165, + "unweighted_policy_loss": 0.7384580864963299, + "kl_div_loss": 0.007720947265625, + "old_deviate": 0.00016689300537109375, + "old_kl_div": 0.00775146484375, + "x0_norm": 0.232421875 + } + }, + { + "timestep_idx": 0, + "row_idx": [ + 0, + 3 + ], + "timestep": [ + 941.8340454101562, + 1000.0 + ], + "losses": { + "total_loss": 10.91259682812316, + "policy_loss": 10.91258747019393, + "unweighted_policy_loss": 2.1825174940387857, + "kl_div_loss": 0.09375, + "old_deviate": 2.9206275939941406e-05, + "old_kl_div": 0.09326171875, + "x0_norm": 0.296875 + } + }, + { + "timestep_idx": 1, + "row_idx": [ + 0, + 3 + ], + "timestep": [ + 60.20697021484375, + 803.7713623046875 + ], + "losses": { + "total_loss": 3.5539959718750014, + "policy_loss": 3.5539953236744894, + "unweighted_policy_loss": 0.7107990647348978, + "kl_div_loss": 0.0064697265625, + "old_deviate": 0.00017261505126953125, + "old_kl_div": 0.006439208984375, + "x0_norm": 0.296875 + } + }, + { + "timestep_idx": 2, + "row_idx": [ + 0, + 3 + ], + "timestep": [ + 1000.0, + 941.8340454101562 + ], + "losses": { + "total_loss": 10.252210426698156, + "policy_loss": 10.252192783723302, + "unweighted_policy_loss": 2.050438556744661, + "kl_div_loss": 0.1767578125, + "old_deviate": 2.9325485229492188e-05, + "old_kl_div": 0.1767578125, + "x0_norm": 0.296875 + } + }, + { + "timestep_idx": 3, + "row_idx": [ + 0, + 3 + ], + "timestep": [ + 803.7713623046875, + 60.20697021484375 + ], + "losses": { + "total_loss": 4.397589007283385, + "policy_loss": 4.397588385159906, + "unweighted_policy_loss": 0.8795176770319812, + "kl_div_loss": 0.0062255859375, + "old_deviate": 0.00019168853759765625, + "old_kl_div": 0.0062255859375, + "x0_norm": 0.296875 + } + } + ], + "rewards": { + "clipscore": [ + 0.20155902206897736, + 0.1521805226802826, + 0.18642529845237732, + 0.19080127775669098 + ], + "pickscore": [ + 0.7295283079147339, + 0.7310761213302612, + 0.7291601896286011, + 0.7219043374061584 + ], + "avg": [ + 0.93108731508255, + 0.8832566738128662, + 0.9155855178833008, + 0.9127056002616882 + ] + }, + "old_decay": 0.002, + "advantages_shape": [ + 4, + 4 + ] + } +] diff --git a/fastvideo2/evidence/goldens/videoalign-pr1476/scores.json b/fastvideo2/evidence/goldens/videoalign-pr1476/scores.json new file mode 100644 index 000000000..65c9290e9 --- /dev/null +++ b/fastvideo2/evidence/goldens/videoalign-pr1476/scores.json @@ -0,0 +1,23 @@ +{ + "scores": { + "MQ": [ + 0.497402, + 0.457805, + -0.017359 + ], + "VQ": [ + -1.186994, + -1.075764, + 0.408458 + ], + "TA": [ + -2.897675, + -2.61778, + -1.07544 + ] + }, + "checkpoint": "/home/willlin/.cache/huggingface/hub/models--KwaiVGI--VideoReward/snapshots/4f26600130683e6f1de9f5d463887f28e8ef995c", + "authority": "PR #1476 maint/pr1476-runtime-compat @518aeab0b (vendored byte-identical, see test_videoalign.py)", + "torch": "2.12.0+cu130", + "gpu": "NVIDIA GB200" +} diff --git a/fastvideo2/evidence/ledger.jsonl b/fastvideo2/evidence/ledger.jsonl index 98470c991..e9bdd5c5a 100644 --- a/fastvideo2/evidence/ledger.jsonl +++ b/fastvideo2/evidence/ledger.jsonl @@ -166,3 +166,7 @@ {"ts": "2026-07-23T17:51:55Z", "gate": "anchor.train-self_forcing-main", "status": "pass", "model_id": "sfwan-t2v-1.3b", "card_digest": "9c9b4cc573606028", "metrics": {"x0.step0": 0.0, "fake.step0": 0.00029414892196655273, "x0.step1": 0.0, "fake.step1": 0.0005563050508499146, "x0.step2": 0.0, "fake.step2": 0.00035434961318969727, "x0.step3": 0.0, "fake.step3": 0.0002406388521194458, "x0.step4": 0.0, "fake.step4": 0.00022238492965698242, "fwd.matches": 0.0}, "tolerances": {"x0-pre-update": 0.0, "later": "band"}, "env": {"python": "3.12.13", "machine": "aarch64", "commit": "93153f8", "torch": "2.12.0+cu130", "cuda": "13.0", "gpu": "NVIDIA GB200", "diffusers": "0.39.0", "transformers": "5.13.0", "attention": {"policy": "AUTO", "available": ["FLASH_ATTN", "SDPA"]}}, "detail": "goldens c459a1897"} {"ts": "2026-07-23T18:23:19Z", "gate": "anchor.serve-identity", "status": "pass", "model_id": "fastwan-qad-fp8-1.3b", "card_digest": "1c8e6f7d1380552d", "metrics": {"identity": 0.0, "ws_steps": 3.0}, "tolerances": {"identity": 0.0}, "env": {"python": "3.12.13", "machine": "aarch64", "commit": "b376207", "torch": "2.12.0+cu130", "cuda": "13.0", "gpu": "NVIDIA GB200", "diffusers": "0.39.0", "transformers": "5.13.0", "attention": {"policy": "AUTO", "available": ["FLASH_ATTN", "SDPA"]}}, "detail": "served 41c4817d3d0f666b offline 41c4817d3d0f666b"} {"ts": "2026-07-23T18:27:47Z", "gate": "anchor.dreamverse-runtime", "status": "pass", "model_id": "fastwan-qad-fp8-1.3b", "card_digest": "-", "metrics": {"steps": 3.0, "chunks": 32.0, "ftyp": 1.0}, "tolerances": {}, "env": {"python": "3.12.13", "machine": "aarch64", "commit": "fdddc59", "torch": "2.12.0+cu130", "cuda": "13.0", "gpu": "NVIDIA GB200", "diffusers": "0.39.0", "transformers": "5.13.0", "attention": {"policy": "AUTO", "available": ["FLASH_ATTN", "SDPA"]}}, "detail": "latents 9671b076aafff016"} +{"ts": "2026-07-23T19:26:25Z", "gate": "anchor.train-rl-main", "status": "fail", "model_id": "wan2.1-t2v-1.3b", "card_digest": "7171d8729ae72ae4", "metrics": {"advantages.step0": 0.0, "loss.s0k0": 0.0034792618441672474, "loss.s0k1": 0.0007733339205699963, "loss.s0k2": 0.00017366389334405596, "loss.s0k3": 0.004427341173300903, "loss.s0k4": 0.021503618076398112, "loss.s0k5": 0.0033195134562689077, "loss.s0k6": 2.1168774413382607e-05, "loss.s0k7": 0.000990179815745229, "advantages.step1": 0.0, "loss.s1k0": 0.05847059518240627, "loss.s1k1": 0.0010533409492632373, "loss.s1k2": 0.0034236295955523133, "loss.s1k3": 0.004349640925024101, "loss.s1k4": 0.047157419533888856, "loss.s1k5": 0.002190229000701205, "loss.s1k6": 0.011363542387446302, "loss.s1k7": 0.005596577394816116}, "tolerances": {"advantages": 0.0, "step0": "exact-or-band", "step1": "main self-noise band"}, "env": {"python": "3.12.13", "machine": "aarch64", "commit": "3866db2", "torch": "2.12.0+cu130", "cuda": "13.0", "gpu": "NVIDIA GB200", "diffusers": "0.39.0", "transformers": "5.13.0", "attention": {"policy": "AUTO", "available": ["FLASH_ATTN", "SDPA"]}}, "detail": "goldens c459a1897, band=6.726e-02"} +{"ts": "2026-07-23T19:54:30Z", "gate": "anchor.train-rl-main", "status": "pass", "model_id": "wan2.1-t2v-1.3b", "card_digest": "7171d8729ae72ae4", "metrics": {"advantages.step0": 0.0, "loss.s0k0": 0.0, "loss.s0k1": 0.0, "loss.s0k2": 0.0, "loss.s0k3": 0.0, "loss.s0k4": 0.0, "loss.s0k5": 0.0, "loss.s0k6": 0.0, "loss.s0k7": 0.0, "advantages.step1": 0.0, "loss.s1k0": 0.011695116289581975, "loss.s1k1": 0.0015937395833205414, "loss.s1k2": 0.002726593122572396, "loss.s1k3": 0.0009456473942783816, "loss.s1k4": 0.011560843720619829, "loss.s1k5": 0.0038772091026810784, "loss.s1k6": 0.00849335173029786, "loss.s1k7": 0.0002466132267455734}, "tolerances": {"advantages": 0.0, "step0": "exact-or-band", "step1": "main self-noise band"}, "env": {"python": "3.12.13", "machine": "aarch64", "commit": "b01bde8", "torch": "2.12.0+cu130", "cuda": "13.0", "gpu": "NVIDIA GB200", "diffusers": "0.39.0", "transformers": "5.13.0", "attention": {"policy": "AUTO", "available": ["FLASH_ATTN", "SDPA"]}}, "detail": "goldens c459a1897, band=6.726e-02"} +{"ts": "2026-07-23T19:58:25Z", "gate": "anchor.videoalign-pr1476", "status": "pass", "model_id": "wan2.1-t2v-1.3b", "card_digest": "7171d8729ae72ae4", "metrics": {"MQ.v0": 0.497402, "MQ.v1": 0.457805, "MQ.v2": -0.017359, "VQ.v0": -1.186994, "VQ.v1": -1.075764, "VQ.v2": 0.408458, "TA.v0": -2.897675, "TA.v1": -2.61778, "TA.v2": -1.07544}, "tolerances": {"determinism": "exact", "vs_golden": "exact"}, "env": {"python": "3.12.13", "machine": "aarch64", "commit": "b01bde8", "torch": "2.12.0+cu130", "cuda": "13.0", "gpu": "NVIDIA GB200", "diffusers": "0.39.0", "transformers": "5.13.0", "attention": {"policy": "AUTO", "available": ["FLASH_ATTN", "SDPA"]}}, "detail": "MQ/VQ/TA on 3 fixed media, KwaiVGI/VideoReward, use_norm=True"} +{"ts": "2026-07-23T19:58:44Z", "gate": "anchor.train-data-main", "status": "pass", "model_id": "wan2.1-t2v-1.3b", "card_digest": "7171d8729ae72ae4", "metrics": {"step0.row_match": 1.0, "step1.row_match": 1.0, "step2.row_match": 1.0, "step3.row_match": 1.0, "step4.row_match": 1.0}, "tolerances": {"caption/latents/embeds": "exact"}, "env": {"python": "3.12.13", "machine": "aarch64", "commit": "b01bde8", "torch": "2.12.0+cu130", "cuda": "13.0", "gpu": "NVIDIA GB200", "diffusers": "0.39.0", "transformers": "5.13.0", "attention": {"policy": "AUTO", "available": ["FLASH_ATTN", "SDPA"]}}, "detail": "loader order vs goldens c459a1897: 5 batches, files=4"} diff --git a/fastvideo2/evidence/train_numerics_report.md b/fastvideo2/evidence/train_numerics_report.md index 9e87ec492..1ba804cf2 100644 --- a/fastvideo2/evidence/train_numerics_report.md +++ b/fastvideo2/evidence/train_numerics_report.md @@ -186,3 +186,74 @@ Gate transcript: 3 live steps, 32 fMP4 chunks (ISO-BMFF ftyp verified), Scope note: the original app is LTX2-specific (audio, refine, continuation state, LoRA stacks) — this port re-bases Dreamverse's ARCHITECTURE onto the wan family; their Next.js client's message schema maps onto these events. + +## Dataloader order — added 2026-07-23 + +Gate `anchor.train-data-main`: PASS. `fastvideo2/train/data.py` reproduces +main's map-style parquet loader at world size 1: file discovery is +`os.walk(realpath(root))` with each file realpath'd (on an HF snapshot the +sort key is therefore the resolved BLOB path) and one global path sort; +the sampler is `torch.randperm(total, generator=manual_seed(seed))` +truncated to a batch multiple and chunked sequentially; rows decode +`np.frombuffer(..., np.float32)` (main ignores the `_dtype` column); text +embeddings pad/crop to 512 with a 1/0 mask. Checked against the finetune +capture's recorded stream: first 5 batches match on caption, latents hash +(post `num_latent_t` slice, bf16-cast) and embeds hash — all exact. + +## DiffusionNFT RL — added 2026-07-23 + +Gate `anchor.train-rl-main`: PASS. Goldens from main's MERGED modular +trainer (`train/methods/rl/diffusion_nft.py`) at a shrunk single-frame +config (2 outer steps x 2 sample batches x 2 videos/prompt, 4 sampling +steps, timestep_fraction 1.0, pickscore+clipscore rewards, crush-smol +prompts, Wan2.1-T2V-1.3B for student/old/reference). + +Capture records the DIRECT inputs of every `_training_timestep_loss` call +(pre-shuffle row indices by byte-match, timestep column, advantages, the +xt noise draw) — the inner loop's cuda_generator sample/timestep +permutations never need replaying. At this config the effective grad accum +(2 x 4 timesteps = 8) equals the calls per outer step, so the optimizer +fires once per outer step and ALL step-0 losses are pre-update: + + advantages exact (0.0) both outer steps (group-by-prompt, + (r-mean)/(std_unbiased=False+1e-4), rewards["avg"]) + loss.s0k0..k7 BITWISE 0.0 (8/8) at pre-update weights + loss.s1k0..k7 max diff 1.17e-2, within the measured band + (main self-noise 4.48e-2 over 3 identical-seed + capture runs; band = 1.5x). Step-0 losses are + exactly repeatable on main across runs. + +Root cause worth keeping (cost one bisection): the modular stack loads +every role through `maybe_load_fsdp_model` with +`MixedPrecisionPolicy(param_dtype=bf16, reduce_dtype=fp32)` over fp32 +storage. Probing `p.dtype` shows only the fp32 STORAGE dtype; the FORWARD +runs on bf16-cast params (RMSNorm weights and scale_shift_table included — +confirmed by per-module hash probes: inputs bitwise, `to_q` diverging, +main's `norm_q` emitting bf16). AdamW (eps 1e-8) and the old-policy EMA +operate on the fp32 storage — at world 1 exactly the fp32-master / +bf16-compute chain (`_MasterOpt`) the finetune/DMD2 gates proved. An +NFTStep variant with plain AdamW over fp32 live params + autocast produced +2e-5..2e-2 step-0 errors; the restored master-chain NFTStep is bitwise. + +Upstream findings (transformers 5.13, filed in PORT_NOTES): main's +PickScoreScorer crashes (`get_*_features` now returns a ModelOutput whose +`.pooler_output` holds the projected features; unwrap must be scoped to the +PickScore instance — `CLIPModel.forward` consumes the new contract); +RL validation fires at iteration 0 (`0 % every_steps == 0`); `_return_decay` +is a staticmethod (plain-function monkeypatches shift its args); the +VideoAlign runtime needs `accelerate>=1.1` and headless opencv on ARM. + +## VideoAlign rewards — added 2026-07-23 + +Gate `anchor.videoalign-pr1476`: PASS. The reward runtime under +`fastvideo2/rl_rewards/VideoAlign/` is vendored BYTE-IDENTICAL from +PR #1476 (`maint/pr1476-runtime-compat` @518aeab0b) — sha256 of all 8 files +is asserted in `tests/test_videoalign.py`, and pre-commit excludes the +directory so formatters cannot drift it. The wrapper +(`fastvideo2/train/videoalign.py`) differs from the PR's +`rewards/videoalign.py` only by the vendored-root path and the inlined +(verbatim) `media_to_uint8_array`. Code identity => behavior identity; the +cluster gate then proves the stack end-to-end on the real +KwaiVGI/VideoReward checkpoint: MQ/VQ/TA on 3 fixed synthetic media, +scored twice — deterministic (exact), finite, goldens recorded +(`videoalign-pr1476/scores.json`).