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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: broccoli-ml
3
- Version: 12.1.0
3
+ Version: 12.3.0
4
4
  Summary: Some useful Pytorch models, circa 2025
5
5
  License: MIT
6
6
  Author: Nicholas Bailey
@@ -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.layer_norm_1(x)
597
- x = x + self.drop_path(self.layerscale1(self.attn(x, x, x)))
598
- x = self.layer_norm_2(x)
599
- x = x + self.drop_path(self.layerscale2(self.ff(x)))
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.layer_norm_3(x)
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)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "broccoli-ml"
3
- version = "12.1.0"
3
+ version = "12.3.0"
4
4
  description = "Some useful Pytorch models, circa 2025"
5
5
  authors = [
6
6
  {name = "Nicholas Bailey"}
File without changes
File without changes