Skip to content

Commit 7641a09

Browse files
committed
Document pluggable [video] config and genericize WebVid-10M wording
1 parent c4f3b58 commit 7641a09

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ KempnerForge supports VLM training — images **or video** (a clip is an ordered
148148
- **Mixture-of-Transformers** (`arch = "mot"`, Liang et al. 2024 Algorithm 1): every layer carries per-modality Q/K/V/O projections plus a per-modality FFN; a single global self-attention mixes all modality streams. Image tokens prepend the text sequence (same residual layout as Joint-Decoder); per-modality residual projections are zero-initialized so a fresh MoT block is identity at construction. A warm-start helper (`mot_warm_start_from_text_stack`) translates a JD or text-only checkpoint into per-modality copies — toggle via `[model.vlm].mot_warm_start_from_text` + `mot_warm_start_path`.
149149
- **Mixture of Modality-Aware Experts** (`arch = "moma"`, Lin et al. 2024 arXiv:2407.21770): one shared set of Q/K/V/O projections feeding a global self-attention, plus per-modality MoE FFN groups (paper's optimal default 4 image + 4 text experts per layer). Tokens route deterministically to their modality group (level-1, reusing the same `modality_ids` mechanism MoT uses) and then through a learned expert-choice + Sigmoid router within the group (level-2, with Gumbel-Sigmoid noise during training, paper Eq. 5). Image tokens prepend the text sequence (same residual layout as JD/MoT). v1 supports training only — expert-choice routing is non-causal, so autoregressive generation requires auxiliary routers (paper §2.4) which are deferred to a follow-up.
150150

151-
**Video** works across all four archs with no arch-specific changes: a clip is decoded into frames (sampled by timestamp at a target fps — uniform, with the first and last frame always kept), each frame is encoded and pooled by the connector, and the `F × tokens_per_frame` visual tokens enter the backbone exactly like image tokens. Configure the `[video]` section (`data_root`, `fps`, `max_frames`, `frame_size`); see `configs/train/vlm_video_webvid.toml`.
151+
**Video** works across all four archs with no arch-specific changes: a clip is decoded into frames (by a registered `sampling_policy` — default `uniform`: by timestamp at a target fps, first and last frame kept), each frame is encoded and pooled by the connector, and the `F × tokens_per_frame` visual tokens enter the backbone exactly like image tokens. The data side is **pluggable**`[video].dataset_type` selects a registered dataset builder (`webvid` ships; `dataset_name` picks the corpus within a WebVid-style layout) and `sampling_policy` selects the frame-sampling policy, so new dataset styles / policies are additive registrations. Configure the `[video]` section (`data_root`, `dataset_type`, `dataset_name`, `sampling_policy`, `fps`, `max_frames`, `frame_size`); see `configs/train/vlm_video_webvid.toml`. Video decoding uses PyAV, an optional dependency — install it with `uv sync --group video`.
152152

153153
```bash
154154
# 1-GPU smoke (random encoder, Joint-Decoder)

kempnerforge/data/video_dataset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class WebVidVideoDataset(VideoDataset):
7878
"""Map-style WebVid-style video-caption dataset for VLM training.
7979
8080
Args:
81-
data_root: Dataset root (contains ``raw/webvid-10M/data`` and
81+
data_root: Dataset root (contains ``raw/<dataset_name>/data`` and
8282
``raw/videos``).
8383
split: ``"train"`` or ``"validation"``.
8484
tokenizer_path: HF tokenizer id or local path.
@@ -148,9 +148,9 @@ def _load_manifest(csv_dir: str, max_samples: int) -> tuple[list[str], list[str]
148148
"""Read partition CSVs into (videoid, caption) lists.
149149
150150
Reads partitions in sorted order, stopping early once ``max_samples``
151-
rows are collected so a quick run does not scan the entire 10M-row
152-
corpus. ``videoid`` is kept as a string to preserve the digits used by
153-
the on-disk path mapping.
151+
rows are collected so a quick run does not scan the entire corpus.
152+
``videoid`` is kept as a string to preserve the digits used by the
153+
on-disk path mapping.
154154
"""
155155
import glob
156156

0 commit comments

Comments
 (0)