[train] Add explicit finish calls for tracker when training ends#1198
Merged
[train] Add explicit finish calls for tracker when training ends#1198
finish calls for tracker when training ends#1198Conversation
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces an explicit .finish() call for trackers at the end of training sessions. This is a solid improvement over relying on __del__, which is not guaranteed to be called, ensuring that all tracking data is properly saved. The implementation refactors the cleanup logic into a new finish() method within the Tracking class and integrates this call across various trainer implementations. The changes are clean and effectively address the described issue of incomplete data logging. I have one suggestion to enhance the robustness of the new finish method.
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?
Adds an explicit
.finishcall for the trackers (ex: Wandb) when training ends.I noticed that some of our E2E CI runs seem to be "finishing early" / missing some datapoints (Internal link)
(Expected an entry at step 10 but some runs only have eval metric at step 5).
This is primarily because we don't have an explicit
wandb.finish()call at the end of training. While we do have the same logic in__del__, this is not guaranteed to be called and thus we can end up with missing entries. Further the status of the run is marked as "crashed" even though the program exit code was 0.Typically I refer to the fsdp backend based ci runs (Internal link), which seem to have the values for all 7/7 steps logged. I suspect this is because of the difference in the final cleanup steps that happen for each backend:
FSDP:
Megatron:
Checkpointing time with the Megatron backend is faster and that is probably why wandb's background process didn't get enough time to upload the final step's metrics after step end.
All changes are made only to the new
skyrl/package