Re:Deep Dive into the Vision Transformers Paper (ViT)
by vlovich123 on Saturday December 02, 2023 @12:29AM
(#38496172)
I very cursorily skimmed your paper but I didn’t spot where it discusses overlapping the patches. Is it the section about using the hybrid model with a convolutional step which de facto accomplishes it (maybe?) instead of overlapping patches?
Re:Deep Dive into the Vision Transformers Paper (ViT)
by stevenwalton on Saturday December 02, 2023 @01:33AM
(#38496466)
Yeah so I can get how that might be confusing. Sometimes code is clearer. So in the vanilla transformer you do a patch and then embed operation, right? A quick way to do that is actually with non-overlapping convolutions. Your strides are the same size as your kernel sizes. Look closely at Figure 2 (you can also see a visual representation in Figure 1 but I'll admit there is some artistic liberty there because we wanted to stress the combined patch and embed operation. Those are real outputs though. But basically yeah, change the stride so you overlap. Those create patches, then you embed. So we don't really call it a hybrid the same way you may call a 1x1 cov a channel wise linear (which is the same as permuting linear then permute).
ViT https://github.com/SHI-Labs/Compact-Transformers/blob/main/s...
CCT: https://github.com/SHI-Labs/Compact-Transformers/blob/main/s...
Edit: Actually here's a third party version doing the permutation then linear then reshape operation
https://github.com/lucidrains/vit-pytorch/blob/main/vit_pyto...
But the original implementation uses Conv: https://github.com/google-research/vision_transformer/blob/m...
Re:Deep Dive into the Vision Transformers Paper (ViT)
by gschoeni on Saturday December 02, 2023 @07:11PM
(#38503515)
Thanks for all the good work and all the pointers! Awesome stuff. Let me know if you would want to join us live on a Friday and go over some of your newer work or any recent papers you find interesting. Feel free to reach out at [email protected] if so :)
Paper: https://arxiv.org/abs/2104.05704
Blog: https://medium.com/pytorch/training-compact-transformers-fro...
CPU compute: https://twitter.com/WaltonStevenj/status/1382045610283397120
Crazy optimizations (no affiliation): 94% on CIFAR-10 in <6.3 seconds on a single A100 : https://github.com/tysam-code/hlb-CIFAR10
I also want to give maybe some better information about ViTs in general. Lucas Beyer is a good source and has some lectures as well as Hila Chefer and Sayak Paul's tutorials. Also, just follow Ross Wightman, the man is a beast
Lucas Beyer: https://twitter.com/giffmana/status/1570152923233144832
Chefer & Paul's All Things ViT: https://all-things-vits.github.io/atv/
Ross Wightman : https://twitter.com/wightmanr
His very famous timm package https://github.com/huggingface/pytorch-image-models