Instructions to use vasanth009/vjepa2-vitg-fpc64-256-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use vasanth009/vjepa2-vitg-fpc64-256-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir vjepa2-vitg-fpc64-256-mlx vasanth009/vjepa2-vitg-fpc64-256-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
Add MLX fp16 V-JEPA2 ViT-g encoder (from facebook/vjepa2-vitg-fpc64-256)
Browse filesConverted for Apple Silicon TRIBE v2 fork. Encoder-only, layer hooks match TRIBE recipe. See model card and github.com/vasanthsreeram/tribev2
- README.md +65 -0
- config.json +22 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
library_name: mlx
|
| 4 |
+
tags:
|
| 5 |
+
- mlx
|
| 6 |
+
- vjepa2
|
| 7 |
+
- video
|
| 8 |
+
- apple-silicon
|
| 9 |
+
- tribe
|
| 10 |
+
- fmri
|
| 11 |
+
base_model: facebook/vjepa2-vitg-fpc64-256
|
| 12 |
+
pipeline_tag: feature-extraction
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# V-JEPA2 ViT-g → MLX (TRIBE vision backbone)
|
| 16 |
+
|
| 17 |
+
MLX (fp16) conversion of **[`facebook/vjepa2-vitg-fpc64-256`](https://huggingface.co/facebook/vjepa2-vitg-fpc64-256)** for fast video feature extraction on **Apple Silicon**.
|
| 18 |
+
|
| 19 |
+
Used by the TRIBE v2 Mac fork: [vasanthsreeram/tribev2](https://github.com/vasanthsreeram/tribev2) with the brain encoding head [`facebook/tribev2`](https://huggingface.co/facebook/tribev2).
|
| 20 |
+
|
| 21 |
+
## Files
|
| 22 |
+
|
| 23 |
+
| File | Description |
|
| 24 |
+
|------|-------------|
|
| 25 |
+
| `model.safetensors` | Encoder weights (fp16, MLX layout), ~1.9 GB |
|
| 26 |
+
| `config.json` | ViT-g encoder config (`hidden=1408`, 40 layers, …) |
|
| 27 |
+
|
| 28 |
+
## How this was converted
|
| 29 |
+
|
| 30 |
+
1. Load HF `AutoModel` for `facebook/vjepa2-vitg-fpc64-256` in **fp32**.
|
| 31 |
+
2. Map tensors with [vjepa2-mlx](https://github.com/xocialize/vjepa2-mlx) `convert_state_dict` (Conv3d layout, QKV, etc.).
|
| 32 |
+
3. Keep **`encoder.*` only** (predictor dropped — not used by TRIBE).
|
| 33 |
+
4. Cast to **fp16**, save safetensors with `format=mlx` metadata.
|
| 34 |
+
5. Config: `mlp_ratio=48/11` to match HF (not integer 4).
|
| 35 |
+
|
| 36 |
+
Full write-up: [docs/MLX_CONVERSION.md](https://github.com/vasanthsreeram/tribev2/blob/main/docs/MLX_CONVERSION.md) in the code fork.
|
| 37 |
+
|
| 38 |
+
## Validation
|
| 39 |
+
|
| 40 |
+
Against official torch TRIBE vision-only preds on a 1 s clip (same config):
|
| 41 |
+
|
| 42 |
+
- **Cosine ≈ 0.96**, Pearson **r ≈ 0.96**
|
| 43 |
+
- Encoder-only random input vs HF: cosine ≈ **0.9994**
|
| 44 |
+
- Runtime: ~**11×** faster than torch CPU encode on the test Mac
|
| 45 |
+
|
| 46 |
+
## Usage with TRIBE fork
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
hf download vasanth009/vjepa2-vitg-fpc64-256-mlx --local-dir mlx_weights/V-JEPA2-vitg-fpc64-256
|
| 50 |
+
# then in the tribev2 fork:
|
| 51 |
+
python demo_data/run_efficient.py your.mp4 --open
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from tribev2.mlx_vjepa import encode_clip_frames, install_mlx_video_hooks
|
| 56 |
+
# requires vjepa2_mlx package for the encoder graph
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## License & attribution
|
| 60 |
+
|
| 61 |
+
- Weights derived from Meta V-JEPA2 — **CC-BY-NC-4.0** (non-commercial), same spirit as upstream.
|
| 62 |
+
- Cite the [TRIBE paper](https://arxiv.org/abs/2605.04326) if you use the brain model.
|
| 63 |
+
- Conversion utilities based on [vjepa2-mlx](https://github.com/xocialize/vjepa2-mlx).
|
| 64 |
+
|
| 65 |
+
**Not affiliated with Meta.** This is a community conversion for Apple Silicon inference.
|
config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"hidden_size": 1408,
|
| 3 |
+
"num_hidden_layers": 40,
|
| 4 |
+
"num_attention_heads": 22,
|
| 5 |
+
"mlp_ratio": 4.363636363636363,
|
| 6 |
+
"patch_size": 16,
|
| 7 |
+
"tubelet_size": 2,
|
| 8 |
+
"crop_size": 256,
|
| 9 |
+
"frames_per_clip": 64,
|
| 10 |
+
"in_chans": 3,
|
| 11 |
+
"hidden_act": "gelu",
|
| 12 |
+
"layer_norm_eps": 1e-06,
|
| 13 |
+
"qkv_bias": true,
|
| 14 |
+
"pred_hidden_size": 384,
|
| 15 |
+
"pred_num_hidden_layers": 12,
|
| 16 |
+
"pred_num_attention_heads": 12,
|
| 17 |
+
"pred_mlp_ratio": 4.0,
|
| 18 |
+
"pred_num_mask_tokens": 10,
|
| 19 |
+
"num_pooler_layers": 3,
|
| 20 |
+
"num_labels": 174,
|
| 21 |
+
"hf_repo": "facebook/vjepa2-vitg-fpc64-256"
|
| 22 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80d6056d9a595b8261481f44bb6d8d3a5edfcf6565a267aa2a38918c4bbc7ee8
|
| 3 |
+
size 2024416598
|