sequence-layers 0.1__tar.gz → 0.2__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.
Files changed (72) hide show
  1. {sequence_layers-0.1 → sequence_layers-0.2}/PKG-INFO +40 -9
  2. sequence_layers-0.2/README.md +64 -0
  3. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/__init__.py +1 -1
  4. sequence_layers-0.2/sequence_layers/jax/attention/__init__.py +56 -0
  5. sequence_layers-0.2/sequence_layers/jax/attention/blockwise_dot_product_self_attention.py +693 -0
  6. sequence_layers-0.2/sequence_layers/jax/attention/common.py +2430 -0
  7. sequence_layers-0.2/sequence_layers/jax/attention/dot_product_attention.py +576 -0
  8. sequence_layers-0.2/sequence_layers/jax/attention/dot_product_self_attention.py +856 -0
  9. sequence_layers-0.2/sequence_layers/jax/attention/dot_product_self_attention_v2.py +740 -0
  10. sequence_layers-0.2/sequence_layers/jax/attention/gmm_attention.py +444 -0
  11. sequence_layers-0.2/sequence_layers/jax/attention/local_dot_product_self_attention.py +805 -0
  12. sequence_layers-0.2/sequence_layers/jax/attention/multi_source_dot_product_attention.py +496 -0
  13. sequence_layers-0.2/sequence_layers/jax/attention/shaw_relative_position_embedding.py +144 -0
  14. sequence_layers-0.2/sequence_layers/jax/attention/streaming_dot_product_attention.py +860 -0
  15. sequence_layers-0.2/sequence_layers/jax/attention/streaming_local_dot_product_attention.py +846 -0
  16. sequence_layers-0.2/sequence_layers/jax/attention/t5_relative_position_embedding.py +184 -0
  17. sequence_layers-0.2/sequence_layers/jax/attention/test_utils.py +202 -0
  18. sequence_layers-0.2/sequence_layers/jax/attention/transformer_xl_relative_position_embedding.py +222 -0
  19. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/combinators.py +95 -27
  20. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/conditioning.py +7 -1
  21. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/convolution.py +198 -29
  22. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/dense.py +37 -5
  23. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/dsp.py +49 -17
  24. sequence_layers-0.2/sequence_layers/jax/examples/global_style_token.py +180 -0
  25. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/export.py +1 -1
  26. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/meta.py +2 -0
  27. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/normalization.py +227 -0
  28. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/pooling.py +480 -482
  29. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/recurrent.py +12 -5
  30. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/sharding.py +1 -1
  31. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/simple.py +372 -12
  32. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/test_utils.py +43 -21
  33. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/time_varying.py +18 -3
  34. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/types.py +80 -28
  35. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/utils.py +207 -61
  36. sequence_layers-0.1/README.md +0 -33
  37. sequence_layers-0.1/sequence_layers/jax/attention.py +0 -6124
  38. {sequence_layers-0.1 → sequence_layers-0.2}/LICENSE +0 -0
  39. {sequence_layers-0.1 → sequence_layers-0.2}/pyproject.toml +0 -0
  40. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/internal/types.py +0 -0
  41. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/__init__.py +0 -0
  42. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/examples/gemma3n_audio_encoder.py +0 -0
  43. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/position.py +0 -0
  44. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/signal.py +0 -0
  45. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/jax/typing.py +0 -0
  46. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/__init__.py +0 -0
  47. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/attention.py +0 -0
  48. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/combinators.py +0 -0
  49. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/conditioning.py +0 -0
  50. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/convolution.py +0 -0
  51. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/dense.py +0 -0
  52. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/dsp.py +0 -0
  53. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/bert.py +0 -0
  54. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/conformer.py +0 -0
  55. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/deep_voice.py +0 -0
  56. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/listen_attend_spell.py +0 -0
  57. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/mobilenet.py +0 -0
  58. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/t5.py +0 -0
  59. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/tacotron.py +0 -0
  60. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/transformer.py +0 -0
  61. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/very_attentive_tacotron.py +0 -0
  62. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/examples/wavernn.py +0 -0
  63. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/normalization.py +0 -0
  64. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/pooling.py +0 -0
  65. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/position.py +0 -0
  66. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/recurrent.py +0 -0
  67. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/simple.py +0 -0
  68. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/squeeze.py +0 -0
  69. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/test_util.py +0 -0
  70. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/time_varying.py +0 -0
  71. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/types.py +0 -0
  72. {sequence_layers-0.1 → sequence_layers-0.2}/sequence_layers/tensorflow/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sequence_layers
3
- Version: 0.1
3
+ Version: 0.2
4
4
  Summary: Sequence Layers neural network layer library from Google.
5
5
  Keywords:
