Comments (7)
/tome/patch/timm.py
contains no mention of "drop_path_rate". Did you edit the code?
from tome.
/tome/patch/timm.py
contains no mention of "drop_path_rate". Did you edit the code?
File "/content/tome/tome/patch/timm.py", line 33, in forward x = x + self.drop_path(x_attn) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1208, in __getattr__ type(self).__name__, name)) AttributeError: 'ToMeBlock' object has no attribute 'drop_path'
from tome.
drop_path should exist in timm 0.4.12: https://github.com/rwightman/pytorch-image-models/blob/7096b52a613eefb4f6d8107366611c8983478b19/timm/models/vision_transformer.py#L207
Are you using the right version of timm (0.4.12) and passing in a timm model?
from tome.
Alternatively, you can replace drop_path with an identity since that's only necessary during training.
from tome.
drop_path should exist in timm 0.4.12: https://github.com/rwightman/pytorch-image-models/blob/7096b52a613eefb4f6d8107366611c8983478b19/timm/models/vision_transformer.py#L207
Are you using the right version of timm (0.4.12) and passing in a timm model?
I use timm==0.6.11
My code:
...
class Encoder(VisionTransformer):
def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768, depth=12, num_heads=12, mlp_ratio=4.,
qkv_bias=True, drop_rate=0., attn_drop_rate=0., drop_path_rate=0., embed_layer=PatchEmbed):
super().__init__(img_size, patch_size, in_chans, embed_dim=embed_dim, depth=depth, num_heads=num_heads,
mlp_ratio=mlp_ratio, qkv_bias=qkv_bias, drop_rate=drop_rate, attn_drop_rate=attn_drop_rate,
drop_path_rate=drop_path_rate, embed_layer=embed_layer,
num_classes=0, global_pool='', class_token=False) # these disable the classifier head
def forward(self, x):
# Return all tokens
return self.forward_features(x)
...
self.encoder = Encoder(img_size, patch_size, embed_dim=embed_dim, depth=enc_depth, num_heads=enc_num_heads,
mlp_ratio=enc_mlp_ratio)
tome.patch.timm(self.encoder, prop_attn=False)
self.encoder.r = 16
...
from tome.
Ah, we don't yet support higher versions of timm so you'll have to install 0.4.12.
from tome.
Ah, we don't yet support higher versions of timm so you'll have to install 0.4.12.
I think I solved it
timm==0.6.11
I replace (tome/tome/patch/timm.py)
x = x + self.drop_path(x_attn)
x = x + self.drop_path(self.mlp(self.norm2(x)))
to
x = x + self.drop_path1(x_attn)
x = x + self.drop_path1(self.mlp(self.norm2(x)))
from tome.
Related Issues (20)
- Does ToMe work for focal modulation networks? HOT 2
- Does ToMe work for focal modulation networks? HOT 1
- (Question) LayerNorm for queries and keys HOT 2
- I keep getting this issue, how do I fix it? HOT 1
- Does ToMe work for Restormer? HOT 2
- hyper-parm "r" in ViT-g/14 HOT 4
- Can ToMe be applied together with RoPE? HOT 1
- Used in the vanilla Transformer HOT 6
- How do you understand the phrase "This can change the outcome of softmax attention: if we merge two tokens with the same key, that key has less effect in the softmax term" in Part Tracking Token Size ? HOT 5
- Has anyone been able to successfully convert the timm+tome model to onnx? HOT 2
- How to restore it to its original shape HOT 1
- Training Speedup for ToMe with Video HOT 3
- How to implement ToMe to image encoders in CLIP model? HOT 1
- Video Classification off-the-shelf model
- About inference acceleration for multi-modal large language models HOT 3
- End-to-end inference doesn't be accelerated. HOT 3
- AttributeError: 'ToMeVisionTransformer' object has no attribute 'blocks' HOT 3
- About using ToMe in ImageEncoderViT within segment anything HOT 2
- Question regarding scatter_reduce
- Why do we need this code snippet for training MAE? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tome.