Repository navigation
Let TRL AsyncGRPOTrainer train Unsloth models; fix GRPO vision rewards for tool images and TRL 1.15 - #13205
Merged
Conversation
…inputs on tool images and TRL 1.15
…a picklable tokenizer
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Member
Author
|
pre-commit.ci run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things for agent RL with TRL's newer trainers.
1.
trl.experimental.async_grpo.AsyncGRPOTrainerwith Unsloth modelsOn main it rejects any model object: TRL only takes a model id and loads it with flash-attn 3.
patch_trl_async_grpo(called fromPatchFastRL):Noneconfig);position_idsresets, so sequences attended to each other. Unsloth backbones now get per-sequence lengths fromposition_ids. Scoring one sequence inside a packed row vs alone: logprobs differed by up to 4.70 before, identical after. A non-Unsloth model on sdpa gets a clear error instead of silently wrong training; flash attention is left to TRL;3 steps, Qwen3-0.6B LoRA, vLLM server on a second GPU: finite losses, ~55 sequences per row, the LoRA adapter synced to the server 7 times. Needs TRL >= 1.14 (1.13's AsyncGRPO has no LoRA support), so it pairs with #13203.
2. GRPO vision reward inputs
Unsloth rewrites TRL's reward call to
prompts_text/completions_textwhen images are present. TRL's tool-image branch never buildsprompts_text(every image-returning tool crashed on its first tool round), and TRL 1.15 droppedcompletions_text(every image GRPO run would crash on 1.15). The rewrite now keeps TRL's inputs whenprompts_textis absent and rebuildscompletions_textthe way TRL 1.13 did; TRL 1.13 behaviour is unchanged. Qwen3-VL-2B with a tool returning an image: 8 tool calls, tool images reach the model.Also checked, no change needed
OpenReward (local server from the SDK) and Harbor (
HarborBashEnvwith a fake sandbox) environments throughenvironment_factorywork as-is withfast_inferenceFalse and True.Tests:
tests/test_async_grpo_patch.py,tests/test_grpo_vision_reward_inputs.py(CPU). Regression smoke A/B (merge base vs this stack, TRL 1.13): 0 regressions.Related: #10580, #3528