6
6
  Author-email: RJ Skerry-Ryan <rjryan@google.com>
@@ -35,13 +35,32 @@ Provides-Extra: tensorflow
35
35
 
36
36
  # Sequence Layers
37
37
 
38
- Note: This is not an officially supported Google product
38
+ A neural network API and library (currently in Jax and TensorFlow 2) for easy
39
+ creation of sequence models that can be executed both layer-by-layer (e.g.
40
+ teacher forced training) and step-by-step (e.g. autoregressive sampling). It
41
+ mitigates many common bugs arising in both streaming and parallel sequence
42
+ processing around padding, resampling, and causality while giving a composable,
43
+ declarative syntax.
39
44
 
40
- ## Overview
45
+ You can read more about the design and features of SequenceLayers in our
46
+ [technical report](https://arxiv.org/abs/2507.23292), or quickly get started
47
+ with our intro notebook:
41
48
 
42
- A library for sequence modeling in Jax and TensorFlow 2, enabling easy creation
43
- of sequence models that can be executed both layer-by-layer (e.g. teacher forced
44
- training) and step-by-step (e.g. autoregressive sampling).
49
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google/sequence-layers/blob/main/notebooks/intro.ipynb)
50
+
51
+ **Note:** Only Jax support is installed by default. Use
52
+ `pip install sequence_layers[tensorflow]` for TensorFlow.
53
+
54
+ **We welcome contributions!** To do this, clone the repo and install developer
55
+ dependencies via `pip install -e .[dev]` (or `.[dev,tensorflow]`, etc.) to allow
56
+ running tests, e.g., `pytest -n auto sequence_layers/jax` to do so over multiple
57
+ workers. See the [contributing guide](CONTRIBUTING.md).
58
+
59
+ **Disclaimer:** This is not an officially supported Google product.
60
+
61
+ ## Streamable networks, out of the box
62
+
63
+ ![Diagram depicting the benefits of SequenceLayers. A model is declaratively defined once, and then is immediately steppable.](./diagram.png)
45
64
 
46
65
  A key feature of the library is that layers support streaming (step-by-step)
47
66
  operation. To achieve this, every layer has a notion of state when and a `step`
@@ -50,9 +69,6 @@ libraries like Keras. When layers support a `step` method, their `layer` method
50
69
  produces identical results for the same sequence of input blocks enabling easy
51
70
  switching between step-wise and layer-wise processing depending on the use case.
52
71
 
53
- **Note:** Only Jax support is installed by default. Use
54
- `pip install sequence_layers[tensorflow]` for TensorFlow.
55
-
56
72
  ## Goals
57
73
 
58
74
  Increased development velocity for both research and production applications of
@@ -67,3 +83,18 @@ sequence modeling.
67
83
  * A quick path to deployment with tf.lite support for every layer.
68
84
  * Tracking of invalid timesteps (those computed from padding).
69
85
 
