Skip to content

Commit 790415c

Browse files
committed
update example with vit with patch dropout
1 parent 0ea204d commit 790415c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $ pip install coca-pytorch
1717
First install the `vit-pytorch` for the image encoder, which needs to be pretrained
1818

1919
```bash
20-
$ pip install vit-pytorch>=0.38.1
20+
$ pip install vit-pytorch>=0.40.2
2121
```
2222

2323
Then
@@ -27,17 +27,18 @@ import torch
2727

2828
# import vision transformer
2929

30-
from vit_pytorch import SimpleViT
30+
from vit_pytorch.simple_vit_with_patch_dropout import SimpleViT
3131
from vit_pytorch.extractor import Extractor
3232

33-
vit = ViT(
33+
vit = SimpleViT(
3434
image_size = 256,
3535
patch_size = 32,
3636
num_classes = 1000,
3737
dim = 1024,
3838
depth = 6,
3939
heads = 16,
40-
mlp_dim = 2048
40+
mlp_dim = 2048,
41+
patch_dropout = 0.5 # https://arxiv.org/abs/2212.00794
4142
)
4243

4344
vit = Extractor(vit, return_embeddings_only = True, detach = False)

0 commit comments

Comments
 (0)