broccoli-ml 12.1.0__tar.gz → 12.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/PKG-INFO +1 -1
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/transformer.py +5 -13
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/pyproject.toml +1 -1
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/LICENSE +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/README.md +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/__init__.py +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/activation.py +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/cnn.py +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/linear.py +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/rope.py +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/tensor.py +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/utils.py +0 -0
- {broccoli_ml-12.1.0 → broccoli_ml-12.3.0}/broccoli/vit.py +0 -0
|
@@ -593,20 +593,12 @@ class TransformerBlock(nn.Module):
|
|
|
593
593
|
|
|
594
594
|
def forward(self, x):
|
|
595
595
|
if self.pre_norm:
|
|
596
|
-
x = self.
|
|
597
|
-
x = x + self.drop_path(self.
|
|
598
|
-
x = self.
|
|
599
|
-
x = x + self.drop_path(self.
|
|
596
|
+
x = self.pre_attention_norm(x)
|
|
597
|
+
x = x + self.drop_path(self.attn(x, x, x))
|
|
598
|
+
x = self.pre_mlp_norm(x)
|
|
599
|
+
x = x + self.drop_path(self.ff(x))
|
|
600
600
|
if self.post_norm: # i.e. in addition! Pre and post.
|
|
601
|
-
x = self.
|
|
602
|
-
elif self.post_norm: # i.e. only, not prenorm, just post
|
|
603
|
-
x = x + self.drop_path(self.layerscale1(self.attn(x, x, x)))
|
|
604
|
-
x = self.layer_norm_1(x)
|
|
605
|
-
x = x + self.drop_path(self.layerscale2(self.ff(x)))
|
|
606
|
-
x = self.layer_norm_2(x)
|
|
607
|
-
else: # Not pre or post norm. Stand well back.
|
|
608
|
-
x = x + self.drop_path(self.layerscale1(self.attn(x, x, x)))
|
|
609
|
-
x = x + self.drop_path(self.layerscale2(self.ff(x)))
|
|
601
|
+
x = self.post_mlp_norm(x)
|
|
610
602
|
|
|
611
603
|
# if self.pre_norm:
|
|
612
604
|
# process_x = self.pre_attention_norm(x)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|