[train] Raise error when calling ray.train.report with a gpu tensor#53725
Merged
justinvyu merged 2 commits intoray-project:masterfrom Jun 11, 2025
Merged
Conversation
Signed-off-by: Timothy Seah <tseah@anyscale.com>
justinvyu
reviewed
Jun 10, 2025
Contributor
justinvyu
left a comment
There was a problem hiding this comment.
Maybe we can make this a TorchTrainer specific WorkerCallback that implements a check within on_report instead.
Then we would be able to remove the torch module check and remove this code in the generic report implementation.
Signed-off-by: Timothy Seah <tseah@anyscale.com>
Contributor
Author
Filed a ticket for this as per our discussion. |
elliot-barn
pushed a commit
that referenced
this pull request
Jun 18, 2025
…53725) Right now, when users call `ray.train.report` with a gpu tensor in their ray train train_function, the train controller fails to deserialize the gpu tensor, causing the training run to hang. With this change, the train workers running the train_function preemptively raise a ValueError, allowing the train run to terminate properly. --------- Signed-off-by: Timothy Seah <tseah@anyscale.com> Co-authored-by: Timothy Seah <tseah@anyscale.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn
pushed a commit
that referenced
this pull request
Jul 2, 2025
…53725) Right now, when users call `ray.train.report` with a gpu tensor in their ray train train_function, the train controller fails to deserialize the gpu tensor, causing the training run to hang. With this change, the train workers running the train_function preemptively raise a ValueError, allowing the train run to terminate properly. --------- Signed-off-by: Timothy Seah <tseah@anyscale.com> Co-authored-by: Timothy Seah <tseah@anyscale.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
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.
Right now, when users call
ray.train.reportwith a gpu tensor in their ray train train_function, the train controller fails to deserialize the gpu tensor, causing the training run to hang. With this change, the train workers running the train_function preemptively raise a ValueError, allowing the train run to terminate properly.Tested by running this script (which was previously known to hang) in a workspace
which resulted in these logs