Models · Feature backbones

V-JEPA 2

V-JEPA 2 (Meta, 2025): a self-supervised video encoder that turns a clip (or one photo) into patch features capturing motion and scene content. Encoder only, no classifier head. MIT code and weights (Apache-2.0 for the giant).

experimental Fork of facebookresearch/vjepa2@204698b · backends: portable, kernels

Checkpoint

Paper 2025 Added in 0.4.0 Evaluated with 0.4.0

Kernels, RTX 5060 Ti 16 GB 5.13 ms 224x224, fp16
vs the faster original 12.6× original fp32: 64.6 ms
Peak memory 617 MiB original: 1,410 MiB
Accuracy vs original fp32 +0.06 portable top-1 %, ImageNet-1k val (33.28 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import features

model = features.load("vjepa2-vitl-fpc64-256")  # fastest backend that runs here
result = model("photo.jpg")

# result fields: last_hidden_state, pooler_output, hidden_states
last_hidden_state = result.last_hidden_state  # a torch tensor
arrays = result.numpy()  # the tensor fields as NumPy arrays: arrays["last_hidden_state"]
result.backend  # what ran: mode, device, dtype
Other ways to run it
  • Backend: features.load("vjepa2-vitl-fpc64-256", mode="kernels") # or "portable", "auto" (default)
  • Precision: features.load("vjepa2-vitl-fpc64-256", dtype="float32") # full precision: slower, portable only
fastforks bench vjepa2-vitl-fpc64-256

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32original default fp32 (HF transformers VJEPA2Model, sdpa)fp32 64.6–1,410 MiB/1,428 MiB1.40.49
Original fp16torch.autocast(float16) around the HF transformers VJEPA2Model forward (sdpa)fp16 82.10.79×1,410 MiB/1,428 MiB1.40.29
Portable fp32fp32not measured ––––
Portable 9.636.7×717 MiB/746 MiB1.00.09
Kernelsfp16 5.1313×617 MiB/626 MiB1.50.16
Portable + torch.compile 4.8313×656 MiB/666 MiB12 (build)–
TensorRT fp16fp16 2.9822×614 MiBenginenot comparable37 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-28 to 2026-12-02. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

Not measured on other devices yet.

Licence and weights

Commercial use allowed

Code
MIT LICENSE
Weights
MIT source
Training data
VideoMix22M: Something-Something v2, Kinetics 400/600/700, HowTo100M, YT-Temporal-1B and ImageNet, self-supervised (no labels), per the paper

Our reading of the licences, not legal advice.

Weights

vjepa2-vitl-fpc64-256/model.safetensors 1.3 GB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download vjepa2-vitl-fpc64-256).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

ImageNet-1k val

kNN top-1 % (k = 20, 10000 labelled / 5000 test images)

Rundtypetop-1 % ↑Δ top-1 % vs fp32 originalimagesms / image
Original fp32fp3233.28 reference 5000 17.7
Original fp16not measured
Portable fp32fp3233.24 −0.04 5000 13.6
Portablefp1633.34 +0.06 5000 3.86
Kernelsnot measured

Two disjoint seeded subsets of the val folders; each image shorter side 256 (bicubic), centre crop 224, the CLS / pooled feature; cosine kNN, vote weighted by similarity. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-30; portable fp32, portable: RTX 5060 Ti, torch 2.14.1+cu130, fastforks c0606f892, 2026-11-30.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.01 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 and p99 <= 0.5 (absolute error of the output last_hidden_state).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.01 not recorded
GPU default dtypes, mean |diff|≤ 0.05 0.03809
GPU default dtypes, p99 |diff|≤ 0.5 0.31906

Recorded for vjepa2-vitl-fpc64-256 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-12-02, with these kernels: dpt_fusedfastbbvjepa2_ops

Details

V-JEPA 2 (Assran et al. 2025, Meta): self-supervised video ViT encoders (3D rotary position embedding, 2-frame tubelets, no cls token) trained by latent prediction on over a million hours of video; clip features at any size. `model.video(frames)` encodes a clip (T a multiple of 2) to its token grid `[T/2 * h * w, C]`; an image is repeated to one tubelet. Encoder only: the predictor, the action-conditioned world model and the SSv2 / Diving48 classifier heads are not ported.

Input / output
Input: one RGB image. Output: dense patch features and a pooled image feature.
Input size
any H x W >= 1, resized or padded inside the model; tested up to 3000x4000 (2,557 MiB allocated)
Outputs
last_hidden_state, pooler_output, hidden_states
Checkpoint
hidden=1024, depth=24, heads=16, mlp=4096
CUDA kernels
  • vjepa2_ops
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
  • dpt_fusedfused fp16 matrix multiplies and convolutions for DINOv2 backbones and DPT depth heads

