Merge branch 'mrdbourke:main' into main

This commit is contained in:
Jafar Isbarov authored and GitHub committed 2023-06-15 22:04:58 +04:00
commit 79de27d9b1
7 files changed
+9516 -7338

No files matched your search

+1 -1
View File
@@ -1241,7 +1241,7 @@
"\n",
"| PyTorch method | What does it do? | \n",
"| ----- | ----- |\n",
"| [`torch.save`](https://pytorch.org/docs/stable/torch.html?highlight=save#torch.save) | Saves a serialzed object to disk using Python's [`pickle`](https://docs.python.org/3/library/pickle.html) utility. Models, tensors and various other Python objects like dictionaries can be saved using `torch.save`. | \n",
"| [`torch.save`](https://pytorch.org/docs/stable/torch.html?highlight=save#torch.save) | Saves a serialized object to disk using Python's [`pickle`](https://docs.python.org/3/library/pickle.html) utility. Models, tensors and various other Python objects like dictionaries can be saved using `torch.save`. | \n",
"| [`torch.load`](https://pytorch.org/docs/stable/torch.html?highlight=torch%20load#torch.load) | Uses `pickle`'s unpickling features to deserialize and load pickled Python object files (like models, tensors or dictionaries) into memory. You can also set which device to load the object to (CPU, GPU etc). |\n",
"| [`torch.nn.Module.load_state_dict`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html?highlight=load_state_dict#torch.nn.Module.load_state_dict)| Loads a model's parameter dictionary (`model.state_dict()`) using a saved `state_dict()` object. | \n",
"\n",
+3 -3
View File
@@ -453,7 +453,7 @@
"\n",
"And there's no surefire way to making sure they won't happen, they will.\n",
"\n",
"What you can do instead is continaully familiarize yourself with the shape of the data you're working with.\n",
"What you can do instead is continually familiarize yourself with the shape of the data you're working with.\n",
"\n",
"I like referring to it as input and output shapes.\n",
"\n",
@@ -949,7 +949,7 @@
"\n",
"However, the same optimizer function can often be used across different problem spaces.\n",
"\n",
"For example, the stochastic gradient descent optimizer (SGD, `torch.optim.SGD()`) can be used for a range of problems, so can too the Adam optimizer (`torch.optim.Adam()`). \n",
"For example, the stochastic gradient descent optimizer (SGD, `torch.optim.SGD()`) can be used for a range of problems, and the same applies to the Adam optimizer (`torch.optim.Adam()`). \n",
"\n",
"| Loss function/Optimizer | Problem type | PyTorch Code |\n",
"| ----- | ----- | ----- |\n",
@@ -1102,7 +1102,7 @@
"source": [
"### 3.1 Going from raw model outputs to predicted labels (logits -> prediction probabilities -> prediction labels)\n",
"\n",
"Before we the training loop steps, let's see what comes out of our model during the forward pass (the forward pass is defined by the `forward()` method).\n",
"Before the training loop steps, let's see what comes out of our model during the forward pass (the forward pass is defined by the `forward()` method).\n",
"\n",
"To do so, let's pass the model some data."
]
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -2468,7 +2468,7 @@
"id": "YxnqDBlpDDJ_"
},
"source": [
"If we wanted to stack our new tensor on top of itself five times, we could do so with `torch.stack()`."
"If we wanted to stack our new tensor on top of itself four times, we could do so with `torch.stack()`."
]
},
{
@@ -3246,7 +3246,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
@@ -565,7 +565,7 @@
"source": [
"Notice how the values for `weights` and `bias` from `model_0.state_dict()` come out as random float tensors?\n",
"\n",
"This is becuase we initialized them above using `torch.randn()`.\n",
"This is because we initialized them above using `torch.randn()`.\n",
"\n",
"Essentially we want to start from random parameters and get the model to update them towards parameters that fit our data best (the hardcoded `weight` and `bias` values we set when creating our straight line data).\n",
"\n",
+1 -1
View File
@@ -494,7 +494,7 @@
"```\n",
"\n",
"Where,\n",
"* `EfficientNet_B0_Weights` is the model architecture weights we'd like to use (there are many differnt model architecture options in `torchvision.models`).\n",
"* `EfficientNet_B0_Weights` is the model architecture weights we'd like to use (there are many different model architecture options in `torchvision.models`).\n",
"* `DEFAULT` means the *best available* weights (the best performance in ImageNet).\n",
" * **Note:** Depending on the model architecture you choose, you may also see other options such as `IMAGENET_V1` and `IMAGENET_V2` where generally the higher version number the better. Though if you want the best available, `DEFAULT` is the easiest option. See the [`torchvision.models` documentation](https://pytorch.org/vision/main/models.html) for more.\n",
" \n",
File diff suppressed because it is too large. Load diff