Commit 1faaf6a
Add V-JEPA 2 (Meta FAIR) distributed training test case (#1035)
* Add V-JEPA 2 distributed training test case for p5en (H200)
Add V-JEPA 2 (Meta FAIR) ViT-g/16 1B-param self-supervised video model as
a new PyTorch test case with Slurm and Kubernetes support.
Includes:
- Dockerfile based on nvcr.io/nvidia/pytorch:25.03-py3 (CUDA 13 + Python 3.11)
- Slurm sbatch scripts for benchmark (200 iters) and full pre-training (800 epochs)
- Kubernetes PyTorchJob manifest for EKS clusters
- Thin srun-compatible launcher (run_train.py) that calls app.vjepa.train.main()
directly, avoiding the subprocess world_size=1 bug in app/main.py
- Synthetic dataset generator for benchmarking without SSv2 download
- SSv2 dataset preparation scripts and decord verification
- YAML configs for ViT-g/16 with DDP, BF16, and activation checkpointing
* Add V-JEPA 2.1 distributed training test case with image+video co-training
Add V-JEPA 2.1 (Meta FAIR) ViT-g/16 1B-param benchmark alongside the existing
V-JEPA 2 test case. V-JEPA 2.1 introduces Dense Predictive Loss, Deep
Self-Supervision (4 intermediate layers), doubled predictor depth (24 vs 12),
and image+video co-training with 50/50 rank split.
Includes:
- Dockerfile and Enroot container setup (shared base with V-JEPA 2)
- Slurm sbatch scripts with /workspace code overlay for latest vjepa2 repo
- Kubernetes PyTorchJob manifest for EKS clusters
- Synthetic image generator for co-training benchmarks
- run_train.py launcher using app.scaffold.main() for dynamic dispatch
- YAML configs with img_data, img_mask, and rank_ratio settings
Key discovery: the container must have the latest vjepa2 repo code (post
March 2026) for app/vjepa_2_1/ to be available. The sbatch scripts mount
updated code at /workspace to overlay the container's stale PYTHONPATH.
* Add B200 (Blackwell) benchmark sbatch scripts for V-JEPA 2 and 2.1
The Dockerfile-based container (pytorch:25.03-py3) ships NCCL 2.25 and
an older aws-ofi-nccl plugin that are incompatible with B200 EFA
networking. The B200 scripts use a NeMo container with NCCL 2.29+ and
a matching OFI/EFA/libfabric stack instead, with V-JEPA dependencies
installed to shared storage and added to PYTHONPATH at runtime.
* Increase synthetic dataset default to 50K for accurate benchmarks
Benchmarking on B200 revealed that 5,000 synthetic samples caused frequent
data loader re-initialization between epochs, inflating V-JEPA 2.1 iteration
times by up to 4x (15,300ms vs 4,075ms with 50K samples). V-JEPA 2 was less
affected but still improved from 1,637ms to 1,457ms.
Changes:
- Default synthetic video count: 5,000 -> 50,000 (both V-JEPA 2 and 2.1)
- Default synthetic image count: 5,000 -> 50,000 (V-JEPA 2.1)
- Add OpenCV (cv2) fallback for video generation in environments without ffmpeg
- Add dataset sizing guidance to benchmark configs and READMEs
* Add nsys profiling scripts for V-JEPA 2 and 2.1 on B200
Add rank-selective nsys profiling infrastructure:
- nsys_wrapper.sh: profiles only rank 0 via SLURM_PROCID check
- nsys_profile_b200.sbatch: configurable via NSYS_PROFILE_DIR and CONFIG
env vars to save each optimization phase to a separate folder
- Document profiling workflow in both READMEs
* Add optimized config for V-JEPA 2 with torch.compile and no activation checkpointing
Provide an optimized benchmark config for B200 GPUs:
- compile_model: true for fused kernels (~20% GPU speedup)
- use_activation_checkpointing: false (trades ~95 GB vs ~33 GB memory)
- num_workers: 20 for higher data prefetch
Tested at 1,125 ms/iter vs 1,457 ms baseline (23% improvement).
* Disable GradScaler for BF16 training to remove unnecessary overhead
BF16 has the same dynamic range as FP32, so GradScaler's loss scaling
is pure overhead. Monkey-patch GradScaler to enabled=False in both
run_train.py launchers when meta.dtype is bfloat16, eliminating the
scale/unscale/step/update cycle per iteration.
* Add FSDP training variant for V-JEPA 2.1 to reduce memory and enable higher throughput
Replace DDP with FSDP (SHARD_GRAD_OP / ZeRO-2) for the encoder and
target_encoder in V-JEPA 2.1, sharding gradients and optimizer states
across ranks. This saves ~15 GB/GPU, enabling activation checkpointing
to be disabled on B200 GPUs for higher throughput. The predictor remains
DDP-wrapped (small model, needs find_unused_parameters).
* Add optimization sweep, fix compile_model config bug, and enhance run_train.py
- Fix compile_model placement: move from meta: to model: section where
upstream train.py actually reads it (was silently never enabled)
- Add env-var-driven optimizations to run_train.py: fused AdamW, TF32,
compile mode override, gradient_as_bucket_view, prefetch_factor
- Add B200 optimization sweep sbatch (Phase A-D with nsys profiling)
- Add nsys profiling sbatch scripts for H200 (vjepa2 and vjepa2.1)
- Fix container-workdir from /vjepa2 to /workspace in benchmark sbatch
- Add .gitignore to exclude benchmarks/ and profiling/ from repo
* Parallelize synthetic dataset generation scripts with --workers flag
* Add V-JEPA 2.1 optimization sweep with phased configs and env-var hooks
* Fix V-JEPA 2.1 batch sizes for rank_ratio=0.5 scaling and sbatch log paths
* Remove incorrect MFU calculation from parse_benchmark.py and add --gpu_type flag
The 6*N*D FLOP formula overestimates training FLOPs by ~2x for JEPA architectures
because the context encoder only processes visible tokens (~15% of the sequence)
while the target encoder runs forward-only (no backward pass).
Replace with samples/sec as the primary throughput metric. Add --gpu_type flag
(h200/b200) with correct BF16 peak specs (989.4 / 2250 TFLOPS). Fix V-JEPA 2.1
script title and update README parse examples to use new flag.
* Fix PR review issues: NCCL_SOCKET_IFNAME, license headers, shell strictness, pinned versions
- Remove ,eth from NCCL_SOCKET_IFNAME exclusion list for correct TCP bootstrap
- Add missing MIT-0 license headers to .gitignore, README.md, and config YAMLs
- Change set -ex to set -euo pipefail in all sbatch and shell scripts
- Pin EFA_INSTALLER_VERSION to 1.47.0 in both Dockerfiles (was 'latest')
- Replace :latest image tags with :vjepa2 and :vjepa2.1 in K8s manifests
- Use yaml.SafeLoader instead of yaml.FullLoader in run_train.py and run_train_fsdp.py
* Pin Dockerfile dependencies, fix stale repo URL, and pin vjepa2 git clone
- Pin all pip packages to tested versions from cluster container freeze
- Pin vjepa2 git clone to commit 204698b4 (latest as of Mar 23, 2026)
- Fix stale repository URL from aws-samples to awslabs in both READMEs
* Update 3.test_cases/pytorch/vjepa2.1/slurm/optim_sweep_b200.sbatch
* Address PR review: deduplicate scripts, fix PYTHONPATH bug, move FSDP to experimental
- Fix ${PYTHONPATH:-} in all B200 sbatch scripts to prevent unbound variable errors
- Deduplicate shared scripts (5 files) in vjepa2.1/ with symlinks to vjepa2/
- Parameterize parse_benchmark.py with --model_name flag for both V-JEPA 2/2.1
- Remove optim_sweep_b200.sbatch (developer tooling with hardcoded internal paths)
- Move FSDP code to experimental/ subdirectories (documented as ~2x slower than DDP)
- Add explanatory comments to Dockerfile || true for libnccl-dev
- Add B200 GPU setup prerequisites to both READMEs
- Fix dead references to gitignored benchmarks/ directory
* fix: address PR review - remove experimental FSDP, orphan configs, fix Dockerfiles
- Remove experimental/ FSDP path (scripts, configs, slurm) from vjepa2.1
FSDP was benchmarked at ~2x slower than DDP; removed per reviewer request
- Remove orphan phase configs (phase1, phase4) no longer used by any workflow
- Fix Dockerfiles: remove || true on libnccl-dev install, add B200 note
- Fix K8s image tags: use pinned commit hash (204698b4) instead of confusing
repo:variant naming
- Add mkdir -p for log directories in all sbatch scripts for consistency
- Add directory structure note explaining vjepa2/ and vjepa2.1/ separation
mirrors upstream facebookresearch/vjepa2 app structure
- Fix README inconsistencies: remove benchmarks/ dir references (not committed),
fix section numbering, fix batch size claim, update nsys examples
---------
Co-authored-by: Keita Watanabe <mlkeita@amazon.com>1 parent 45e8f55 commit 1faaf6a
39 files changed
Lines changed: 4088 additions & 0 deletions
File tree
- 3.test_cases/pytorch
- vjepa2.1
- configs
- kubernetes
- scripts
- slurm
- vjepa2
- configs
- kubernetes
- scripts
- slurm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
0 commit comments