Repository navigation
Commit c97673e
committed
[fix][generators] VLM generator: honor generator.chat_template in renders + image-token/feature integrity guard
Fixes NovaSky-AI#2075. The VLM generator's deferred obs-token extraction requires
each re-render to be a token-prefix extension of the previous one (the
NOTE in agent_loop). Thinking-model vendor templates strip reasoning
from history and violate that, silently corrupting trajectories --
loud only when images make the token/feature pairing fail inside the
model forward.
* _render_conversation forwards chat_template / chat_template_kwargs
(both already exist on the base generator via generator.chat_template,
including source=file; the VLM path never sent them). A thinking-
preserving template restores the prefix property and makes training
on-policy. Servers need trust_request_chat_template for per-request
templates.
* Trajectory-end integrity guard via the render response's own
mm_placeholders: actionable per-trajectory error instead of the
opaque torch._check deep into training.
Validated end to end: Qwen3.5-9B multi-turn computer-use GRPO (64-turn
episodes with screenshots), 6 GRPO steps, one epoch, completed cleanly
with a thinking-preserving template supplied via source=file; the same
setup crashed at the first policy update twice without these changes
(traces in NovaSky-AI#2075).1 parent cb5334c commit c97673e
2 files changed
Lines changed: 79 additions & 3 deletions
File tree
- skyrl/train/generators
- tests/train/generators
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
65 | 76 | | |
66 | 77 | | |
67 | 78 | | |
| |||
129 | 140 | | |
130 | 141 | | |
131 | 142 | | |
| 143 | + | |
132 | 144 | | |
133 | 145 | | |
134 | 146 | | |
135 | 147 | | |
136 | 148 | | |
137 | 149 | | |
| 150 | + | |
138 | 151 | | |
139 | 152 | | |
140 | 153 | | |
| |||
209 | 222 | | |
210 | 223 | | |
211 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
212 | 247 | | |
213 | 248 | | |
214 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments