[eval] fix eval batch < dp_size edge case#62
Merged
erictang000 merged 2 commits intomainfrom Jul 4, 2025
Merged
Conversation
fannie1208
pushed a commit
to vinid/SkyRL
that referenced
this pull request
Aug 19, 2025
# What does this PR do
- removes call to `_remove_tail_data` from eval loop
Previously, we called `_remove_tail_data` for every batch in the eval
loop
```python
for _, prompts in enumerate(self.eval_dataloader):
prompts = self._remove_tail_data(prompts)
...
```
this caused len(prompts) to be 0 if len(prompts) < dp_size, since we do
floor division here:
https://github.com/NovaSky-AI/SkyRL/blob/42d8c74be77940ea49dfc977ca23a5b885d7c986/skyrl-train/skyrl_train/trainer.py#L351
We don't need to `_remove_tail_data` in the eval loop, since we are just
doing generation, which doesn't require explicit sharding, even for
batched generation case, where this is handled cleanly here:
https://github.com/NovaSky-AI/SkyRL/blob/42d8c74be77940ea49dfc977ca23a5b885d7c986/skyrl-train/skyrl_train/inference_engines/inference_engine_client.py#L96
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.
What does this PR do
_remove_tail_datafrom eval loopPreviously, we called
_remove_tail_datafor every batch in the eval loopthis caused len(prompts) to be 0 if len(prompts) < dp_size, since we do floor division here:
SkyRL/skyrl-train/skyrl_train/trainer.py
Line 351 in 8053c90
We don't need to
_remove_tail_datain the eval loop, since we are just doing generation, which doesn't require explicit sharding, even for batched generation case, where this is handled cleanly here:SkyRL/skyrl-train/skyrl_train/inference_engines/inference_engine_client.py
Line 96 in 8053c90