SteveZeyuZhang
commited on
Commit
•
c9a429e
1
Parent(s):
14d1089
baseline
Browse files
timm/models/vision_transformer.py
CHANGED
@@ -48,7 +48,6 @@ from ._builder import build_model_with_cfg
|
|
48 |
from ._manipulate import named_apply, checkpoint_seq, adapt_input_conv
|
49 |
from ._registry import generate_default_cfgs, register_model, register_model_deprecations
|
50 |
|
51 |
-
from ttt import TTTForCausalLM, TTTConfig, TTT_STANDARD_CONFIGS
|
52 |
|
53 |
__all__ = ['VisionTransformer'] # model_registry will add each entrypoint fn to this
|
54 |
|
@@ -153,17 +152,13 @@ class Block(nn.Module):
|
|
153 |
self.drop_path1 = DropPath(drop_path) if drop_path > 0. else nn.Identity()
|
154 |
|
155 |
self.norm2 = norm_layer(dim)
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
############## TTT-MLP ###################
|
164 |
|
165 |
-
tttmlp_config = TTTConfig()
|
166 |
-
self.mlp = TTTMLP(tttmlp_config)
|
167 |
self.ls2 = LayerScale(dim, init_values=init_values) if init_values else nn.Identity()
|
168 |
self.drop_path2 = DropPath(drop_path) if drop_path > 0. else nn.Identity()
|
169 |
|
|
|
48 |
from ._manipulate import named_apply, checkpoint_seq, adapt_input_conv
|
49 |
from ._registry import generate_default_cfgs, register_model, register_model_deprecations
|
50 |
|
|
|
51 |
|
52 |
__all__ = ['VisionTransformer'] # model_registry will add each entrypoint fn to this
|
53 |
|
|
|
152 |
self.drop_path1 = DropPath(drop_path) if drop_path > 0. else nn.Identity()
|
153 |
|
154 |
self.norm2 = norm_layer(dim)
|
155 |
+
self.mlp = mlp_layer(
|
156 |
+
in_features=dim,
|
157 |
+
hidden_features=int(dim * mlp_ratio),
|
158 |
+
act_layer=act_layer,
|
159 |
+
drop=proj_drop,
|
160 |
+
)
|
|
|
|
|
161 |
|
|
|
|
|
162 |
self.ls2 = LayerScale(dim, init_values=init_values) if init_values else nn.Identity()
|
163 |
self.drop_path2 = DropPath(drop_path) if drop_path > 0. else nn.Identity()
|
164 |
|