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:
Sebastian Raschka
2025-09-13 12:48:06 -05:00
committed by GitHub
parent 8e170312fe
commit fc101b710e
2 changed files with 840 additions and 819 deletions

View File

@@ -58,6 +58,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Using device: cuda\n",
"PyTorch version: 2.8.0\n"
]
}
@@ -66,7 +67,14 @@
"import torch\n",
"\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",
"\n",
"batch_size = 8\n",

File diff suppressed because it is too large Load Diff