UzairK commited on
Commit
fe9c07d
ยท
verified ยท
1 Parent(s): 38c3887

Update model card

Browse files
Files changed (1) hide show
  1. README.md +64 -14
README.md CHANGED
@@ -1,20 +1,25 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
3
  ---
4
 
5
  # Video-4M Tokenizers
6
 
7
- FSQ tokenizers used by Video-4M to convert each modality into discrete tokens
8
- for training and generation. RGB, depth, surface normals, and optical flow
9
- share one causal VidTok architecture (same config, different weights per
10
- modality). The three self-supervised feature-map modalities (V-JEPA 2,
11
- DINOv2, SigLIP 2) use FSQ tokenizers trained on top of the corresponding
12
- frozen feature extractor.
13
 
14
- Video-4M is trained on 4-second, 17-frame, 4 FPS clips at 128x128
15
- resolution. For the feature-map modalities, features are extracted at each
16
- extractor's native resolution before tokenization: 224x224 for DINOv2 and
17
- SigLIP 2, 256x256 for V-JEPA 2.
 
 
 
 
 
 
18
 
19
  | Modality | Path in repo | Tokens per clip | Vocab size |
20
  |---|---|---|---|
@@ -26,7 +31,52 @@ SigLIP 2, 256x256 for V-JEPA 2.
26
  | DINOv2 | `dinov2/ckpt.ckpt` | 1280 | 16,807 |
27
  | SigLIP 2 | `siglip-2/ckpt.ckpt` | 980 | 16,807 |
28
 
