mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
Note about MPS in ch06 and ch07 (#325)
This commit is contained in:
committed by
GitHub
parent
8ef5022511
commit
c443035d56
@@ -1125,13 +1125,17 @@
|
||||
"source": [
|
||||
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
|
||||
"\n",
|
||||
"# If you have a Mac with Apple Silicon chip, you can uncomment the next lines of code\n",
|
||||
"# to train the model on the Mac's GPU cores. However, as of this writing, this results in\n",
|
||||
"# larger numerical deviations from the results shown in this chapter, because Apple Silicon\n",
|
||||
"# support in PyTorch is still experimental\n",
|
||||
"# Note:\n",
|
||||
"# Uncommenting the following lines will allow the code to run on Apple Silicon chips, if applicable,\n",
|
||||
"# which is much faster than on an Apple CPU (as measured on an M3 MacBook Air).\n",
|
||||
"# However, the resulting loss values may be slightly different.\n",
|
||||
"\n",
|
||||
"# if torch.backends.mps.is_available():\n",
|
||||
"# device = torch.device(\"mps\")\n",
|
||||
"#if torch.cuda.is_available():\n",
|
||||
"# device = torch.device(\"cuda\")\n",
|
||||
"#elif torch.backends.mps.is_available():\n",
|
||||
"# device = torch.device(\"mps\")\n",
|
||||
"#else:\n",
|
||||
"# device = torch.device(\"cpu\")\n",
|
||||
"\n",
|
||||
"print(\"Device:\", device)"
|
||||
]
|
||||
@@ -2762,7 +2766,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.6"
|
||||
"version": "3.11.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user