broccoli-ml 0.1.35__py3-none-any.whl → 0.1.37__py3-none-any.whl

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/vit.py CHANGED
@@ -3,6 +3,7 @@ from typing import Optional
3
3
 
4
4
  from .transformer import TransformerEncoder
5
5
  from .cnn import ConvLayer, ConcatPool
6
+ from .activation import ReLU, SquaredReLU, GELU, SwiGLU
6
7
  from einops import einsum
7
8
  from einops.layers.torch import Rearrange
8
9
  import torch.nn as nn
@@ -244,10 +245,27 @@ class CCT(nn.Module):
244
245
  image_classes=100,
245
246
  linear_module=nn.Linear,
246
247
  image_channels=3,
248
+ batch_norm=False,
247
249
  ):
248
250
 
249
251
  super().__init__()
250
252
 
253
+ if isinstance(cnn_activation, str):
254
+ cnn_activation = {
255
+ "ReLU": ReLU,
256
+ "SquaredReLU": SquaredReLU,
257
+ "GELU": GELU,
258
+ "SwiGLU": SwiGLU,
259
+ }[cnn_activation]
260
+
261
+ if isinstance(transformer_activation, str):
262
+ transformer_activation = {
263
+ "ReLU": ReLU,
264
+ "SquaredReLU": SquaredReLU,
265
+ "GELU": GELU,
266
+ "SwiGLU": SwiGLU,
267
+ }[transformer_activation]
268
+
251
269
  self.encoder = CCTEncoder(
252
270
  image_size=image_size,
253
271
  conv_kernel_size=conv_kernel_size,
@@ -275,6 +293,7 @@ class CCT(nn.Module):
275
293
  stochastic_depth=stochastic_depth,
276
294
  linear_module=linear_module,
277
295
  image_channels=image_channels,
296
+ batch_norm=batch_norm,
278
297
  )
279
298
  self.pool = SequencePool(
280
299
  transformer_embedding_size, linear_module, image_classes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: broccoli-ml
3
- Version: 0.1.35
3
+ Version: 0.1.37
4
4
  Summary: Some useful Pytorch models, circa 2025
5
5
  License: MIT
6
6
  Author: Nicholas Bailey
@@ -10,8 +10,8 @@ broccoli/rope.py,sha256=hw7kBPNR9GQXj4GxyIAffsGKPfcTPOFh8Bc7oEHtaZY,12108
10
10
  broccoli/tensor.py,sha256=E2JK5mQwJf75e23-JGcDoT7QxQf89DJReUo2et1LhRY,1716
11
11
  broccoli/transformer.py,sha256=gFBIEowGFPSgQhM1RwsRtQlw_WzVJPY-LJyf1MLtPek,16277
12
12
  broccoli/utils.py,sha256=htq_hOsdhUhL0nJi9WkKiEYOjEoWqFpK5X49PtgTf-0,299
13
- broccoli/vit.py,sha256=GQbhMl1kxdatc_7XKax_n86mKkLnpcudMDYVgb3RXtg,10780
14
- broccoli_ml-0.1.35.dist-info/LICENSE,sha256=0BAzJE5BqQ7Iixp_AFdB2W1uO-HCRX-Qfun8PHt6yVM,1073
15
- broccoli_ml-0.1.35.dist-info/METADATA,sha256=OGs5rbGvilFkiOwZrsx-Rph1iVKIlykmvCZaZQATBbc,1257
16
- broccoli_ml-0.1.35.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- broccoli_ml-0.1.35.dist-info/RECORD,,
13
+ broccoli/vit.py,sha256=Pp0fU2h5_tgdyJEKmN_ltXNDC3WWXoEiWUPzCuFy-gY,11409
14
+ broccoli_ml-0.1.37.dist-info/LICENSE,sha256=0BAzJE5BqQ7Iixp_AFdB2W1uO-HCRX-Qfun8PHt6yVM,1073
15
+ broccoli_ml-0.1.37.dist-info/METADATA,sha256=RyelojtfF_7Y72XsZSzWUsDIf5Gb5KbTcg6go74Wres,1257
16
+ broccoli_ml-0.1.37.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ broccoli_ml-0.1.37.dist-info/RECORD,,