Limitations

  • Encoder only: the checkpoints also hold the pre-training predictor, which is not loaded; the action-conditioned world model (V-JEPA 2-AC) and the attentive-probe classifier heads are not ported.
  • No cls token and no pooler in the model: `pooler_output` is the mean of the final-LayerNorm tokens (this port's choice) and `num_prefix_tokens` is 0. An image call repeats the image to one 2-frame tubelet, as Hugging Face does for one frame.
  • Rotary position ids follow the actual `(T/2, h, w)` grid (Hugging Face fixes the square 256 x 256 grid; identical there), so other sizes run but lie outside the training distribution (256 px, 64 frames). Attention is global: 64 frames at 256 px are 8192 tokens.
  • Apple MLX (`device="mlx"`) is hand-written, float32 or fp16, with no custom kernels; `mode="kernels"` is CUDA fp16 only (head dim 64) and has no exportable `module()`.
Full reference, generated from the repository

V-JEPA 2 (Meta, 2025): a self-supervised video encoder that turns a clip (or one photo) into patch features capturing motion and scene content. Encoder only, no classifier head. MIT code and weights (Apache-2.0 for the giant).

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
vjepa2-vitl-fpc64-256synthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
64.6
82.1
9.63
5.13
4.83
2.98
1410 / 1428
1410 / 1428
717 / 746
617 / 626
656 / 666
1228 / 1238
vjepa2-vitg-fpc64-256synthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
104
107
15.2
14.2
13.7
9.40
4196 / 4536
4196 / 4536
2081 / 2228
1969 / 1988
2017 / 2026
3931 / 3950
Details
  • Original code: https://github.com/facebookresearch/vjepa2 at 204698b45b37
  • Code licence: MIT (permissive); files: LICENSE
  • Weights licence: MIT
    • vjepa2-vitg-fpc64-256: Apache-2.0
  • Licence evidence: https://huggingface.co/facebook/vjepa2-vitl-fpc64-256/blob/b3c1679b7c34d3255ef3547f27c7b226aefab26f/README.md (metadata: license mit)
  • Training data: VideoMix22M: Something-Something v2, Kinetics 400/600/700, HowTo100M, YT-Temporal-1B and ImageNet, self-supervised (no labels), per the paper
  • Kernel libraries: vjepa2_ops, fastbb, dpt_fused
  • Variants: vjepa2-vitl-fpc64-256, vjepa2-vitg-fpc64-256
  • Outputs: last_hidden_state, pooler_output, hidden_states
  • Input size: any H x W >= 1, resized or padded inside the model
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): vjepa2-vitl-fpc64-256 3000x4000 (2.5 GiB peak allocated, 2.8 reserved); vjepa2-vitg-fpc64-256 3000x4000 (4.4 GiB peak allocated, 4.9 reserved)
  • vjepa2-vitl-fpc64-256 224x224, first call: portable + torch.compile 12 s (cold Inductor cache), TensorRT fp16 37 s (ONNX + engine).
  • vjepa2-vitg-fpc64-256 224x224, first call: portable + torch.compile 19 s (cold Inductor cache), TensorRT fp16 74 s (ONNX + engine).
  • vjepa2-vitl-fpc64-256 original (fp32) 224x224: original default fp32 (HF transformers VJEPA2Model, sdpa)
  • vjepa2-vitl-fpc64-256 original 224x224: torch.autocast(float16) around the HF transformers VJEPA2Model forward (sdpa)
  • vjepa2-vitg-fpc64-256 original (fp32) 224x224: original default fp32 (HF transformers VJEPA2Model, sdpa)
  • vjepa2-vitg-fpc64-256 original 224x224: torch.autocast(float16) around the HF transformers VJEPA2Model forward (sdpa)
  • vjepa2-vitl-fpc64-256 load / first call: original 1.37 s / 0.295 s, portable 1.02 s / 0.085 s, kernels 1.5 s / 0.162 s
  • vjepa2-vitg-fpc64-256 load / first call: original 1.25 s / 0.263 s, portable 2.2 s / 0.071 s, kernels 2.22 s / 0.158 s
  • Protocol, median of 5 after 3 warm-up, uint8 CUDA input, card defaults; peak = max over the first call and the timed calls

Measured

Two disjoint seeded subsets of the val folders; each image shorter side 256 (bicubic), centre crop 224, the CLS / pooled feature; cosine kNN, vote weighted by similarity. Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32portableportable fp32note
vjepa2-vitl-fpc64-256ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images)33.2833.3433.24
vjepa2-vitg-fpc64-256ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images)45.3845.4045.28

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks c0606f892, 2026-11-30.

Parity

CPU, float32: max |diff| <= 0.01 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 and p99 <= 0.5 (absolute error of the output last_hidden_state).

variantkernels error vs original, mean / p99GPU, torchkernels used
vjepa2-vitl-fpc64-2560.03809 / 0.31906RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120, fastbb@7d058322634d:sm_120, vjepa2_ops@cd5139f56468:sm_120
vjepa2-vitg-fpc64-2560.05547 / 0.5274RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120, fastbb@7d058322634d:sm_120, vjepa2_ops@cd5139f56468:sm_120

Limitations

  • Encoder only: the checkpoints also hold the pre-training predictor, which is not loaded; the action-conditioned world model (V-JEPA 2-AC) and the attentive-probe classifier heads are not ported.
  • No cls token and no pooler in the model: pooler_output is the mean of the final-LayerNorm tokens (this port's choice) and num_prefix_tokens is 0. An image call repeats the image to one 2-frame tubelet, as Hugging Face does for one frame.
  • Rotary position ids follow the actual (T/2, h, w) grid (Hugging Face fixes the square 256 x 256 grid; identical there), so other sizes run but lie outside the training distribution (256 px, 64 frames). Attention is global: 64 frames at 256 px are 8192 tokens.
  • Apple MLX (device="mlx") is hand-written, float32 or fp16, with no custom kernels; mode="kernels" is CUDA fp16 only (head dim 64) and has no exportable module().

Example output

No example rendered for this checkpoint yet.