우리 CosmosV2WAdapter는 FF BaseAdapter.__init__(Arguments+Accelerator, diffusers DiffusionPipeline 가정, accelerator.prepare, FSDP)을 의도적으로 우회했고, cosmos 파이프라인은 diffusers가 아니다 → FF GRPOTrainer에 그대로 못 꽂힌다.
우리 inference/forward + 우리 reward + hand-rolled group-advantage (r-mean)/(std+eps) + clipped surrogate ratio=exp(lp-old_lp). FF 소스 무수정. 어댑터에 get_trainable_parameters()(LoRA) 추가. cosmos를 FF의 diffusers-shape에 억지로 맞추는 것보다 안전.
14B video 정책 forward+backward(latent [1,16,24,54,96], 토큰 24×54×96)가 1 B200(178GB) 초과. 원인·해결을 단계적으로 규명:
| 시도 | 결과 | 원인 |
|---|---|---|
| batch K=2 · CFG grad | OOM 178GB | 배치×CFG×14B 활성화 과다 |
| micro-batch 1 (순차 grad 누적) | OOM 178GB | 단일 forward도 초과 |
| CFG uncond detach (값 동일·grad 드롭) | OOM 178GB | cond 단독도 초과 |
| block_wise SAC (full recompute) | PASS ✅ | 블록 입력만 저장 (~155GB) |
SACConfig.get_context_fn()이 None 반환 → ptd_checkpoint_wrapper가 context_fn() 무조건 호출 → TypeError: 'NoneType' object is not callable (rollout forward부터 깸).pipeline.py에서 get_context_fn을 모든 op PREFER_RECOMPUTE인 full-recompute 정책으로 monkeypatch(빌드 전), CosmosV2WPseudoPipelineConfig(sac_mode="block_wise")로 활성화. 기본 predict2_14b_720(mm-style)은 MLP addmm 출력 저장 → OOM.tmp/smoke_grpo5.log (14B, sac_mode=block_wise, K=2, num_steps=8, W=4):
전체 학습 드라이버: smoke는 1-iteration. epoch 루프 + 전체 train_timesteps + checkpoint 저장 + wandb + 실제 prompt/cond-image 데이터셋 → scripts/cosmos_ff/train_grpo.py + .sh(sbm/sbmr 제출).
속도/스케일(Phase D): block_wise는 full recompute라 정책 스텝이 느림(매 스텝 14B 재계산). train_timesteps 전체(≤35)×K×inner_epochs 순차 → 1 iteration이 길다. 완화: K/그룹, train 스텝 subsample, multi-GPU FSDP+context-parallel(cosmos CP 지원), reward async. uncond detach는 grad 근사(정확도 영향 모니터).