Width-Concat Refactor · Wan 2.2 Adaptation

EgoX2 (rgb) — Weekly Progress

260406-260412 · 7 commits · −2201 lines · learning-ready baseline restored

Commits7
Lines−2201
SLURM Job1
Base ModelWan 2.2
Statuslearn-ready

Research Goal

Wan 2.2 I2V A14B 모델 기반으로 exo 비디오 → ego 비디오 예측. 방식: exo latent 옆에 ego noise latent를 width-wise concat해서 transformer에 넣고 ego 영역만 denoising. 기존 EgoX(Wan 2.1 + ego_Prior + GGA)의 복잡한 geometry-guided attention 경로를 벗겨내고, Wan I2V 표준 image-conditioning 패턴으로 단순화한 베이스라인을 확보하는 것이 이번 작업의 목표.

이번 주 핵심 진전 (rgb 브랜치 대규모 리팩토링)

1. Dead code + GGA / ego_prior / depth / camera 경로 전체 제거

Why: 정적 점검에서 리팩토링 전 학습 코드가 실제로는 돌아가지 않는 상태임이 드러났다. WanTransformer3DModel.forward**kwargs를 받지 않는데 기존 compute_lossattention_GGA=..., cos_sim_scaling_factor=..., do_kv_cache=True를 넘기고 있었음. 즉 첫 forward에서 즉시 TypeError가 날 상황. 학습 가능 상태로 복구하는 작업이 필요했다.

How (5단계 commit 시퀀스):

  1. bfa0929 — dead files 삭제 (custom_transformer.py 705줄, demb_samerope_trainer.py 725줄). −1430줄.
  2. 291149f — GGA / ego_prior / depth / camera 경로 전 영역 제거. latent_condition의 ego 슬롯을 first-frame + zero temporal padding 패턴으로 재설계. square-ego 가정(ego_width=height) 파기. 모든 해상도 리터럴을 Args.exo_width/Args.ego_width로 승격. −870줄 (+722/-1592).
  3. d64e0e1core/finetune/models/_base/width_concat.py 공용 헬퍼 5개 추출 (pure refactor). +115줄.
  4. 9ce0a88 — README 갱신. −72줄.
  5. 4951484Wan 2.2 I2V A14B 어댑테이션. CLIP 조건부 로드, transformer_2 dispatch 보류, pipeline 수동 조립. +56줄.

Result (정량):

파일BeforeAfterΔ
custom_transformer.py7050−100%
demb_samerope_trainer.py7250−100%
sft_trainer.py968~540−44%
wan_dataset.py595~270−55%
datasets/utils.py373240−36%
infer.py282~115−59%
core/inference/wan.py9968−31%
_base/width_concat.py0152신규
누적 Δ−2201줄

2. Wan VAE 실측 검증 — first-frame conditioning이 pretrained 분포와 정합

Why: ego 슬롯에 어떤 latent를 넣을지 결정해야 했다. 후보: (a) ego=0, (b) [exo_clean | random_ego], (c) conditioning 채널 자체 제거. user 지시로 Wan I2V의 표준 image-conditioning 패턴([ff, 0, ..., 0])을 쓰기로 결정했지만, 이게 pretrained VAE 분포와 정합한지 검증 필요.

How: 1×3×49×64×64 dummy로 두 입력을 VAE encode하여 비교: [ff, 0, 0, ..., 0] vs [ff repeated 49]. 두 결과의 t=0 latent abs diff 측정.

Result: t=0 latent abs diff mean 0.000000, max 0.000000 (bit-identical). 즉 픽셀 공간 first-frame + zero temporal padding이 VAE encode 후 t=0 위치에 ff를 정확히 복원. vae_scale_temporal=4, vae_scale_spatial=8, z_dim=16 확정 (49 frames → 13 latent frames).

3. 데이터셋 분리 + yaml config 시스템 (commits a33e56a, 23779b4)

Why: EgoExo4D와 DROID 두 데이터셋을 동일 width-concat 파이프라인에서 돌리려면 dataset 클래스 분리가 필수. 기존 wan_dataset.py는 EgoExo4D 메타 스키마 + depth/camera 경로에 종속. 또한 argparse가 모든 필드를 CLI required로 잡고 있어서 실험별 설정 차이를 다루기 힘들었다.

How:

Result: 두 yaml 모두 Args.parse_args() 로드 검증 통과. EgoExo4D는 49×448×1232 (exo=784, ego=448), DROID는 49×432×1536 (exo=768, ego=768)로 확정. 데이터셋 추가가 파일 1개 추가로 가능해짐.

Strengths & Weaknesses

Strengths

Weaknesses

Takeaway & Next Steps

의미: 이번 주는 EgoX2의 rgb 브랜치를 "원래 안 돌던 코드 → 돌 수 있는 베이스라인"으로 복구한 큰 정리 작업. 코드는 −44~−59%씩 줄었고 향후 다른 모델/해상도로 포팅할 때 헬퍼를 그대로 재사용할 수 있다. Wan 2.2 어댑테이션까지 끝나서 다음 단계는 학습 검증.

다음 단계 — 즉시 해결 필요

중기