lalamo 0.6.0__py3-none-any.whl → 0.6.1__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.
- lalamo/__init__.py +1 -1
- lalamo/modules/token_mixers/mamba.py +17 -1
- lalamo/modules/token_mixers/short_conv.py +2 -2
- {lalamo-0.6.0.dist-info → lalamo-0.6.1.dist-info}/METADATA +1 -1
- {lalamo-0.6.0.dist-info → lalamo-0.6.1.dist-info}/RECORD +9 -9
- {lalamo-0.6.0.dist-info → lalamo-0.6.1.dist-info}/WHEEL +1 -1
- {lalamo-0.6.0.dist-info → lalamo-0.6.1.dist-info}/entry_points.txt +0 -0
- {lalamo-0.6.0.dist-info → lalamo-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {lalamo-0.6.0.dist-info → lalamo-0.6.1.dist-info}/top_level.txt +0 -0
lalamo/__init__.py
CHANGED
|
@@ -112,6 +112,7 @@ class SeparableCausalConv(LalamoModule[SeparableCausalConvConfig]):
|
|
|
112
112
|
def __call__(
|
|
113
113
|
self,
|
|
114
114
|
inputs: Float[Array, "suffix_tokens channels"],
|
|
115
|
+
length_without_padding: Int[Array, ""] | int | None = None,
|
|
115
116
|
state: Float[Array, "prefix_tokens channels"] | None = None,
|
|
116
117
|
return_updated_state: bool = False,
|
|
117
118
|
) -> CausalConvResult:
|
|
@@ -136,9 +137,23 @@ class SeparableCausalConv(LalamoModule[SeparableCausalConvConfig]):
|
|
|
136
137
|
if self.biases is not None:
|
|
137
138
|
results = results + self.biases
|
|
138
139
|
|
|
140
|
+
if return_updated_state:
|
|
141
|
+
if length_without_padding is None:
|
|
142
|
+
length_without_padding = num_suffix_tokens
|
|
143
|
+
length_without_padding = jnp.asarray(length_without_padding, dtype=jnp.int32)
|
|
144
|
+
length_without_padding = jnp.clip(length_without_padding, 0, num_suffix_tokens)
|
|
145
|
+
updated_state = jax.lax.dynamic_slice_in_dim(
|
|
146
|
+
inputs_with_history,
|
|
147
|
+
start_index=length_without_padding,
|
|
148
|
+
slice_size=self.kernel_size - 1,
|
|
149
|
+
axis=0,
|
|
150
|
+
)
|
|
151
|
+
else:
|
|
152
|
+
updated_state = None
|
|
153
|
+
|
|
139
154
|
return CausalConvResult(
|
|
140
155
|
results,
|
|
141
|
-
|
|
156
|
+
updated_state,
|
|
142
157
|
)
|
|
143
158
|
|
|
144
159
|
def export_weights(self) -> ParameterTree:
|
|
@@ -436,6 +451,7 @@ class Mamba2(TokenMixerBase[Mamba2Config, Mamba2StateLayer]):
|
|
|
436
451
|
|
|
437
452
|
conv_output, updated_conv_state = self.conv(
|
|
438
453
|
conv_inputs,
|
|
454
|
+
length_without_padding,
|
|
439
455
|
state.conv_state,
|
|
440
456
|
return_updated_state=return_updated_state,
|
|
441
457
|
)
|
|
@@ -116,7 +116,7 @@ class ShortConv(TokenMixerBase[ShortConvConfig, ShortConvStateLayer]):
|
|
|
116
116
|
positional_embeddings: PositionalEmbeddings | None,
|
|
117
117
|
state: ShortConvStateLayer | None = None,
|
|
118
118
|
return_updated_state: bool = False,
|
|
119
|
-
length_without_padding: Int[Array, ""] | int | None = None,
|
|
119
|
+
length_without_padding: Int[Array, ""] | int | None = None,
|
|
120
120
|
) -> TokenMixerResult[ShortConvStateLayer]:
|
|
121
121
|
if positional_embeddings is not None:
|
|
122
122
|
raise ValueError("Positional embeddings are not supported for ShortConv.")
|
|
@@ -124,7 +124,7 @@ class ShortConv(TokenMixerBase[ShortConvConfig, ShortConvStateLayer]):
|
|
|
124
124
|
pre_conv_gate, post_conv_gate, x = vmap(self.in_projection)(inputs)
|
|
125
125
|
|
|
126
126
|
prev_conv_state = state.conv_state if state is not None else None
|
|
127
|
-
conv_output = self.conv(x * pre_conv_gate, prev_conv_state, return_updated_state)
|
|
127
|
+
conv_output = self.conv(x * pre_conv_gate, length_without_padding, prev_conv_state, return_updated_state)
|
|
128
128
|
|
|
129
129
|
(outputs,) = vmap(self.out_projection)(conv_output.outputs * post_conv_gate)
|
|
130
130
|
updated_conv_state = conv_output.state
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
lalamo/__init__.py,sha256=
|
|
1
|
+
lalamo/__init__.py,sha256=XBfWi6pPtdWFEQRvMxVw8KGoqWxIFq01Z2zBxqNp7BE,1386
|
|
2
2
|
lalamo/commands.py,sha256=zXyyrLTHhP9wouwtpX4RUZeEF6No-_9ee-y_GWGhw7k,10972
|
|
3
3
|
lalamo/common.py,sha256=WaNJx20eUX4CBF50aym9lniGAiX-SzBJzDzO5Jh6zXA,4312
|
|
4
4
|
lalamo/main.py,sha256=Tez84CtMxUi1ySuRSqQElu4Zr1UWs_Gw6HX1xtCZknQ,27383
|
|
@@ -74,8 +74,8 @@ lalamo/modules/utils.py,sha256=t_TayWT6g5LtYKhJaod-u_COWaI_VbNd3eYek9Nj0lc,441
|
|
|
74
74
|
lalamo/modules/token_mixers/__init__.py,sha256=lwxUl0eG5IvuVc_HOsINP2vtbv9F0cUmSNHFHaEmPGk,1109
|
|
75
75
|
lalamo/modules/token_mixers/attention.py,sha256=ielw1-KWBfCPCPmzSHgM0TaSUcmSkWKTxrN3N_FsGm4,16144
|
|
76
76
|
lalamo/modules/token_mixers/common.py,sha256=CcrbXXvGU27uxGLh5L-G8VDtcOiW5Wpm13uBEOd6lVg,1986
|
|
77
|
-
lalamo/modules/token_mixers/mamba.py,sha256=
|
|
78
|
-
lalamo/modules/token_mixers/short_conv.py,sha256=
|
|
77
|
+
lalamo/modules/token_mixers/mamba.py,sha256=zV5CnhEbAtJ32V32a2VZGsbjZ-sohMqRbR5kW9XH1AI,19087
|
|
78
|
+
lalamo/modules/token_mixers/short_conv.py,sha256=k1z9UwcJGag2NHWad7cYiAnhxULtmva9RrdhqVbir18,5085
|
|
79
79
|
lalamo/modules/token_mixers/state/__init__.py,sha256=OKWPmiwszMWgwamewoVHd28owanHAO2j2e30Iivtv-4,384
|
|
80
80
|
lalamo/modules/token_mixers/state/common.py,sha256=dcwBevAdeJpBjf7_YRk7TKrJHsCnpljhfzZy-3h9898,661
|
|
81
81
|
lalamo/modules/token_mixers/state/kv_cache.py,sha256=QfnS3XgSmyDI9MBUbeLI4ABHLxiMcXDbZsqe0fd3KQo,8788
|
|
@@ -87,9 +87,9 @@ lalamo/speculator/estimator.py,sha256=S_TRwMnjWg5qt9le2AYua_Vmo6QkIT-0Si7TjCfC7x
|
|
|
87
87
|
lalamo/speculator/inference.py,sha256=5GntUgj0HQLeLn3HIHnVX8EEO0EBzmKeP5-_U7kdFAM,3670
|
|
88
88
|
lalamo/speculator/ngram.py,sha256=Fy3A-oVxZql3gE5M5ot0hKPu0772-kcEPDvD9MkldpA,5889
|
|
89
89
|
lalamo/speculator/utils.py,sha256=0wZoMMIzzk0Q-3zq5H5f-JBplePNHxywndkrNtOJOyo,1697
|
|
90
|
-
lalamo-0.6.
|
|
91
|
-
lalamo-0.6.
|
|
92
|
-
lalamo-0.6.
|
|
93
|
-
lalamo-0.6.
|
|
94
|
-
lalamo-0.6.
|
|
95
|
-
lalamo-0.6.
|
|
90
|
+
lalamo-0.6.1.dist-info/licenses/LICENSE,sha256=diHRfjSEJHD1nnEeMIfMRCjR3UERf8bT3eseD6b1ayA,1072
|
|
91
|
+
lalamo-0.6.1.dist-info/METADATA,sha256=eAuWPVMZl52_KExdalios28l6mOQmKgE3EcIUGUKd4k,3112
|
|
92
|
+
lalamo-0.6.1.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
93
|
+
lalamo-0.6.1.dist-info/entry_points.txt,sha256=qli7qTfnBk5WP10rOGXXEckHMtt-atJMDWd8jN89Uks,43
|
|
94
|
+
lalamo-0.6.1.dist-info/top_level.txt,sha256=VHvWL5JN5XRG36NsN_MieJ7EwRihEOrEjyDaTdFJ-aI,7
|
|
95
|
+
lalamo-0.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|