29
- See also: [`EPFL-VILAB/Video-4M-models`](https://huggingface.co/EPFL-VILAB/Video-4M-models)
30
- (the main any-to-any model these tokenizers feed into) and
31
- [`EPFL-VILAB/Video-4M-examples`](https://huggingface.co/EPFL-VILAB/Video-4M-examples)
32
- (example clips, pre-tokenized with these same tokenizers).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - video
5
+ - tokenizer
6
+ - multimodal
7
  ---
8
 
9
  # Video-4M Tokenizers
10
 
11
+ [`๐ŸŒ Project page`](https://video-4m.epfl.ch/) | [`๐Ÿ“„ Paper`](https://video-4m.epfl.ch/assets/Video_4M.pdf) | [`๐Ÿ’ป Code`](https://github.com/EPFL-VILAB/Video-4M) | [`๐Ÿค— Models`](https://huggingface.co/EPFL-VILAB/Video-4M-models) | [`๐Ÿค— Demo`](https://huggingface.co/spaces/EPFL-VILAB/Video-4M)
 
 
 
 
 
12
 
13
+ This repository hosts the modality tokenizers used by [Video-4M](https://huggingface.co/EPFL-VILAB/Video-4M-models), an any-to-any multimodal model for the video domain. Video-4M is trained on tokenized multimodal video data, where each modality is represented as a sequence of discrete tokens and uses its own dedicated tokenizer. We use these tokenizers both to prepare the training data and to convert Video-4M's generations back into raw modality space.
14
+
15
+ ## Tokenizers
16
+
17
+ Let's briefly go through the tokenization details for each modality:
18
+
19
+ - **RGB / Depth / Surface Normals / Optical Flow**: use separate FSQ VAE [VidTok](https://github.com/microsoft/vidtok) tokenizers. They share the same causal VidTok architecture, and each modality tokenizer is finetuned on its modality-specific data.
20
+ - **SigLIP 2 / DINOv2 / V-JEPA 2**: use VidTok tokenizers adapted to accept feature map inputs. We train these feature map tokenizers from scratch.
21
+
22
+ Video-4M operates on 4-second clips (17 frames sampled at 4 FPS) at 128x128 resolution. For the feature map modalities, features are extracted at each extractor's default resolution before tokenization, i.e., 224x224 for DINOv2 and SigLIP 2, and 256x256 for V-JEPA 2.
23
 
24
  | Modality | Path in repo | Tokens per clip | Vocab size |
25
  |---|---|---|---|
 
31
  | DINOv2 | `dinov2/ckpt.ckpt` | 1280 | 16,807 |
32
  | SigLIP 2 | `siglip-2/ckpt.ckpt` | 980 | 16,807 |
33
 
34
+ The remaining modalities are not hosted here:
35
+
36
+ - **Caption / Transcription / Bounding Boxes** share one WordPiece text tokenizer (with special tokens included for quantized bounding-box coordinates and per-frame separators), which is provided directly in our [code repository](https://github.com/EPFL-VILAB/Video-4M).
37
+ - **3D Human Poses** use the pose VQ-VAE tokenizer from [`EPFL-VILAB/4M_tokenizers_human-poses_1k_8`](https://huggingface.co/EPFL-VILAB/4M_tokenizers_human-poses_1k_8).
38
+ - **Class condition** uses a learned embedding layer with 600 entries (one per K600 action category), which is pretrained as part of the Video-4M model.
39
+
40
+ ## Usage
41
+
42
+ The notebooks in our [code repository](https://github.com/EPFL-VILAB/Video-4M/tree/main/notebooks) download these tokenizers automatically. Below, we provide an example of loading the RGB tokenizer directly and using its `encode`/`decode` calls:
43
+
44
+ ```python
45
+ import torch
46
+ from notebooks import pipeline
47
+
48
+ tokenizers = pipeline.load_tokenizers() # downloads the tokenizers from the Hub on first call
49
+ rgb_tokenizer = tokenizers.modality_config["tok_video_rgb@128"]["tokenizer"]
50
+
51
+ # A real clip: [0, 1] pixels, resized to 128x128, then normalized to
52
+ # roughly [-1, 1] (mean=0.5, std=0.5)
53
+ video = torch.randn(1, 3, 17, 128, 128).to(tokenizers.device) # B C T H W, 17 frames
54
+
55
+ with torch.no_grad():
56
+ # Encode: video -> discrete RGB tokens
57
+ _, reg_log = rgb_tokenizer.encode(video, return_reg_log=True)
58
+ tokens = reg_log["indices"].reshape(-1)
59
+ print(tokens.shape) # torch.Size([1280])
60
+
61
+ # Decode: tokens -> reconstructed video
62
+ latents = rgb_tokenizer.regularization.indices_to_codes(reg_log["indices"])
63
+ reconstructed = rgb_tokenizer.decoder(latents)
64
+ print(reconstructed.shape) # torch.Size([1, 3, 17, 128, 128])
65
+ ```
66
+
67
+ If you would like to tokenize your own multimodal video dataset with these tokenizers, please see [README_TOKENIZATION.md](https://github.com/EPFL-VILAB/Video-4M/blob/main/README_TOKENIZATION.md). We also provide example clips, pre-tokenized with these same tokenizers, at [`EPFL-VILAB/Video-4M-examples`](https://huggingface.co/datasets/EPFL-VILAB/Video-4M-examples).
68
+
69
+ ## Citation
70
+
71
+ If you find these tokenizers useful, please consider citing:
72
+
73
+ ```
74
+ @article{video4m2026,
75
+ title={{Any-to-Any Video Modeling: Modeling the World by Traversing Time and Modalities}},
76
+ author={Khattak, Muhammad Uzair and Kim, Won Jun and Abbassi, Reza and Havolli, Albias and Murphy, Michael and Zadeh, Amir and Li, Chuan and Naeem, Muhammad Ferjad and Kar, O\u{g}uzhan Fatih and Bachmann, Roman and Atanov, Andrei and Tombari, Federico and Zamir, Amir},
77
+ journal={arXiv preprint},
78
+ year={2026},
79
+ }
80
+ ```
81
+
82
+ Our tokenizers are based on [VidTok](https://github.com/microsoft/VidTok). We thank the authors for releasing their code.