stackformers 5.0.0rc20__tar.gz → 5.0.0rc22__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 (191) hide show
  1. stackformers-5.0.0rc22/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  2. stackformers-5.0.0rc22/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
  3. stackformers-5.0.0rc22/.github/pull_request_template.md +13 -0
  4. stackformers-5.0.0rc22/.github/workflows/check.yml +36 -0
  5. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/CHANGELOG.md +32 -0
  6. stackformers-5.0.0rc22/CITATION.cff +11 -0
  7. stackformers-5.0.0rc22/CONTRIBUTING.md +31 -0
  8. stackformers-5.0.0rc22/PKG-INFO +189 -0
  9. stackformers-5.0.0rc22/README.md +138 -0
  10. stackformers-5.0.0rc20/PKG-INFO → stackformers-5.0.0rc22/docs/api-guide.md +74 -77
  11. stackformers-5.0.0rc22/docs/assets/social-preview.jpg +0 -0
  12. stackformers-5.0.0rc22/docs/assets/social-preview.md +25 -0
  13. stackformers-5.0.0rc22/docs/compatibility.md +42 -0
  14. stackformers-5.0.0rc22/docs/improvement-plan.md +79 -0
  15. stackformers-5.0.0rc22/docs/research.md +74 -0
  16. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/examples/causal_language_model.py +5 -2
  17. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/examples/encoder_decoder_onnxruntime.py +16 -15
  18. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/examples/image_encoder.py +3 -3
  19. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/examples/padded_and_packed.py +5 -17
  20. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/examples/point_cloud_encoder.py +2 -2
  21. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/examples/subclassed_encoder.py +2 -5
  22. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/pyproject.toml +5 -3
  23. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/pytest.ini +1 -0
  24. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/__init__.py +19 -2
  25. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/all_valid_decoder.py +11 -11
  26. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/README.md +9 -3
  27. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/all_valid.py +3 -3
  28. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/bias.py +2 -2
  29. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/cached.py +5 -5
  30. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/cross_attn.py +15 -18
  31. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/distance_bias.py +2 -2
  32. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/layout.py +6 -6
  33. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/ops.py +5 -5
  34. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/packed_cross_attn.py +14 -17
  35. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/packed_self_attn.py +7 -9
  36. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/protocols.py +6 -6
  37. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/self_attn.py +8 -10
  38. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/varlen_backend.py +5 -5
  39. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/decoder_cache.py +22 -22
  40. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/mlm/README.md +2 -2
  41. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/mlm/masking.py +3 -3
  42. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/mlm/protocols.py +1 -1
  43. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/mlm/wrapper.py +1 -1
  44. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/preallocated_decoder.py +3 -3
  45. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/presets/README.md +1 -1
  46. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/presets/cross_attender.py +2 -2
  47. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/presets/encoder.py +3 -3
  48. stackformers-5.0.0rc22/stackformers/sequence.py +484 -0
  49. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_cross_attn_cache.py +3 -1
  50. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/export_utils.py +50 -26
  51. stackformers-5.0.0rc22/tests/test_export_utils.py +148 -0
  52. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_public_api.py +2 -0
  53. stackformers-5.0.0rc22/tests/test_sequence.py +400 -0
  54. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/uv.lock +1 -1
  55. stackformers-5.0.0rc20/README.md +0 -304
  56. stackformers-5.0.0rc20/stackformers/sequence.py +0 -223
  57. stackformers-5.0.0rc20/tests/test_sequence.py +0 -219
  58. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/.claudeignore +0 -0
  59. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/.gitignore +0 -0
  60. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/.python-version +0 -0
  61. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/.vscode/settings.json +0 -0
  62. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/AGENTS.md +0 -0
  63. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/Justfile +0 -0
  64. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/LICENSE +0 -0
  65. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/PLAN.md +0 -0
  66. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/docs/inference.md +0 -0
  67. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/examples/README.md +0 -0
  68. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/pyrefly.toml +0 -0
  69. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/ruff.toml +0 -0
  70. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/DEVLOG.md +0 -0
  71. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/_decoder_equations.py +0 -0
  72. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/_projection_packing.py +0 -0
  73. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/_result.py +0 -0
  74. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/__init__.py +0 -0
  75. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/cache.py +0 -0
  76. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/cache_validation.py +0 -0
  77. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/config.py +0 -0
  78. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/factory.py +0 -0
  79. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/masking.py +0 -0
  80. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/attention/onnx_backend.py +0 -0
  81. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/config.py +0 -0
  82. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/cross_attender.py +0 -0
  83. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/decoder.py +0 -0
  84. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/encoder.py +0 -0
  85. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/DEVLOG.md +0 -0
  86. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/README.md +0 -0
  87. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/__init__.py +0 -0
  88. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/config.py +0 -0
  89. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/factory.py +0 -0
  90. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/geglu.py +0 -0
  91. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/gelu.py +0 -0
  92. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/hardswish_glu.py +0 -0
  93. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/packed_geglu.py +0 -0
  94. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/packed_hardswish_glu.py +0 -0
  95. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/packed_swiglu.py +0 -0
  96. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/protocols.py +0 -0
  97. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/relu_squared.py +0 -0
  98. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/feedforward/swiglu.py +0 -0
  99. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/layers.py +0 -0
  100. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/mlm/config.py +0 -0
  101. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/mlm/head.py +0 -0
  102. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/mlm/head_cosine.py +0 -0
  103. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/norm/README.md +0 -0
  104. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/norm/__init__.py +0 -0
  105. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/norm/config.py +0 -0
  106. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/norm/factory.py +0 -0
  107. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/norm/protocols.py +0 -0
  108. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/packing.py +0 -0
  109. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/README.md +0 -0
  110. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/__init__.py +0 -0
  111. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/config.py +0 -0
  112. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/factory.py +0 -0
  113. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/learned.py +0 -0
  114. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/none.py +0 -0
  115. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/protocols.py +0 -0
  116. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/rope1d.py +0 -0
  117. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/rope2d.py +0 -0
  118. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/rope_nd.py +0 -0
  119. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/positional/validation.py +0 -0
  120. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/presets/__init__.py +0 -0
  121. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/presets/decoder.py +0 -0
  122. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/presets/variable_width_encoder.py +0 -0
  123. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/py.typed +0 -0
  124. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/result/README.md +0 -0
  125. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/stackformers/result/__init__.py +0 -0
  126. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/__init__.py +0 -0
  127. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/__init__.py +0 -0
  128. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/legacy_api_rc1.json +0 -0
  129. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_all_valid.py +0 -0
  130. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_cached.py +0 -0
  131. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_contracts.py +0 -0
  132. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_cross_attn.py +0 -0
  133. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_distance_bias.py +0 -0
  134. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_empty_rows.py +0 -0
  135. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_factory.py +0 -0
  136. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_geometry.py +0 -0
  137. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_kernels.py +0 -0
  138. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_legacy_api.py +0 -0
  139. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_masking.py +0 -0
  140. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_onnx_backend.py +0 -0
  141. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_ops.py +0 -0
  142. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_packed_cross_attn.py +0 -0
  143. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_packed_self_attn.py +0 -0
  144. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_sdpa_export.py +0 -0
  145. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_self_attn.py +0 -0
  146. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/attention/test_varlen_backend.py +0 -0
  147. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/conftest.py +0 -0
  148. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/__init__.py +0 -0
  149. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/legacy_swiglu_4_6.json +0 -0
  150. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_factory.py +0 -0
  151. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_geglu.py +0 -0
  152. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_gelu.py +0 -0
  153. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_hardswish_glu.py +0 -0
  154. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_packed_geglu.py +0 -0
  155. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_packed_hardswish_glu.py +0 -0
  156. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_packed_swiglu.py +0 -0
  157. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_relu_squared.py +0 -0
  158. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/feedforward/test_swiglu.py +0 -0
  159. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/mlm/__init__.py +0 -0
  160. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/mlm/test_empty_selection.py +0 -0
  161. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/mlm/test_head.py +0 -0
  162. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/mlm/test_head_cosine.py +0 -0
  163. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/mlm/test_masking.py +0 -0
  164. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/mlm/test_wrapper.py +0 -0
  165. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/norm_topology_helpers.py +0 -0
  166. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/positional/__init__.py +0 -0
  167. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/positional/test_cacheable.py +0 -0
  168. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/positional/test_learned_pos.py +0 -0
  169. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/positional/test_rope.py +0 -0
  170. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/positional/test_rope_nd.py +0 -0
  171. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/presets/__init__.py +0 -0
  172. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/presets/test_cross_attender.py +0 -0
  173. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/presets/test_decoder.py +0 -0
  174. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/presets/test_encoder.py +0 -0
  175. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/presets/test_projection_packing.py +0 -0
  176. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/presets/test_variable_width_encoder.py +0 -0
  177. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_all_valid_decoder.py +0 -0
  178. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_core_results.py +0 -0
  179. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_cross_attender.py +0 -0
  180. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_decoder.py +0 -0
  181. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_decoder_cache.py +0 -0
  182. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_decoder_equations.py +0 -0
  183. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_encoder.py +0 -0
  184. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_encoder_decoder_example.py +0 -0
  185. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_examples.py +0 -0
  186. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_layers.py +0 -0
  187. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_norm.py +0 -0
  188. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_packing.py +0 -0
  189. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_preallocated_decoder.py +0 -0
  190. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_projection_packing.py +0 -0
  191. {stackformers-5.0.0rc20 → stackformers-5.0.0rc22}/tests/test_result.py +0 -0
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report incorrect behavior with a minimal reproducer
4
+ ---
5
+
6
+ ## Expected and observed behavior
7
+
8
+ Describe what you expected and what happened. Include the full traceback if relevant.
9
+
10
+ ## Minimal reproducer
11
+
12
+ ```python
13
+ # Include imports, model configuration, input shapes, and the failing call.
14
+ ```
15
+
16
+ ## Environment
17
+
18
+ - Stackformers version or commit:
19
+ - Python and PyTorch versions:
20
+ - Operating system, device, and dtype:
21
+ - Eager, compiled, exported, or ONNX Runtime execution:
22
+ - ONNX and ONNX Runtime versions, if relevant:
23
+
24
+ ## Additional context
25
+
26
+ For numerical or performance issues, include sequence lengths, padded/packed layout,
27
+ attention configuration, and whether a backend fallback warning appeared.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: Feature request
3
+ about: Propose a capability with a concrete research or deployment use case
4
+ ---
5
+
6
+ ## Use case
7
+
8
+ What are you trying to build, and where does the current API fall short?
9
+
10
+ ## Proposed behavior
11
+
12
+ Describe the desired interface or show a small usage example.
13
+
14
+ ## Existing alternatives
15
+
16
+ Can existing components or a custom collaborator express this? Explain the limitation.
17
+
18
+ ## Evidence and compatibility
19
+
20
+ Link relevant methods or implementations. Note any required device, dtype, compile/export,
21
+ or checkpoint compatibility. Separate desired behavior from measured results.
@@ -0,0 +1,13 @@
1
+ ## Problem and resulting behavior
2
+
3
+ Describe the concrete problem and how this change affects users.
4
+
5
+ ## Validation
6
+
7
+ List the checks run and their results. For behavior changes, include relevant numerical,
8
+ shape, or compatibility coverage. For documentation changes, verify examples and links.
9
+
10
+ ## Compatibility and documentation
11
+
12
+ Describe migration requirements, configuration/checkpoint changes, and affected guides.
13
+ For performance claims, include reproducible measurements and the tested environment.
@@ -0,0 +1,36 @@
1
+ name: Check
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ check:
14
+ name: Python ${{ matrix.python }} CPU
15
+ runs-on: ubuntu-latest
16
+ timeout-minutes: 60
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python: ["3.11", "3.12"]
21
+ steps:
22
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23
+ - uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
24
+ with:
25
+ version: "0.12.1"
26
+ python-version: ${{ matrix.python }}
27
+ enable-cache: true
28
+ - uses: extractions/setup-just@v4
29
+ with:
30
+ just-version: "1.48.0"
31
+ - name: Install locked development environment
32
+ run: uv sync --locked --group dev
33
+ - name: Report environment
34
+ run: uv run python -c "import platform, torch; print(platform.python_version()); print(torch.__version__)"
35
+ - name: Format, lint, type-check, and test
36
+ run: just check
@@ -6,6 +6,38 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
  adheres to [Semantic Versioning](https://semver.org/): MAJOR for breaking public API changes,
7
7
  MINOR for backwards-compatible features, PATCH for bug fixes and internal changes.
8
8
 
9
+ ## [5.0.0rc22]
10
+
11
+ ### Documentation
12
+
13
+ - Lead the README with research use cases and current tensor examples; preserve detailed
14
+ API, migration, and configuration contracts in a dedicated guide.
15
+ - Add software citation metadata, research reproducibility guidance, compatibility scope,
16
+ and contributor onboarding. Update runnable examples to use `PaddedTensor` rather than
17
+ deprecated aliases and constructors.
18
+
19
+ ### Developers
20
+
21
+ - Add a Python 3.11/3.12 CPU CI matrix running the existing `just check` quality gate.
22
+
23
+ ## [5.0.0rc21]
24
+
25
+ ### Deprecations
26
+
27
+ - Deprecate `PackedInput` and `PaddedInput` in favor of the exact aliases `PackedTensor`
28
+ and `PaddedTensor`; importing or accessing old names emits `DeprecationWarning`.
29
+ Existing constructors and model calls remain supported. Mark metadata-only sequence
30
+ records and legacy constructors/conversion helpers deprecated with static PEP 702
31
+ guidance; use the tensor records and their methods instead. Decoder cache output
32
+ structures remain compatible, and cached calls accept `PaddedTensor` directly.
33
+
34
+ ### New Features
35
+
36
+ - Add pure `from_list`, `from_nested`, `to_list`, `to_nested`, `to_packed`, and `to_padded`
37
+ APIs to `PackedTensor` and `PaddedTensor`. Preserve gradients, devices, dtypes, empty
38
+ documents, and custom coordinates across layout conversions. Jagged/list exports
39
+ contain values only; constructors generate sequential positions unless supplied.
40
+
9
41
  ## [5.0.0rc20]
10
42
 
11
43
  ### Backwards Incompatible Changes
@@ -0,0 +1,11 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use Stackformers in research, cite this software and report the exact version or commit used."
3
+ type: software
4
+ title: Stackformers
5
+ authors:
6
+ - family-names: Stupakov
7
+ given-names: Vadym
8
+ repository-code: "https://github.com/Red-Eyed/stackformers"
9
+ url: "https://github.com/Red-Eyed/stackformers"
10
+ license: MIT
11
+ abstract: "Composable PyTorch transformer components for research on vision, spatial, and sequence models."
@@ -0,0 +1,31 @@
1
+ # Contributing
2
+
3
+ Bug reports should include the Stackformers version or commit, Python/PyTorch versions,
4
+ device and dtype, a minimal reproducer, and the expected and observed behavior.
5
+ Open reports and proposals in the [issue tracker](https://github.com/Red-Eyed/stackformers/issues).
6
+
7
+ ## Development
8
+
9
+ Install uv and just, then run:
10
+
11
+ ```bash
12
+ git clone https://github.com/Red-Eyed/stackformers.git
13
+ cd stackformers
14
+ just sync
15
+ just check
16
+ ```
17
+
18
+ Use the [Justfile](Justfile) recipes for formatting, linting, type-checking, testing, and builds.
19
+ The same checks include library code, tests, and examples. Read [AGENTS.md](AGENTS.md) for
20
+ repository design and testing conventions.
21
+
22
+ ## Proposing a component
23
+
24
+ Explain the research use case and why existing composition cannot express it. Keep each
25
+ variant focused, define its configuration next to its implementation, and extend the owning
26
+ module's factory and README. Implement protocols structurally. Include numerical and shape
27
+ coverage appropriate to the behavior, with compile/export checks when claiming those paths.
28
+
29
+ For public API changes, describe compatibility and migration. For performance claims, provide
30
+ reproducible measurements with hardware, versions, dtype, shapes, and timing methodology.
31
+ Do not add performance or accuracy claims based only on a synthetic smoke example.
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.5
2
+ Name: stackformers
3
+ Version: 5.0.0rc22
4
+ Summary: Composable PyTorch transformers for vision, spatial, and sequence research
5
+ Project-URL: Homepage, https://github.com/Red-Eyed/stackformers
6
+ Project-URL: Repository, https://github.com/Red-Eyed/stackformers
7
+ Project-URL: Documentation, https://github.com/Red-Eyed/stackformers#documentation
8
+ Project-URL: Changelog, https://github.com/Red-Eyed/stackformers/blob/main/CHANGELOG.md
9
+ Project-URL: Bug Tracker, https://github.com/Red-Eyed/stackformers/issues
10
+ Author-email: Vadym Stupakov <vadim.stupakov@gmail.com>
11
+ License: MIT License
12
+
13
+ Copyright (c) 2026 Vadym Stupakov
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+ License-File: LICENSE
33
+ Keywords: attention,computer-vision,point-cloud,pytorch,research,transformer
34
+ Classifier: Development Status :: 4 - Beta
35
+ Classifier: Intended Audience :: Science/Research
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
41
+ Classifier: Typing :: Typed
42
+ Requires-Python: >=3.11
43
+ Requires-Dist: beartype>=0.18
44
+ Requires-Dist: einops>=0.7
45
+ Requires-Dist: jaxtyping>=0.2
46
+ Requires-Dist: numpy>=2.4.4
47
+ Requires-Dist: pydantic>=2.0
48
+ Requires-Dist: torch>=2.2
49
+ Requires-Dist: typing-extensions>=4.12
50
+ Description-Content-Type: text/markdown
51
+
52
+ # Stackformers
53
+
54
+ [![CI](https://github.com/Red-Eyed/stackformers/actions/workflows/check.yml/badge.svg)](https://github.com/Red-Eyed/stackformers/actions/workflows/check.yml)
55
+ [![PyPI](https://img.shields.io/pypi/v/stackformers.svg)](https://pypi.org/project/stackformers/)
56
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
57
+
58
+ **Composable PyTorch transformers for research.**
59
+
60
+ Build vision, spatial, and sequence models with interchangeable attention, positional
61
+ encodings, normalization, and feedforward components. Start with a preset, then replace
62
+ individual components as your experiments evolve.
63
+
64
+ - **Experiment with architecture:** explicit, serializable configurations and structural
65
+ protocols let you supply your own components.
66
+ - **Work with variable-length data:** run the same encoder weights on padded or packed
67
+ token batches, with explicit token coordinates.
68
+ - **Connect research and deployment:** examples cover image patches, point clouds,
69
+ causal modeling, custom components, and cached ONNX Runtime decoding.
70
+
71
+ ## Try the current API
72
+
73
+ Python 3.11 or newer is required. This checkout is on the **5.0 release-candidate series**.
74
+ To run the examples shown here against the matching source:
75
+
76
+ ```bash
77
+ git clone https://github.com/Red-Eyed/stackformers.git
78
+ cd stackformers
79
+ uv run examples/padded_and_packed.py
80
+ ```
81
+
82
+ `uv run` prepares the project environment automatically. For a published release in an
83
+ existing project:
84
+
85
+ ```bash
86
+ uv add stackformers
87
+ ```
88
+
89
+ An unpinned install may resolve a different stable release whose API differs from this
90
+ checkout. Use the documentation matching your installed version. For experiments, pin the
91
+ exact version or commit you validated; see the [research guide](docs/research.md).
92
+
93
+ ## Run your first encoder
94
+
95
+ ```python
96
+ import torch
97
+ import stackformers as sf
98
+
99
+ model = sf.TransformerEncoder(
100
+ sf.plain_encoder_config(dim=64, heads=1, num_layers=2, ff_mult=3.0)
101
+ ).eval()
102
+
103
+ sequences = [torch.randn(8, 64), torch.randn(5, 64)]
104
+ padded = sf.PaddedTensor.from_list(sequences)
105
+ with torch.no_grad():
106
+ padded_output = model(padded) # (2, 8, 64)
107
+ packed_output = model(padded.to_packed()) # (13, 64)
108
+ ```
109
+
110
+ The two calls share model weights. Packed output contains valid tokens only; padded output
111
+ retains batch and sequence axes. See the [layout parity example](examples/padded_and_packed.py)
112
+ for a numerical comparison. Packed input does not guarantee faster execution: backend,
113
+ hardware, dtype, and length distribution matter.
114
+
115
+ ## Choose an example
116
+
117
+ Examples run on CPU without dataset or model downloads. From a repository checkout,
118
+ `uv run` prepares the project environment automatically.
119
+
120
+ | Your task | Start here | Run |
121
+ | --- | --- | --- |
122
+ | Image patches and 2-D positions | [Image encoder](examples/image_encoder.py) | `uv run examples/image_encoder.py` |
123
+ | Continuous spatial coordinates | [Point-cloud encoder](examples/point_cloud_encoder.py) | `uv run examples/point_cloud_encoder.py` |
124
+ | Unequal sequence lengths | [Padded and packed](examples/padded_and_packed.py) | `uv run examples/padded_and_packed.py` |
125
+ | Replace a model component | [Custom encoders](examples/subclassed_encoder.py) | `uv run examples/subclassed_encoder.py` |
126
+ | Autoregressive token modeling | [Causal language model](examples/causal_language_model.py) | `uv run examples/causal_language_model.py` |
127
+ | Export an encoder–decoder | [ONNX Runtime guide](examples/README.md#encoderdecoder-onnx-runtime) | `uv run examples/encoder_decoder_onnxruntime.py` |
128
+
129
+ These are integration examples with synthetic inputs, not trained models or task-accuracy
130
+ benchmarks. Stackformers provides transformer components; your application owns tokenization,
131
+ data processing, training, and task heads.
132
+
133
+ ## What can you change?
134
+
135
+ | Component | Included choices |
136
+ | --- | --- |
137
+ | Attention | Global self/cross attention, local self-attention, GQA/MQA |
138
+ | Token layout | Padded or packed, with explicit positions |
139
+ | Positional encoding | RoPE-1D, RoPE-2D, continuous-coordinate RoPE-ND, or none |
140
+ | Feedforward | SwiGLU, HardSwishGLU, GEGLU, GELU, ReLU² |
141
+ | Normalization | RMSNorm, LayerNorm; pre, post, sandwich, or reordered placement |
142
+ | Model assembly | Encoders, decoders, cross-attenders, variable-width encoders |
143
+ | Deployment | Projection packing, compile/export paths, cached decoder adapters |
144
+
145
+ Presets build components from discriminated Pydantic configurations. For deeper changes,
146
+ wire modules directly or implement an owning module's protocol. The
147
+ [configuration and API guide](docs/api-guide.md) covers both approaches.
148
+
149
+ ## Compatibility and limits
150
+
151
+ - Global attention uses PyTorch SDPA. Eligible CUDA fp16/bf16 packed workloads use
152
+ PyTorch's variable-length attention; other paths can fall back to padded execution.
153
+ - Compile and export support depend on the component and input path. Eager list/nested
154
+ adapters and deployment cache strategies have separate contracts.
155
+ - Cached deployment supports specified built-in classes; custom forward overrides need
156
+ their own deployment integration.
157
+ - No speedup or downstream accuracy improvement is claimed without a matching benchmark.
158
+
159
+ See [compatibility evidence](docs/compatibility.md) and
160
+ [inference contracts](docs/inference.md) before selecting a deployment path.
161
+
162
+ ## Documentation
163
+
164
+ - [Examples and expected behavior](examples/README.md)
165
+ - [Research reproducibility and citation](docs/research.md)
166
+ - [API, layouts, configuration, and migration](docs/api-guide.md)
167
+ - [Deployment and inference](docs/inference.md)
168
+ - [Release history](CHANGELOG.md)
169
+ - [Contributing](CONTRIBUTING.md)
170
+ - [Adoption and evidence roadmap](docs/improvement-plan.md)
171
+
172
+ ## Development
173
+
174
+ ```bash
175
+ git clone https://github.com/Red-Eyed/stackformers.git
176
+ cd stackformers
177
+ just sync
178
+ just check
179
+ ```
180
+
181
+ The [Justfile](Justfile) owns formatting, linting, type-checking, tests, and builds.
182
+
183
+ ## Citation and license
184
+
185
+ If Stackformers contributes to your research implementation, cite the software using
186
+ [CITATION.cff](CITATION.cff) and report the exact version or commit used. No associated
187
+ research paper or conference endorsement is implied.
188
+
189
+ Released under the [MIT license](LICENSE).
@@ -0,0 +1,138 @@
1
+ # Stackformers
2
+
3
+ [![CI](https://github.com/Red-Eyed/stackformers/actions/workflows/check.yml/badge.svg)](https://github.com/Red-Eyed/stackformers/actions/workflows/check.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/stackformers.svg)](https://pypi.org/project/stackformers/)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+
7
+ **Composable PyTorch transformers for research.**
8
+
9
+ Build vision, spatial, and sequence models with interchangeable attention, positional
10
+ encodings, normalization, and feedforward components. Start with a preset, then replace
11
+ individual components as your experiments evolve.
12
+
13
+ - **Experiment with architecture:** explicit, serializable configurations and structural
14
+ protocols let you supply your own components.
15
+ - **Work with variable-length data:** run the same encoder weights on padded or packed
16
+ token batches, with explicit token coordinates.
17
+ - **Connect research and deployment:** examples cover image patches, point clouds,
18
+ causal modeling, custom components, and cached ONNX Runtime decoding.
19
+
20
+ ## Try the current API
21
+
22
+ Python 3.11 or newer is required. This checkout is on the **5.0 release-candidate series**.
23
+ To run the examples shown here against the matching source:
24
+
25
+ ```bash
26
+ git clone https://github.com/Red-Eyed/stackformers.git
27
+ cd stackformers
28
+ uv run examples/padded_and_packed.py
29
+ ```
30
+
31
+ `uv run` prepares the project environment automatically. For a published release in an
32
+ existing project:
33
+
34
+ ```bash
35
+ uv add stackformers
36
+ ```
37
+
38
+ An unpinned install may resolve a different stable release whose API differs from this
39
+ checkout. Use the documentation matching your installed version. For experiments, pin the
40
+ exact version or commit you validated; see the [research guide](docs/research.md).
41
+
42
+ ## Run your first encoder
43
+
44
+ ```python
45
+ import torch
46
+ import stackformers as sf
47
+
48
+ model = sf.TransformerEncoder(
49
+ sf.plain_encoder_config(dim=64, heads=1, num_layers=2, ff_mult=3.0)
50
+ ).eval()
51
+
52
+ sequences = [torch.randn(8, 64), torch.randn(5, 64)]
53
+ padded = sf.PaddedTensor.from_list(sequences)
54
+ with torch.no_grad():
55
+ padded_output = model(padded) # (2, 8, 64)
56
+ packed_output = model(padded.to_packed()) # (13, 64)
57
+ ```
58
+
59
+ The two calls share model weights. Packed output contains valid tokens only; padded output
60
+ retains batch and sequence axes. See the [layout parity example](examples/padded_and_packed.py)
61
+ for a numerical comparison. Packed input does not guarantee faster execution: backend,
62
+ hardware, dtype, and length distribution matter.
63
+
64
+ ## Choose an example
65
+
66
+ Examples run on CPU without dataset or model downloads. From a repository checkout,
67
+ `uv run` prepares the project environment automatically.
68
+
69
+ | Your task | Start here | Run |
70
+ | --- | --- | --- |
71
+ | Image patches and 2-D positions | [Image encoder](examples/image_encoder.py) | `uv run examples/image_encoder.py` |
72
+ | Continuous spatial coordinates | [Point-cloud encoder](examples/point_cloud_encoder.py) | `uv run examples/point_cloud_encoder.py` |
73
+ | Unequal sequence lengths | [Padded and packed](examples/padded_and_packed.py) | `uv run examples/padded_and_packed.py` |
74
+ | Replace a model component | [Custom encoders](examples/subclassed_encoder.py) | `uv run examples/subclassed_encoder.py` |
75
+ | Autoregressive token modeling | [Causal language model](examples/causal_language_model.py) | `uv run examples/causal_language_model.py` |
76
+ | Export an encoder–decoder | [ONNX Runtime guide](examples/README.md#encoderdecoder-onnx-runtime) | `uv run examples/encoder_decoder_onnxruntime.py` |
77
+
78
+ These are integration examples with synthetic inputs, not trained models or task-accuracy
79
+ benchmarks. Stackformers provides transformer components; your application owns tokenization,
80
+ data processing, training, and task heads.
81
+
82
+ ## What can you change?
83
+
84
+ | Component | Included choices |
85
+ | --- | --- |
86
+ | Attention | Global self/cross attention, local self-attention, GQA/MQA |
87
+ | Token layout | Padded or packed, with explicit positions |
88
+ | Positional encoding | RoPE-1D, RoPE-2D, continuous-coordinate RoPE-ND, or none |
89
+ | Feedforward | SwiGLU, HardSwishGLU, GEGLU, GELU, ReLU² |
90
+ | Normalization | RMSNorm, LayerNorm; pre, post, sandwich, or reordered placement |
91
+ | Model assembly | Encoders, decoders, cross-attenders, variable-width encoders |
92
+ | Deployment | Projection packing, compile/export paths, cached decoder adapters |
93
+
94
+ Presets build components from discriminated Pydantic configurations. For deeper changes,
95
+ wire modules directly or implement an owning module's protocol. The
96
+ [configuration and API guide](docs/api-guide.md) covers both approaches.
97
+
98
+ ## Compatibility and limits
99
+
100
+ - Global attention uses PyTorch SDPA. Eligible CUDA fp16/bf16 packed workloads use
101
+ PyTorch's variable-length attention; other paths can fall back to padded execution.
102
+ - Compile and export support depend on the component and input path. Eager list/nested
103
+ adapters and deployment cache strategies have separate contracts.
104
+ - Cached deployment supports specified built-in classes; custom forward overrides need
105
+ their own deployment integration.
106
+ - No speedup or downstream accuracy improvement is claimed without a matching benchmark.
107
+
108
+ See [compatibility evidence](docs/compatibility.md) and
109
+ [inference contracts](docs/inference.md) before selecting a deployment path.
110
+
111
+ ## Documentation
112
+
113
+ - [Examples and expected behavior](examples/README.md)
114
+ - [Research reproducibility and citation](docs/research.md)
115
+ - [API, layouts, configuration, and migration](docs/api-guide.md)
116
+ - [Deployment and inference](docs/inference.md)
117
+ - [Release history](CHANGELOG.md)
118
+ - [Contributing](CONTRIBUTING.md)
119
+ - [Adoption and evidence roadmap](docs/improvement-plan.md)
120
+
121
+ ## Development
122
+
123
+ ```bash
124
+ git clone https://github.com/Red-Eyed/stackformers.git
125
+ cd stackformers
126
+ just sync
127
+ just check
128
+ ```
129
+
130
+ The [Justfile](Justfile) owns formatting, linting, type-checking, tests, and builds.
131
+
132
+ ## Citation and license
133
+
134
+ If Stackformers contributes to your research implementation, cite the software using
135
+ [CITATION.cff](CITATION.cff) and report the exact version or commit used. No associated
136
+ research paper or conference endorsement is implied.
137
+
138
+ Released under the [MIT license](LICENSE).