Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions appendix-D/01_main-chapter-code/appendix-D.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
" major, minor = map(int, torch.__version__.split(\".\")[:2])\n",
" if (major, minor) >= (2, 9):\n",
" device = torch.device(\"mps\")\n",
" else:\n",
" device = torch.device(\"cpu\")\n",
"else:\n",
" device = torch.device(\"cpu\")\n",
"\n",
Expand Down
2 changes: 2 additions & 0 deletions appendix-E/01_main-chapter-code/appendix-E.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@
" major, minor = map(int, torch.__version__.split(\".\")[:2])\n",
" if (major, minor) >= (2, 9):\n",
" device = torch.device(\"mps\")\n",
" else:\n",
" device = torch.device(\"cpu\")\n",
"else:\n",
" device = torch.device(\"cpu\")\n",
"\n",
Expand Down
3 changes: 3 additions & 0 deletions ch05/01_main-chapter-code/ch05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1183,9 +1183,12 @@
" major, minor = map(int, torch.__version__.split(\".\")[:2])\n",
" if (major, minor) >= (2, 9):\n",
" device = torch.device(\"mps\")\n",
" else:\n",
" device = torch.device(\"cpu\")\n",
"else:\n",
" device = torch.device(\"cpu\")\n",
"\n",
"\n",
"print(f\"Using {device} device.\")\n",
"\n",
"\n",
Expand Down
2 changes: 2 additions & 0 deletions ch06/01_main-chapter-code/ch06.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,8 @@
" major, minor = map(int, torch.__version__.split(\".\")[:2])\n",
" if (major, minor) >= (2, 9):\n",
" device = torch.device(\"mps\")\n",
" else:\n",
" device = torch.device(\"cpu\")\n",
"else:\n",
" device = torch.device(\"cpu\")\n",
"\n",
Expand Down
2 changes: 2 additions & 0 deletions ch07/01_main-chapter-code/ch07.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,8 @@
" major, minor = map(int, torch.__version__.split(\".\")[:2])\n",
" if (major, minor) >= (2, 9):\n",
" device = torch.device(\"mps\")\n",
" else:\n",
" device = torch.device(\"cpu\")\n",
"else:\n",
" device = torch.device(\"cpu\")\n",
"\n",
Expand Down
2 changes: 2 additions & 0 deletions ch07/04_preference-tuning-with-dpo/dpo-from-scratch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,8 @@
" major, minor = map(int, torch.__version__.split(\".\")[:2])\n",
" if (major, minor) >= (2, 9):\n",
" device = torch.device(\"mps\")\n",
" else:\n",
" device = torch.device(\"cpu\")\n",
"else:\n",
" device = torch.device(\"cpu\")\n",
"\n",
Expand Down