Skip to content

Conversation

@Datta0
Copy link
Collaborator

@Datta0 Datta0 commented Oct 22, 2025

trl update seems to have broken GRPO for a while now. This should fix it.

What is happening?

Initially we patched _prepare_inputs() so that llm generate call takes place in that function and we sleep vllm after the function. But newer (since September) trl versions seem to have _generate_and_score_completions which themselves call vllm's .generate and then immediately proceed to forward pass the inputs.

What to do?

So we need to call sleep() before the forward pass is called. Hence the only logical place being right after self.llm.generate

Exception:

Since v0.23.0, trl has a sleep and wakeup support. So we do not want to perform any additional calls that may incur latency. Hence this check

Sample UnslothGRPOTrainer.py file after this patch

image

@danielhanchen danielhanchen merged commit 58d4b66 into unslothai:main Oct 22, 2025
@Datta0 Datta0 mentioned this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants