broccoli-ml 0.39.0__tar.gz → 1.0.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: 0.39.0
3
+ Version: 1.0.0
4
4
  Summary: Some useful Pytorch models, circa 2025
5
5
  License: MIT
6
6
  Author: Nicholas Bailey
@@ -85,6 +85,14 @@ class SequencePoolClassificationHead(ClassificationHead):
85
85
  def __init__(self, d_model, linear_module, out_dim, batch_norm=True):
86
86
  super().__init__(d_model, linear_module, out_dim, batch_norm=batch_norm)
87
87
  self.summarize = SequencePool(d_model, linear_module)
88
+ # Rebuild the classification process with the correct summary module:
89
+ self.classification_process = nn.Sequential(
90
+ *[
91
+ self.summarize,
92
+ self.projection,
93
+ self.batch_norm,
94
+ ]
95
+ )
88
96
 
89
97
 
90
98
  class ViTEncoder(nn.Module):
@@ -120,6 +128,7 @@ class ViTEncoder(nn.Module):
120
128
  transformer_initial_ff_residual_path=True,
121
129
  transformer_initial_ff_linear_module_up=None,
122
130
  transformer_initial_ff_linear_module_down=None,
131
+ transformer_initial_ff_mlp_dropout=None,
123
132
  transformer_pre_norm=True,
124
133
  transformer_normformer=False,
125
134
  transformer_post_norm=False,
@@ -307,7 +316,12 @@ class ViTEncoder(nn.Module):
307
316
  transformer_embedding_size,
308
317
  activation=transformer_activation,
309
318
  activation_kwargs=transformer_activation_kwargs,
310
- dropout=transformer_mlp_dropout,
319
+ dropout=(
320
+ # First truthy assigned value
321
+ transformer_initial_ff_mlp_dropout
322
+ if transformer_initial_ff_mlp_dropout is not None
323
+ else transformer_mlp_dropout
324
+ ),
311
325
  linear_module_up=(
312
326
  # First truthy assigned value
313
327
  transformer_initial_ff_linear_module_up
@@ -349,11 +363,7 @@ class ViTEncoder(nn.Module):
349
363
 
350
364
  class ViT(nn.Module):
351
365
  """
352
- Denoising convolutional transformer
353
- Based on the Compact Convolutional Transformer (CCT) of [Hasani et al. (2021)
354
- *''Escaping the Big Data Paradigm with Compact Transformers''*](
355
- https://arxiv.org/abs/2104.05704). It's a convolutional neural network
356
- leading into a transformer encoder, followed by a sequence pooling layer.
366
+ ...
357
367
  """
358
368
 
359
369
  def __init__(
@@ -380,6 +390,7 @@ class ViT(nn.Module):
380
390
  transformer_initial_ff_residual_path=True,
381
391
  transformer_initial_ff_linear_module_up=None,
382
392
  transformer_initial_ff_linear_module_down=None,
393
+ transformer_initial_ff_mlp_dropout=None,
383
394
  transformer_pre_norm=True,
384
395
  transformer_normformer=False,
385
396
  transformer_post_norm=False,
@@ -442,6 +453,7 @@ class ViT(nn.Module):
442
453
  transformer_initial_ff_residual_path=transformer_initial_ff_residual_path,
443
454
  transformer_initial_ff_linear_module_up=transformer_initial_ff_linear_module_up,
444
455
  transformer_initial_ff_linear_module_down=transformer_initial_ff_linear_module_down,
456
+ transformer_initial_ff_mlp_dropout=transformer_initial_ff_mlp_dropout,
445
457
  transformer_pre_norm=transformer_pre_norm,
446
458
  transformer_normformer=transformer_normformer,
447
459
  transformer_post_norm=transformer_post_norm,
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "broccoli-ml"
3
- version = "0.39.0"
3
+ version = "1.0.0"
4
4
  description = "Some useful Pytorch models, circa 2025"
5
5
  authors = [
6
6
  {name = "Nicholas Bailey"}
File without changes
File without changes