Skip to content

Conversation

@Daraan
Copy link
Contributor

@Daraan Daraan commented Sep 19, 2025

Why are these changes needed?

Follow up of RLlib PR: #55291
Torch device allows input types of str | int | torch.device, this PR unifies the type in a type variable and allows for the int type as well.

Upstream air PR: #56745

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • [ x I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • This PR is not tested :(

Signed-off-by: Daniel Sperber <[email protected]>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request provides a small but useful overhaul of the typing for torch device types. It correctly introduces a TorchDeviceType to unify the allowed types (str, int, torch.device) and applies it consistently across collate_fn, dataset, and iterator modules. The logic to handle integer device IDs is also correctly implemented. Overall, the changes improve type safety and code clarity. I have one suggestion to improve the docstring for the new TorchDeviceType to make it more precise.

Signed-off-by: Daniel Sperber <[email protected]>
@ray-gardener ray-gardener bot added data Ray Data-related issues community-contribution Contributed by the community labels Sep 19, 2025
Copy link
Contributor

@goutamvenkat-anyscale goutamvenkat-anyscale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution

@goutamvenkat-anyscale goutamvenkat-anyscale added the go add ONLY when ready to merge, run all tests label Sep 19, 2025
Daraan and others added 3 commits September 20, 2025 08:56
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Daniel Sperber <[email protected]>
@github-actions
Copy link

github-actions bot commented Oct 9, 2025

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Oct 9, 2025
@goutamvenkat-anyscale goutamvenkat-anyscale removed the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Oct 9, 2025
@Daraan
Copy link
Contributor Author

Daraan commented Oct 14, 2025

ping for a potential merge :)

@github-actions
Copy link

github-actions bot commented Nov 1, 2025

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Nov 1, 2025
@Daraan
Copy link
Contributor Author

Daraan commented Nov 1, 2025

#55291 is in. This PR aligns data as well.

@github-actions github-actions bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Nov 1, 2025
@gvspraveen gvspraveen removed the unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. label Nov 2, 2025
@gvspraveen gvspraveen requested a review from raulchen November 2, 2025 04:30
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Nov 16, 2025
@raulchen raulchen merged commit 35522cb into ray-project:master Nov 19, 2025
6 checks passed
@Daraan Daraan deleted the data/improve-tensor-types branch November 19, 2025 22:52
400Ping pushed a commit to 400Ping/ray that referenced this pull request Nov 21, 2025
…ct#56743)

## Why are these changes needed?

Follow up of RLlib PR: ray-project#55291
Torch `device` allows input types of `str | int | torch.device`, this PR
unifies the type in a type variable and allows for the `int` type as
well.

Upstream air PR: ray-project#56745

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ x I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [x] This PR is not tested :(

---------

Signed-off-by: Daniel Sperber <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
…ct#56743)

## Why are these changes needed?

Follow up of RLlib PR: ray-project#55291
Torch `device` allows input types of `str | int | torch.device`, this PR
unifies the type in a type variable and allows for the `int` type as
well.

Upstream air PR: ray-project#56745

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ x I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [x] This PR is not tested :(

---------

Signed-off-by: Daniel Sperber <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: YK <[email protected]>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
…ct#56743)

## Why are these changes needed?

Follow up of RLlib PR: ray-project#55291
Torch `device` allows input types of `str | int | torch.device`, this PR
unifies the type in a type variable and allows for the `int` type as
well.

Upstream air PR: ray-project#56745

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ x I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [x] This PR is not tested :(

---------

Signed-off-by: Daniel Sperber <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues go add ONLY when ready to merge, run all tests stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants