File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ $ pip install coca-pytorch
1717First 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
2323Then
@@ -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
3131from 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
4344vit = Extractor(vit, return_embeddings_only = True , detach = False )
You can’t perform that action at this time.
0 commit comments