Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

一些防呆设计,增加对苹果M系列芯片支持 #14

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

Open
whitewatercn wants to merge 2 commits into TingsongYu:main
base: main
Choose a base branch
Loading
from whitewatercn:main
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add support for apple sillicon
  • Loading branch information
whitewatercn committed Jun 10, 2024
commit b788ae4ad76a08fa34288e62109d893013c63edc
4 changes: 3 additions & 1 deletion code/chapter-8/01_classification/train_main.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,7 @@ def main(args):
if __name__ == "__main__":
args = get_args_parser().parse_args()
utils.setup_seed(args.random_seed)
args.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
device_choices = ["cuda", "mps", "cpu"]
device = torch.device(args.device) if args.device in device_choices else torch.device("cpu")
args.device = device
main(args)

AltStyle によって変換されたページ (->オリジナル) /