some more typos

This commit is contained in:
pritesh2000 committed 2024-08-31 17:14:29 +05:30
1 parent 7040ddf64c
commit df8b596845
1 file changed
+6 -6
+6 -6
View File
@@ -2106,7 +2106,7 @@
" def forward(self, x):\n",
" # Create assertion to check that inputs are the correct shape\n",
" image_resolution = x.shape[-1]\n",
" assert image_resolution % patch_size == 0, f\"Input image size must be divisble by patch size, image shape: {image_resolution}, patch size: {patch_size}\"\n",
" assert image_resolution % patch_size == 0, f\"Input image size must be divisible by patch size, image shape: {image_resolution}, patch size: {patch_size}\"\n",
"\n",
" # Perform the forward pass\n",
" x_patched = self.patcher(x)\n",
@@ -2814,11 +2814,11 @@
"\n",
"And if the learned representation the layers form using MSA are good, we'll see the results in our model's performance.\n",
"\n",
"There are many resources online to learn more about the Transformer architeture and attention mechanism online such as Jay Alammar's wonderful [Illustrated Transformer post](https://jalammar.github.io/illustrated-transformer/) and [Illustrated Attention post](https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/).\n",
"There are many resources online to learn more about the Transformer architecture and attention mechanism online such as Jay Alammar's wonderful [Illustrated Transformer post](https://jalammar.github.io/illustrated-transformer/) and [Illustrated Attention post](https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/).\n",
"\n",
"We're going to focus more on coding an existing PyTorch MSA implementation than creating our own.\n",
"\n",
"However, you can find the formal defintion of the ViT paper's MSA implementation is defined in Appendix A:\n",
"However, you can find the formal definition of the ViT paper's MSA implementation is defined in Appendix A:\n",
"\n",
"<img src=\"https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/08-vit-paper-equation-2-appendix-A.png\" alt=\"vision transformer paper figure 1 highlighted with equation 2 and appendix A\" width=900/>\n",
"\n",
@@ -3284,7 +3284,7 @@
"\n",
"*Mapping the ViT Transformer Encoder to code.*\n",
"\n",
"You might've noticed that Table 1 from the ViT paper has a Layers column. This refers to the number of Transformer Encoder blocks in the specific ViT architecure.\n",
"You might've noticed that Table 1 from the ViT paper has a Layers column. This refers to the number of Transformer Encoder blocks in the specific ViT architecture.\n",
"\n",
"In our case, for ViT-Base, we'll be stacking together 12 of these Transformer Encoder blocks to form the backbone of our architecture (we'll get to this in section 8).\n",
"\n",
@@ -3533,7 +3533,7 @@
" num_classes:int=1000): # Default for ImageNet but can customize this\n",
" super().__init__() # don't forget the super().__init__()!\n",
"\n",
" # 3. Make the image size is divisble by the patch size\n",
" # 3. Make the image size is divisible by the patch size\n",
" assert img_size % patch_size == 0, f\"Image size must be divisible by patch size, image size: {img_size}, patch size: {patch_size}.\"\n",
"\n",
" # 4. Calculate number of patches (height * width/patch^2)\n",
@@ -4015,7 +4015,7 @@
"\n",
"These results are likely because of the difference in data resources and training regime of our ViT model versus the ViT paper.\n",
"\n",
"It seems our model is [severly underfitting](learnpytorch.io/04_pytorch_custom_datasets/#82-how-to-deal-with-underfitting) (not achieving the results we'd like it to).\n",
"It seems our model is [severely underfitting](learnpytorch.io/04_pytorch_custom_datasets/#82-how-to-deal-with-underfitting) (not achieving the results we'd like it to).\n",
"\n",
"How about we see if we can fix that by bringing in a pretrained ViT model?"
]