This commit is contained in:
Daniel Bourke committed 2023-04-13 16:36:01 +10:00
commit baf768b8a6
3 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -3261,7 +3261,7 @@
"| ----- | ----- | ----- | ----- | ----- |\n",
"| Google Colab | Easy | Free to use, almost zero setup required, can share work with others as easy as a link | Doesn't save your data outputs, limited compute, subject to timeouts | [Follow the Google Colab Guide](https://colab.research.google.com/notebooks/gpu.ipynb) |\n",
"| Use your own | Medium | Run everything locally on your own machine | GPUs aren't free, require upfront cost | Follow the [PyTorch installation guidelines](https://pytorch.org/get-started/locally/) |\n",
"| Cloud computing (AWS, GCP, Azure) | Medium-Hard | Small upfront cost, access to almost infinite compute | Can get expensive if running continually, takes some time ot setup right | Follow the [PyTorch installation guidelines](https://pytorch.org/get-started/cloud-partners/) |\n",
"| Cloud computing (AWS, GCP, Azure) | Medium-Hard | Small upfront cost, access to almost infinite compute | Can get expensive if running continually, takes some time to setup right | Follow the [PyTorch installation guidelines](https://pytorch.org/get-started/cloud-partners/) |\n",
"\n",
"There are more options for using GPUs but the above three will suffice for now.\n",
"\n",
+1 -1
View File
@@ -1922,7 +1922,7 @@
"\n",
"We'll have to pass the new model's parameters (`model.parameters()`) to the optimizer for it to adjust them during training. \n",
"\n",
"The learning rate of `0.1` worked well before too so let's use that again.\n",
"The learning rate of `0.01` worked well before too so let's use that again.\n",
"\n",
"\n"
]
+2
View File
@@ -1497,6 +1497,7 @@
" accuracy_fn,\n",
" device: torch.device = device):\n",
" train_loss, train_acc = 0, 0\n",
" model.to(device)\n",
" for batch, (X, y) in enumerate(data_loader):\n",
" # Send data to GPU\n",
" X, y = X.to(device), y.to(device)\n",
@@ -1530,6 +1531,7 @@
" accuracy_fn,\n",
" device: torch.device = device):\n",
" test_loss, test_acc = 0, 0\n",
" model.to(device)\n",
" model.eval() # put model in eval mode\n",
" # Turn on inference context manager\n",
" with torch.inference_mode(): \n",