fix: (1) skipped last step (2) redundant validation and logging #409
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.
This PR solves these 2 following problems.
Last step skipped
self.global_steps += 1
before ifself.global_steps >= self.total_training_steps
makes the last step skipped.We start from step 1, and we expect
self.total_training_steps
in total.verl/verl/trainer/ppo/ray_trainer.py
Lines 999 to 1001 in 82b38e2
When
self.global_steps == self.total_training_steps-1
:we have only executed
self.total_training_steps-1
stepsself.global_steps
is updated toself.total_training_steps
self.global_steps >= self.total_training_steps
is satisfied, and the training ends.Therefore, we should put
self.global_steps += 1
at lastredundant validation and logging
If
self.total_training_steps % self.config.trainer.test_freq == 0
:self._validate()
will be executed twiceverl/verl/trainer/ppo/ray_trainer.py
Line 984 in 82b38e2
verl/verl/trainer/ppo/ray_trainer.py
Line 1005 in 82b38e2
logging will also be executed twice
verl/verl/trainer/ppo/ray_trainer.py
Line 985 in 82b38e2
verl/verl/trainer/ppo/ray_trainer.py
Line 997 in 82b38e2
verl/verl/trainer/ppo/ray_trainer.py
Line 1007 in 82b38e2