broccoli-ml 0.18.0__tar.gz → 0.18.1__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-0.18.0 → broccoli_ml-0.18.1}/PKG-INFO +1 -1
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/transformer.py +11 -1
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/pyproject.toml +1 -1
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/LICENSE +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/README.md +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/__init__.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/activation.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/assets/2025_resnet_imagenet_1k_pretrained_state_dict.pkl +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/assets/cifar100_eigenvectors_size_2.pt +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/assets/cifar100_eigenvectors_size_3.pt +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/cnn.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/eigenpatches.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/linear.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/rope.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/tensor.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/utils.py +0 -0
- {broccoli_ml-0.18.0 → broccoli_ml-0.18.1}/broccoli/vit.py +0 -0
@@ -236,6 +236,7 @@ class FeedforwardBlock(nn.Module):
|
|
236
236
|
activation_kwargs=None,
|
237
237
|
dropout=0.0,
|
238
238
|
linear_module=nn.Linear,
|
239
|
+
regularise_values=True,
|
239
240
|
):
|
240
241
|
super().__init__()
|
241
242
|
|
@@ -252,13 +253,22 @@ class FeedforwardBlock(nn.Module):
|
|
252
253
|
else ratio * output_features
|
253
254
|
)
|
254
255
|
|
256
|
+
if regularise_values:
|
257
|
+
self.memory_type = SpectralNormLinear
|
258
|
+
self.bias_memories = False
|
259
|
+
else:
|
260
|
+
self.memory_type = nn.Linear
|
261
|
+
self.bias_memories = True
|
262
|
+
|
255
263
|
self.process = nn.Sequential(
|
256
264
|
*[
|
257
265
|
nn.LayerNorm(input_features),
|
258
266
|
linear_module(input_features, self.max_features),
|
259
267
|
self.activation,
|
260
268
|
nn.LayerNorm(ratio * output_features),
|
261
|
-
|
269
|
+
self.memory_type(
|
270
|
+
ratio * output_features, output_features, bias=self.bias_memories
|
271
|
+
),
|
262
272
|
self.dropout,
|
263
273
|
]
|
264
274
|
)
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|