86
+ ## Citation
87
+
88
+ If you found this library or its design concepts useful, we'd greatly appreciate
89
+ a citation of our technical report:
90
+
91
+ ```
92
+ @article{skerryryan2025sequencelayers,
93
+ author = {RJ Skerry-Ryan and Julian Salazar and Soroosh Mariooryad and David Kao and Daisy Stanton and Eric Battenberg and Matt Shannon and Ron J. Weiss and Robin Scheibler and Jonas Rothfuss and Tom Bagby},
94
+ title = {{S}equence{L}ayers: {S}equence Processing and Streaming Neural Networks Made Easy},
95
+ journal = {CoRR},
96
+ volume = {abs/2507.23292},
97
+ year = {2025}
98
+ }
99
+ ```
100
+
@@ -0,0 +1,64 @@
1
+ # Sequence Layers
2
+
3
+ A neural network API and library (currently in Jax and TensorFlow 2) for easy
4
+ creation of sequence models that can be executed both layer-by-layer (e.g.
5
+ teacher forced training) and step-by-step (e.g. autoregressive sampling). It
6
+ mitigates many common bugs arising in both streaming and parallel sequence
7
+ processing around padding, resampling, and causality while giving a composable,
8
+ declarative syntax.
9
+
10
+ You can read more about the design and features of SequenceLayers in our
11
+ [technical report](https://arxiv.org/abs/2507.23292), or quickly get started
12
+ with our intro notebook:
13
+
14
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google/sequence-layers/blob/main/notebooks/intro.ipynb)
15
+
16
+ **Note:** Only Jax support is installed by default. Use
17
+ `pip install sequence_layers[tensorflow]` for TensorFlow.
18
+
19
+ **We welcome contributions!** To do this, clone the repo and install developer
20
+ dependencies via `pip install -e .[dev]` (or `.[dev,tensorflow]`, etc.) to allow
21
+ running tests, e.g., `pytest -n auto sequence_layers/jax` to do so over multiple
22
+ workers. See the [contributing guide](CONTRIBUTING.md).
23
+
24
+ **Disclaimer:** This is not an officially supported Google product.
25
+
26
+ ## Streamable networks, out of the box
27
+
28
+ ![Diagram depicting the benefits of SequenceLayers. A model is declaratively defined once, and then is immediately steppable.](./diagram.png)
29
+
30
+ A key feature of the library is that layers support streaming (step-by-step)
31
+ operation. To achieve this, every layer has a notion of state when and a `step`
32
+ function in addition to the typical layer-wise processing feature found in other
33
+ libraries like Keras. When layers support a `step` method, their `layer` method
34
+ produces identical results for the same sequence of input blocks enabling easy
35
+ switching between step-wise and layer-wise processing depending on the use case.
36
+
37
+ ## Goals
38
+
39
+ Increased development velocity for both research and production applications of
40
+ sequence modeling.
41
+
42
+ * Support for layer-by-layer and step-by-step processing in a single
43
+ implementation.
44
+ * Declarative API.
45
+ * Composable, thin abstractions.
46
+ * Easy mix-and-match of popular sequence modeling paradigms (convolutional,
47
+ recurrent, attention architectures).
48
+ * A quick path to deployment with tf.lite support for every layer.
49
+ * Tracking of invalid timesteps (those computed from padding).
50
+
51
+ ## Citation
52
+
53
+ If you found this library or its design concepts useful, we'd greatly appreciate
54
+ a citation of our technical report:
55
+
56
+ ```
57
+ @article{skerryryan2025sequencelayers,
58
+ author = {RJ Skerry-Ryan and Julian Salazar and Soroosh Mariooryad and David Kao and Daisy Stanton and Eric Battenberg and Matt Shannon and Ron J. Weiss and Robin Scheibler and Jonas Rothfuss and Tom Bagby},
59
+ title = {{S}equence{L}ayers: {S}equence Processing and Streaming Neural Networks Made Easy},
60
+ journal = {CoRR},
61
+ volume = {abs/2507.23292},
62
+ year = {2025}
63
+ }
64
+ ```
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
  """Package directory file for Sequence Layers."""
15
15
 
16
- __version__ = '0.1'
16
+ __version__ = '0.2'
@@ -0,0 +1,56 @@
1
+ # Copyright 2026 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Attention layers."""
15
+
16
+ # pylint: disable=wildcard-import
17
+ from sequence_layers.jax.attention.blockwise_dot_product_self_attention import *
18
+ from sequence_layers.jax.attention.common import *
19
+ from sequence_layers.jax.attention.dot_product_attention import *
20
+ from sequence_layers.jax.attention.dot_product_self_attention import *
21
+ from sequence_layers.jax.attention.dot_product_self_attention_v2 import *
22
+ from sequence_layers.jax.attention.gmm_attention import *
23
+ from sequence_layers.jax.attention.local_dot_product_self_attention import *
24
+ from sequence_layers.jax.attention.multi_source_dot_product_attention import *
25
+ from sequence_layers.jax.attention.shaw_relative_position_embedding import *
26
+ from sequence_layers.jax.attention.streaming_dot_product_attention import *
27
+ from sequence_layers.jax.attention.streaming_local_dot_product_attention import *
28
+ from sequence_layers.jax.attention.t5_relative_position_embedding import *
29
+ from sequence_layers.jax.attention.transformer_xl_relative_position_embedding import *
30
+
31
+
32
+ # pylint: disable=undefined-all-variable
33
+ __all__ = (
34
+ # go/keep-sorted start
35
+ 'BlockwiseDotProductSelfAttention',
36
+ 'CombinedQueryKeyValueProjection',
37
+ 'CrossAttentionEmits',
38
+ 'DotProductAttention',
39
+ 'DotProductSelfAttention',
40
+ 'DotProductSelfAttentionV2',
41
+ 'GmmAttention',
42
+ 'InputProjectionModule',
43
+ 'LocalDotProductSelfAttention',
44
+ 'MultiSourceDotProductAttention',
45
+ 'QueryAndKeyValueProjection',
46
+ 'QueryAndSharedKeyValueProjection',
47
+ 'RelativePositionEmbedding',
48
+ 'SelfAttentionEmits',
49
+ 'SeparateQueryKeyValueProjection',
50
+ 'ShawRelativePositionEmbedding',
51
+ 'StreamingDotProductAttention',
52
+ 'StreamingLocalDotProductAttention',
53
+ 'T5RelativePositionEmbedding',
54
+ 'TransformerXLRelativePositionEmbedding',
55
+ # go/keep-sorted end
56
+ )