broccoli-ml 0.3.0__py3-none-any.whl → 0.4.0__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 +12 -11
- {broccoli_ml-0.3.0.dist-info → broccoli_ml-0.4.0.dist-info}/METADATA +1 -1
- {broccoli_ml-0.3.0.dist-info → broccoli_ml-0.4.0.dist-info}/RECORD +5 -5
- {broccoli_ml-0.3.0.dist-info → broccoli_ml-0.4.0.dist-info}/LICENSE +0 -0
- {broccoli_ml-0.3.0.dist-info → broccoli_ml-0.4.0.dist-info}/WHEEL +0 -0
broccoli/vit.py
CHANGED
@@ -49,7 +49,7 @@ class SequencePool(nn.Module):
|
|
49
49
|
return self.norm(projection)
|
50
50
|
|
51
51
|
|
52
|
-
class
|
52
|
+
class DCTEncoder(nn.Module):
|
53
53
|
"""
|
54
54
|
Based on the Compact Convolutional Transformer (CCT) of [Hasani et al. (2021)
|
55
55
|
*''Escaping the Big Data Paradigm with Compact Transformers''*](
|
@@ -69,20 +69,20 @@ class CCTEncoder(nn.Module):
|
|
69
69
|
cnn_kernel_padding="same",
|
70
70
|
cnn_kernel_dilation=1,
|
71
71
|
cnn_kernel_groups=1,
|
72
|
-
cnn_activation: nn.Module =
|
72
|
+
cnn_activation: nn.Module = ReLU,
|
73
73
|
cnn_activation_kwargs: Optional[dict] = None,
|
74
74
|
cnn_dropout=0.0,
|
75
|
-
pooling_type="
|
75
|
+
pooling_type="concat", # maxpool or concat
|
76
76
|
pooling_kernel_size=3,
|
77
77
|
pooling_kernel_stride=2,
|
78
78
|
pooling_kernel_padding=1,
|
79
|
-
transformer_position_embedding="
|
79
|
+
transformer_position_embedding="relative", # absolute or relative
|
80
80
|
transformer_embedding_size=256,
|
81
81
|
transformer_layers=7,
|
82
82
|
transformer_heads=4,
|
83
83
|
transformer_mlp_ratio=2,
|
84
84
|
transformer_bos_tokens=4,
|
85
|
-
transformer_activation: nn.Module =
|
85
|
+
transformer_activation: nn.Module = SquaredReLU,
|
86
86
|
transformer_activation_kwargs: Optional[dict] = None,
|
87
87
|
mlp_dropout=0.0,
|
88
88
|
msa_dropout=0.1,
|
@@ -291,8 +291,9 @@ class CCTEncoder(nn.Module):
|
|
291
291
|
return self.encoder(x)
|
292
292
|
|
293
293
|
|
294
|
-
class
|
294
|
+
class DCT(nn.Module):
|
295
295
|
"""
|
296
|
+
Denoising convolutional transformer
|
296
297
|
Based on the Compact Convolutional Transformer (CCT) of [Hasani et al. (2021)
|
297
298
|
*''Escaping the Big Data Paradigm with Compact Transformers''*](
|
298
299
|
https://arxiv.org/abs/2104.05704). It's a convolutional neural network
|
@@ -309,20 +310,20 @@ class CCT(nn.Module):
|
|
309
310
|
cnn_kernel_padding="same",
|
310
311
|
cnn_kernel_dilation=1,
|
311
312
|
cnn_kernel_groups=1,
|
312
|
-
cnn_activation: nn.Module =
|
313
|
+
cnn_activation: nn.Module = ReLU,
|
313
314
|
cnn_activation_kwargs: Optional[dict] = None,
|
314
315
|
cnn_dropout=0.0,
|
315
|
-
pooling_type="
|
316
|
+
pooling_type="concat", # maxpool or concat
|
316
317
|
pooling_kernel_size=3,
|
317
318
|
pooling_kernel_stride=2,
|
318
319
|
pooling_kernel_padding=1,
|
319
|
-
transformer_position_embedding="
|
320
|
+
transformer_position_embedding="relative", # absolute or relative
|
320
321
|
transformer_embedding_size=256,
|
321
322
|
transformer_layers=7,
|
322
323
|
transformer_heads=4,
|
323
324
|
transformer_mlp_ratio=2,
|
324
325
|
transformer_bos_tokens=4,
|
325
|
-
transformer_activation: nn.Module =
|
326
|
+
transformer_activation: nn.Module = SquaredReLU,
|
326
327
|
transformer_activation_kwargs: Optional[dict] = None,
|
327
328
|
mlp_dropout=0.0,
|
328
329
|
msa_dropout=0.1,
|
@@ -350,7 +351,7 @@ class CCT(nn.Module):
|
|
350
351
|
"SwiGLU": SwiGLU,
|
351
352
|
}[transformer_activation]
|
352
353
|
|
353
|
-
self.encoder =
|
354
|
+
self.encoder = DCTEncoder(
|
354
355
|
input_size=input_size,
|
355
356
|
cnn_in_channels=cnn_in_channels,
|
356
357
|
minimum_cnn_out_channels=minimum_cnn_out_channels,
|
@@ -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=23R58t3TLZMb9ulhCtQ3gXu0mPlfyPvLM8TaGOpaz58,16310
|
12
12
|
broccoli/utils.py,sha256=htq_hOsdhUhL0nJi9WkKiEYOjEoWqFpK5X49PtgTf-0,299
|
13
|
-
broccoli/vit.py,sha256=
|
14
|
-
broccoli_ml-0.
|
15
|
-
broccoli_ml-0.
|
16
|
-
broccoli_ml-0.
|
17
|
-
broccoli_ml-0.
|
13
|
+
broccoli/vit.py,sha256=wPovWrrK-s7rPcAqvvGUWXu2v_77-GMIgmgb6G_y2x8,13869
|
14
|
+
broccoli_ml-0.4.0.dist-info/LICENSE,sha256=0BAzJE5BqQ7Iixp_AFdB2W1uO-HCRX-Qfun8PHt6yVM,1073
|
15
|
+
broccoli_ml-0.4.0.dist-info/METADATA,sha256=88B7KqQ9zmxkzelSdhVirPbla09qQbpQrwilC6xTCng,1256
|
16
|
+
broccoli_ml-0.4.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
17
|
+
broccoli_ml-0.4.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|