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
{{ message }}
Repository navigation
GRPO: forward TRL 1.7 VLM kwargs (spatial_shapes / num_tiles / image_position_ids) in the logprob replacement #6960
Unsloth's optimized GRPO _get_per_token_logps_and_entropies replacement (unsloth/models/rl_replacements.py) does not forward the newer TRL 1.7 multimodal kwargs spatial_shapes, num_tiles, and image_position_ids when recomputing per-token logprobs.
TRL 1.7's own _get_per_token_logps_and_entropies accepts these and threads them into model_inputs (per-tile / per-image slicing), so for VLM architectures that require them (for example LFM2-VL and other image-position / tiled vision models), GRPO under Unsloth omits required vision inputs when recomputing old/ref logprobs, causing failures or incorrect logprobs.
The common pixel_values + image_grid_thw path (Qwen2/2.5-VL etc.) already forwards correctly; this only affects models that depend on the newer fields.
Why it is tracked separately
Forwarding these correctly means replicating TRL's per-tile slicing (num_tiles cumsum for spatial_shapes, image_position_ids[img_start:img_end]) through the two chunk-construction paths in the replacement. That cannot be validated on the CPU-only fake-run canary and needs a real tiled VLM (for example LFM2-VL) under GRPO on GPU to confirm, so it is intentionally out of scope for the TRL >= 1.7 crash/arity fix in #6904.
Acceptance
Extract spatial_shapes / num_tiles / image_position_ids from kwargs in the replacement.
Slice them per chunk consistently with pixel_values / image_grid_thw, matching TRL 1.7's boundaries.
Validate logprob parity against stock TRL GRPO on a tiled VLM.
Activity
Forward every GRPO vision kwarg, and accept an image column holding a…
Forward every GRPO vision kwarg, and accept an image column holding a…
Share one GRPO multimodal key tuple and chunker between both logprob …
GRPO: forward every vision kwarg, and accept an image column holding …
GRPO: forward every vision kwarg, and accept an image column holding …