You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/tutorials/vision_language_rl.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ The generator handles both patterns transparently once `generator.vision_languag
85
85
Multimodal support in SkyRL is still early. The current VLM path runs on the FSDP backend and supports multi-image, multi-turn rollouts, but several features are not yet ready:
86
86
87
87
-**Sample packing** — each VLM family handles images and positional embeddings differently, so packing needs per-model support or a different abstraction.
88
-
-**Megatron backend** — the VLM path has not been wired through Megatron yet.
88
+
-**Megatron backend** — the VLM path has not been wired through Megatron yet, but SFT is supported (see [`run_sft_megatron_vlm.sh`](https://github.com/NovaSky-AI/SkyRL/blob/main/skyrl-train/examples/train/sft/run_sft_megatron_vlm.sh))
89
89
-**Context parallelism (CP)** — many VLM tasks are long context, long horizon tasks which get worse as more images are included.
90
90
-**Step-wise training** — step-wise training is currently undergoing rapid development in SkyRL, and will eventually support multimodal models.
Trains `Qwen/Qwen3-0.6B` on 4 GPUs with Megatron (TP=2, PP=2). Key defaults: max length 512, batch size 4, 10 training steps.
28
28
29
+
### VLM SFT (Megatron, multi-GPU)
30
+
31
+
```bash
32
+
# One-time: build a small messages-format dataset from HuggingFaceM4/the_cauldron
33
+
uv run examples/train/sft/prepare_cauldron_vlm.py --output-dir $HOME/data/cauldron-vlm
34
+
35
+
bash examples/train/sft/run_sft_megatron_vlm.sh
36
+
```
37
+
38
+
Fine-tunes the vision-language model `Qwen/Qwen3-VL-2B-Instruct` on 4 GPUs with the Megatron backend (pure DP=4 by default). Scale to larger models by overriding `megatron_config.tensor_model_parallel_size` / `pipeline_model_parallel_size`.
39
+
40
+
VLM SFT mirrors the constraints of the FSDP VLM RL path (3D RoPE + image-token positions tie image tensors to specific sequence positions), so the following are required and enforced:
41
+
42
+
-`remove_microbatch_padding=false` — no microbatch padding / sequence packing.
43
+
-`megatron_config.sequence_parallel_size=1` and `megatron_config.context_parallel_size=1`.
44
+
-`train_on_what=last_assistant_message` — VLM tokenization only supports last-assistant training.
45
+
46
+
Mixed text+image batches are not supported: every sample in a VLM batch must carry image(s). The dataset must use the chat `messages` format with image content encoded as `{"type": "image", "image": <data-uri>}` (see `prepare_cauldron_vlm.py`).
0 commit comments