Skip to content

Commit c0eb4c0

Browse files
authored
Improving Readability (#220)
Signed-off-by: Ryan Russell <[email protected]> Signed-off-by: Ryan Russell <[email protected]>
1 parent 5f1a6a0 commit c0eb4c0

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ preds = v(img) # (2, 1000)
664664

665665
<img src="./images/nest.png" width="400px"></img>
666666

667-
This <a href="https://arxiv.org/abs/2105.12723">paper</a> decided to process the image in hierarchical stages, with attention only within tokens of local blocks, which aggregate as it moves up the heirarchy. The aggregation is done in the image plane, and contains a convolution and subsequent maxpool to allow it to pass information across the boundary.
667+
This <a href="https://arxiv.org/abs/2105.12723">paper</a> decided to process the image in hierarchical stages, with attention only within tokens of local blocks, which aggregate as it moves up the hierarchy. The aggregation is done in the image plane, and contains a convolution and subsequent maxpool to allow it to pass information across the boundary.
668668

669669
You can use it with the following code (ex. NesT-T)
670670

@@ -678,7 +678,7 @@ nest = NesT(
678678
dim = 96,
679679
heads = 3,
680680
num_hierarchies = 3, # number of hierarchies
681-
block_repeats = (2, 2, 8), # the number of transformer blocks at each heirarchy, starting from the bottom
681+
block_repeats = (2, 2, 8), # the number of transformer blocks at each hierarchy, starting from the bottom
682682
num_classes = 1000
683683
)
684684

examples/cats_and_dogs.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"\n",
1717
"* Dogs vs. Cats Redux: Kernels Edition - https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition\n",
1818
"* Base Code - https://www.kaggle.com/reukki/pytorch-cnn-tutorial-with-cats-and-dogs/\n",
19-
"* Effecient Attention Implementation - https://github.com/lucidrains/vit-pytorch#efficient-attention"
19+
"* Efficient Attention Implementation - https://github.com/lucidrains/vit-pytorch#efficient-attention"
2020
]
2121
},
2222
{
@@ -342,7 +342,7 @@
342342
"id": "ZhYDJXk2SRDu"
343343
},
344344
"source": [
345-
"## Image Augumentation"
345+
"## Image Augmentation"
346346
]
347347
},
348348
{
@@ -497,7 +497,7 @@
497497
"id": "TF9yMaRrSvmv"
498498
},
499499
"source": [
500-
"## Effecient Attention"
500+
"## Efficient Attention"
501501
]
502502
},
503503
{
@@ -1307,7 +1307,7 @@
13071307
"celltoolbar": "Edit Metadata",
13081308
"colab": {
13091309
"collapsed_sections": [],
1310-
"name": "Effecient Attention | Cats & Dogs",
1310+
"name": "Efficient Attention | Cats & Dogs",
13111311
"provenance": [],
13121312
"toc_visible": true
13131313
},

vit_pytorch/mobile_vit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def conv_1x1_bn(inp, oup):
1313
nn.SiLU()
1414
)
1515

16-
def conv_nxn_bn(inp, oup, kernal_size=3, stride=1):
16+
def conv_nxn_bn(inp, oup, kernel_size=3, stride=1):
1717
return nn.Sequential(
18-
nn.Conv2d(inp, oup, kernal_size, stride, 1, bias=False),
18+
nn.Conv2d(inp, oup, kernel_size, stride, 1, bias=False),
1919
nn.BatchNorm2d(oup),
2020
nn.SiLU()
2121
)

vit_pytorch/nest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(
131131
fmap_size = image_size // patch_size
132132
blocks = 2 ** (num_hierarchies - 1)
133133

134-
seq_len = (fmap_size // blocks) ** 2 # sequence length is held constant across heirarchy
134+
seq_len = (fmap_size // blocks) ** 2 # sequence length is held constant across hierarchy
135135
hierarchies = list(reversed(range(num_hierarchies)))
136136
mults = [2 ** i for i in reversed(hierarchies)]
137137

0 commit comments

Comments
 (0)