mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
Added Apple Silicon GPU device update (#820)
* Added Apple Silicon GPU device * Added Apple Silicon GPU device * delete: remove unused model.pth file from understanding-buffers * update * update --------- Co-authored-by: missflash <missflash@gmail.com>
This commit is contained in:
committed by
GitHub
parent
8e170312fe
commit
fc101b710e
@@ -58,6 +58,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
|
"Using device: cuda\n",
|
||||||
"PyTorch version: 2.8.0\n"
|
"PyTorch version: 2.8.0\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -66,7 +67,14 @@
|
|||||||
"import torch\n",
|
"import torch\n",
|
||||||
"\n",
|
"\n",
|
||||||
"torch.manual_seed(123)\n",
|
"torch.manual_seed(123)\n",
|
||||||
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
|
"if torch.backends.mps.is_available():\n",
|
||||||
|
" device = torch.device(\"mps\") # Apple Silicon GPU (Metal)\n",
|
||||||
|
"elif torch.cuda.is_available():\n",
|
||||||
|
" device = torch.device(\"cuda\") # NVIDIA GPU\n",
|
||||||
|
"else:\n",
|
||||||
|
" device = torch.device(\"cpu\") # CPU fallback\n",
|
||||||
|
"\n",
|
||||||
|
"print(f\"Using device: {device}\")\n",
|
||||||
"print(f\"PyTorch version: {torch.__version__}\")\n",
|
"print(f\"PyTorch version: {torch.__version__}\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"batch_size = 8\n",
|
"batch_size = 8\n",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user