Skip to content

[train] Update quickstart example to use dataloader - #33050

Merged
amogkam merged 3 commits into
ray-project:masterfrom
matthewdeng:train-qs
Mar 7, 2023
Merged

[train] Update quickstart example to use dataloader #33050
amogkam merged 3 commits into
ray-project:masterfrom
matthewdeng:train-qs

Conversation

@matthewdeng

Copy link
Copy Markdown
Contributor

Updates the TorchTrainer quickstart example to be a little more realistic, following the official PyTorch Quickstart.

Why are these changes needed?

To simplify the CPU/GPU transition, Ray Train provides a ray.train.torch.prepare_data_loader utility function. Prior to this change, this logic was not being handled so the example would fail if run with use_gpu=True.

Changes

  1. Updated example to use a Dataloader for the FashionMNIST dataset. Updated surrounding code accordingly.
  2. Removed extra lines/white spaces to clean up documentation and allow users to directly copy/paste the code.
    • Also applied this change to the TensorFlow quickstart.

Related issue number

Closes #32990.

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/.
  • 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
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Matthew Deng <matt@anyscale.com>
Signed-off-by: Matthew Deng <matt@anyscale.com>
Signed-off-by: Matthew Deng <matt@anyscale.com>
@matthewdeng matthewdeng added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label Mar 6, 2023

@amogkam amogkam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we consolidate with the existing fashion mnist example? https://docs.ray.io/en/latest/train/examples/pytorch/torch_fashion_mnist_example.html

@matthewdeng

Copy link
Copy Markdown
Contributor Author

@amogkam I chose not to because I wanted to keep this one as minimal as possible (e.g. no validation, no configurations).

@angelinalg angelinalg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@angelinalg angelinalg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@amogkam
amogkam merged commit d2b855f into ray-project:master Mar 7, 2023
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request Mar 21, 2023
To simplify the CPU/GPU transition, Ray Train provides a ray.train.torch.prepare_data_loader utility function. Prior to this change, this logic was not being handled so the example would fail if run with use_gpu=True.

---------

Signed-off-by: Matthew Deng <matt@anyscale.com>
Signed-off-by: Jack He <jackhe2345@gmail.com>
edoakes pushed a commit to edoakes/ray that referenced this pull request Mar 22, 2023
To simplify the CPU/GPU transition, Ray Train provides a ray.train.torch.prepare_data_loader utility function. Prior to this change, this logic was not being handled so the example would fail if run with use_gpu=True.

---------

Signed-off-by: Matthew Deng <matt@anyscale.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
peytondmurray pushed a commit to peytondmurray/ray that referenced this pull request Mar 22, 2023
To simplify the CPU/GPU transition, Ray Train provides a ray.train.torch.prepare_data_loader utility function. Prior to this change, this logic was not being handled so the example would fail if run with use_gpu=True.

---------

Signed-off-by: Matthew Deng <matt@anyscale.com>
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
To simplify the CPU/GPU transition, Ray Train provides a ray.train.torch.prepare_data_loader utility function. Prior to this change, this logic was not being handled so the example would fail if run with use_gpu=True.

---------

Signed-off-by: Matthew Deng <matt@anyscale.com>
Signed-off-by: elliottower <elliot@elliottower.com>
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
To simplify the CPU/GPU transition, Ray Train provides a ray.train.torch.prepare_data_loader utility function. Prior to this change, this logic was not being handled so the example would fail if run with use_gpu=True.

---------

Signed-off-by: Matthew Deng <matt@anyscale.com>
Signed-off-by: Jack He <jackhe2345@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests-ok The tagger certifies test failures are unrelated and assumes personal liability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Train] Run into issues when using GPU to run train's get-started torch example

4 participants