Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/N] Refine beginner tutorial by accelerator api #3167

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

guangyey
Copy link

@guangyey guangyey commented Nov 25, 2024

For #3113

Motivation

As titled, we aim to use accelerator API to refine the build model tutorial to make it device-agnostic.

Additional Context

This is my first PR to pytorch/tutorials

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

cc @subramen @albanD @jbschlosser

Copy link

pytorch-bot bot commented Nov 25, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3167

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures

As of commit e57d5f2 with merge base 540bd0c (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@guangyey guangyey changed the title [WIP] Refine build model tutorial by accelerator api [1/N] Refine build model tutorial by accelerator api Nov 25, 2024
@guangyey guangyey changed the title [1/N] Refine build model tutorial by accelerator api [1/N] Refine model tutorial by accelerator api Nov 25, 2024
@guangyey guangyey changed the title [1/N] Refine model tutorial by accelerator api [1/N] Refine beginner tutorial by accelerator api Nov 25, 2024
@guangyey
Copy link
Author

@malfet @svekars, I was wondering if you could help review this PR.

@svekars svekars added intro core Tutorials of any level of difficulty related to the core pytorch functionality labels Nov 25, 2024
Copy link
Contributor

@svekars svekars left a comment

Choose a reason for hiding this comment

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

Thank you for the fix. Can you check other tutorials to see where it needs to be updated? Also, we'll have to wait to merge this until 2.6 is available. We'll test against the 2.6-TEST branch after the first RC.

if torch.backends.mps.is_available()
else "cpu"
)
# We want to be able to train our model on an `accelerator <https://pytorch.org/docs/stable/torch.html#accelerators>`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# We want to be able to train our model on an `accelerator <https://pytorch.org/docs/stable/torch.html#accelerators>`
# We want to be able to train our model on an `accelerator <https://pytorch.org/docs/stable/torch.html#accelerators>`__

else "cpu"
)
# We want to be able to train our model on an `accelerator <https://pytorch.org/docs/stable/torch.html#accelerators>`
# like CUDA, MPS, MTIA, or XPU. If the current accelerator is available, we will use it, otherwise we use the CPU.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# like CUDA, MPS, MTIA, or XPU. If the current accelerator is available, we will use it, otherwise we use the CPU.
# such as CUDA, MPS, MTIA, or XPU. If the current accelerator is available, we will use it. Otherwise, we use the CPU.

@svekars svekars added the 2.6 Tracking 2.6 version PRs. label Nov 25, 2024
@guangyey
Copy link
Author

Thanks, @svekars I will continue checking the other tutorials.

Copy link
Contributor

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.6 Tracking 2.6 version PRs. cla signed core Tutorials of any level of difficulty related to the core pytorch functionality intro
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants