Skip to content

Commit 0fa794b

Browse files
committed
update GPU usage section
1 parent 1f43ea8 commit 0fa794b

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

00_pytorch_fundamentals.ipynb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,15 +3505,13 @@
35053505
"cell_type": "markdown",
35063506
"metadata": {},
35073507
"source": [
3508+
"### 2.1 Getting PyTorch to run on Apple Silicon\n",
35083509
"\n",
3510+
"In order to run PyTorch on Apple's M1/M2/M3 GPUs you can use the [`torch.backends.mps`](https://pytorch.org/docs/stable/notes/mps.html) module.\n",
35093511
"\n",
3510-
"### 2.1 Getting PyTorch to run on the ARM GPUs\n",
3512+
"Be sure that the versions of the macOS and Pytorch are updated.\n",
35113513
"\n",
3512-
"In order to run PyTorch on the Apple's M1/M2 GPUs you can use the [`torch.backends.mps`](https://pytorch.org/docs/stable/notes/mps.html) package.\n",
3513-
"\n",
3514-
"Be sure that the versions of the MacOS and Pytorch are updated\n",
3515-
"\n",
3516-
"You can test if PyTorch has access to a GPU using `torch.backends.mps.is_available()`\n"
3514+
"You can test if PyTorch has access to a GPU using `torch.backends.mps.is_available()`."
35173515
]
35183516
},
35193517
{
@@ -3533,9 +3531,9 @@
35333531
}
35343532
],
35353533
"source": [
3536-
"# Check for ARM GPU\n",
3534+
"# Check for Apple Silicon GPU\n",
35373535
"import torch\n",
3538-
"torch.backends.mps.is_available()"
3536+
"torch.backends.mps.is_available() # Note this will print false if you're not running on a Mac"
35393537
]
35403538
},
35413539
{
@@ -3564,7 +3562,7 @@
35643562
"cell_type": "markdown",
35653563
"metadata": {},
35663564
"source": [
3567-
"As before, if the above output `\"mps\"` it means we can set all of our PyTorch code to use the available Apple Arm GPU"
3565+
"As before, if the above output `\"mps\"` it means we can set all of our PyTorch code to use the available Apple Silicon GPU."
35683566
]
35693567
},
35703568
{
@@ -3574,11 +3572,11 @@
35743572
"outputs": [],
35753573
"source": [
35763574
"if torch.cuda.is_available():\n",
3577-
" device = 'cuda'\n",
3575+
" device = \"cuda\" # Use NVIDIA GPU (if available)\n",
35783576
"elif torch.backends.mps.is_available():\n",
3579-
" device = 'mps'\n",
3577+
" device = \"mps\" # Use Apple Silicon GPU (if available)\n",
35803578
"else:\n",
3581-
" device = 'cpu'"
3579+
" device = \"cpu\" # Default to CPU if no GPU is available"
35823580
]
35833581
},
35843582
{

0 commit comments

Comments
 (0)