pytensor-ml 0.3.0__tar.gz → 0.4.0__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 (225) hide show
  1. pytensor_ml-0.4.0/.github/workflows/mypy.yml +34 -0
  2. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.github/workflows/pre-commit.yml +5 -0
  3. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.github/workflows/run_tests.yml +25 -70
  4. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.pre-commit-config.yaml +25 -0
  5. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/PKG-INFO +2 -2
  6. pytensor_ml-0.4.0/conda_envs/environment-docs.yml +24 -0
  7. pytensor_ml-0.4.0/conda_envs/pytensor_ml-gpu_jax.yml +22 -0
  8. pytensor_ml-0.4.0/conda_envs/pytensor_ml-gpu_metal.yml +20 -0
  9. pytensor_ml-0.4.0/conda_envs/pytensor_ml.yml +19 -0
  10. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/layers.rst +3 -0
  11. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/optim.rst +1 -0
  12. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/dev/contributing.rst +13 -3
  13. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/references.bib +14 -0
  14. pytensor_ml-0.4.0/pixi.lock +14617 -0
  15. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pyproject.toml +96 -7
  16. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/_version.py +2 -2
  17. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/jax/line_search.py +2 -1
  18. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/mlx/line_search.py +14 -6
  19. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/__init__.py +3 -0
  20. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/attention.py +3 -2
  21. pytensor_ml-0.4.0/pytensor_ml/layers/positional.py +368 -0
  22. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/__init__.py +2 -1
  23. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/base.py +5 -3
  24. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/line_search.py +95 -21
  25. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/rules.py +93 -4
  26. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/train.py +141 -54
  27. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/pytensorf/compile.py +2 -27
  28. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/pytensorf/rng.py +74 -1
  29. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/jax/test_line_search.py +6 -3
  30. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/test_attention.py +20 -1
  31. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/test_line_search.py +8 -5
  32. pytensor_ml-0.4.0/tests/dispatch/mlx/test_positional.py +33 -0
  33. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_lbfgs.py +32 -10
  34. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_line_search.py +13 -14
  35. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_rules.py +196 -76
  36. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_training.py +135 -24
  37. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_attention.py +6 -5
  38. pytensor_ml-0.4.0/tests/test_positional.py +392 -0
  39. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_pytensorf.py +21 -0
  40. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_serialize.py +28 -0
  41. pytensor_ml-0.3.0/.github/workflows/mypy.yml +0 -57
  42. pytensor_ml-0.3.0/conda_envs/environment-docs.yml +0 -35
  43. pytensor_ml-0.3.0/conda_envs/pytensor_ml-gpu_jax.yml +0 -42
  44. pytensor_ml-0.3.0/conda_envs/pytensor_ml.yml +0 -32
  45. pytensor_ml-0.3.0/pixi.lock +0 -10749
  46. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.gitattributes +0 -0
  47. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.github/workflows/release.yml +0 -0
  48. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.github/workflows/rtd-preview.yml +0 -0
  49. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.gitignore +0 -0
  50. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/.readthedocs.yaml +0 -0
  51. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/LICENSE +0 -0
  52. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/README.md +0 -0
  53. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/.gitignore +0 -0
  54. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/Makefile +0 -0
  55. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/make.bat +0 -0
  56. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/_static/.gitkeep +0 -0
  57. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/_templates/autosummary/class.rst +0 -0
  58. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/activations.rst +0 -0
  59. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/loss.rst +0 -0
  60. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/model.rst +0 -0
  61. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/models.rst +0 -0
  62. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/pytensorf.rst +0 -0
  63. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/serialization.rst +0 -0
  64. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/state.rst +0 -0
  65. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api/util.rst +0 -0
  66. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/api.rst +0 -0
  67. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/conf.py +0 -0
  68. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/dev/docs.rst +0 -0
  69. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/dev/index.rst +0 -0
  70. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/dev/style_guide.rst +0 -0
  71. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/index.rst +0 -0
  72. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/install.rst +0 -0
  73. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/source/sharp_edges.rst +0 -0
  74. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/docs/sphinxext/generate_gallery.py +0 -0
  75. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/examples/gallery/mnist_feed_forward.ipynb +0 -0
  76. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/__init__.py +0 -0
  77. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/activations.py +0 -0
  78. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/base.py +0 -0
  79. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/checkpoint.py +0 -0
  80. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/__init__.py +0 -0
  81. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/jax/__init__.py +0 -0
  82. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/jax/attention.py +0 -0
  83. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/jax/conv.py +0 -0
  84. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/jax/pooling.py +0 -0
  85. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/mlx/__init__.py +0 -0
  86. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/mlx/attention.py +0 -0
  87. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/mlx/conv.py +0 -0
  88. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/mlx/lbfgs.py +0 -0
  89. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/mlx/pooling.py +0 -0
  90. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/numba/__init__.py +0 -0
  91. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/numba/conv.py +0 -0
  92. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/pytorch/__init__.py +0 -0
  93. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/pytorch/conv.py +0 -0
  94. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/dispatch/pytorch/pooling.py +0 -0
  95. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/json_serialize.py +0 -0
  96. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/combinators.py +0 -0
  97. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/conv.py +0 -0
  98. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/dropout.py +0 -0
  99. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/embedding.py +0 -0
  100. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/linear.py +0 -0
  101. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/norm.py +0 -0
  102. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/padding.py +0 -0
  103. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/recurrent.py +0 -0
  104. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/layers/transformer.py +0 -0
  105. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/loss.py +0 -0
  106. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/model.py +0 -0
  107. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/__init__.py +0 -0
  108. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/architectures/__init__.py +0 -0
  109. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/architectures/clip.py +0 -0
  110. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/architectures/gpt2.py +0 -0
  111. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/architectures/vae.py +0 -0
  112. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/blocks/__init__.py +0 -0
  113. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/blocks/attention.py +0 -0
  114. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/blocks/resnet.py +0 -0
  115. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/loading/__init__.py +0 -0
  116. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/loading/binding.py +0 -0
  117. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/loading/keys.py +0 -0
  118. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/models/loading/registry.py +0 -0
  119. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/alias.py +0 -0
  120. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/checks.py +0 -0
  121. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/clipping.py +0 -0
  122. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/guards.py +0 -0
  123. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/lbfgs.py +0 -0
  124. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/policy.py +0 -0
  125. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/schedules.py +0 -0
  126. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/optim/transform.py +0 -0
  127. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/params.py +0 -0
  128. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/pretrained.py +0 -0
  129. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/pytensorf/__init__.py +0 -0
  130. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/pytensorf/collect.py +0 -0
  131. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/pytensorf/rewrite.py +0 -0
  132. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/rewriting/__init__.py +0 -0
  133. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/rewriting/conv.py +0 -0
  134. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/rewriting/layers.py +0 -0
  135. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/rewriting/scan.py +0 -0
  136. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/serialize/__init__.py +0 -0
  137. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/serialize/base.py +0 -0
  138. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/serialize/blockwise.py +0 -0
  139. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/serialize/builders.py +0 -0
  140. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/serialize/elemwise.py +0 -0
  141. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/serialize/scalar.py +0 -0
  142. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/serialize/scan.py +0 -0
  143. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/state.py +0 -0
  144. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/pytensor_ml/util.py +0 -0
  145. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/scripts/run_mypy.py +0 -0
  146. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/__init__.py +0 -0
  147. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/conftest.py +0 -0
  148. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/attention_block_2d.npz +0 -0
  149. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/generate_reference_checkpoints.py +0 -0
  150. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/generate_reference_layers.py +0 -0
  151. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/resnet_block_2d.npz +0 -0
  152. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/sdxl_vae.npz +0 -0
  153. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_clip/config.json +0 -0
  154. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_clip/expected_outputs.npz +0 -0
  155. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_clip/model.safetensors +0 -0
  156. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_clip_with_projection/config.json +0 -0
  157. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_clip_with_projection/expected_outputs.npz +0 -0
  158. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_clip_with_projection/model.safetensors +0 -0
  159. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_gpt2/config.json +0 -0
  160. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_gpt2/expected_outputs.npz +0 -0
  161. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_gpt2/generation_config.json +0 -0
  162. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_gpt2/model.safetensors +0 -0
  163. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_vae/config.json +0 -0
  164. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_vae/diffusion_pytorch_model.safetensors +0 -0
  165. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/data/tiny_vae/expected_outputs.npz +0 -0
  166. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/__init__.py +0 -0
  167. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/jax/__init__.py +0 -0
  168. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/jax/test_attention.py +0 -0
  169. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/jax/test_basic.py +0 -0
  170. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/jax/test_conv.py +0 -0
  171. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/jax/test_pool.py +0 -0
  172. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/__init__.py +0 -0
  173. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/test_basic.py +0 -0
  174. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/test_conv.py +0 -0
  175. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/test_lbfgs.py +0 -0
  176. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/test_norm.py +0 -0
  177. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/mlx/test_pool.py +0 -0
  178. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/pytorch/__init__.py +0 -0
  179. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/pytorch/test_conv.py +0 -0
  180. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/dispatch/pytorch/test_pool.py +0 -0
  181. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/__init__.py +0 -0
  182. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/architectures/__init__.py +0 -0
  183. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/architectures/test_clip.py +0 -0
  184. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/architectures/test_gpt2.py +0 -0
  185. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/architectures/test_vae.py +0 -0
  186. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/blocks/__init__.py +0 -0
  187. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/blocks/test_attention.py +0 -0
  188. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/blocks/test_resnet.py +0 -0
  189. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/loading/__init__.py +0 -0
  190. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/loading/test_binding.py +0 -0
  191. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/loading/test_keys.py +0 -0
  192. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/models/loading/test_registry.py +0 -0
  193. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/__init__.py +0 -0
  194. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/conftest.py +0 -0
  195. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/lbfgs_reference.py +0 -0
  196. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_clipping.py +0 -0
  197. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_composition.py +0 -0
  198. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_guards.py +0 -0
  199. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_learning_rate.py +0 -0
  200. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_policy.py +0 -0
  201. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_public_surface.py +0 -0
  202. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_schedules.py +0 -0
  203. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_transform.py +0 -0
  204. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/optim/test_update_space.py +0 -0
  205. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/rewriting/__init__.py +0 -0
  206. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/rewriting/test_layers.py +0 -0
  207. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/rewriting/test_scan.py +0 -0
  208. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_activations.py +0 -0
  209. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_base.py +0 -0
  210. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_checkpoint.py +0 -0
  211. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_collect.py +0 -0
  212. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_conv.py +0 -0
  213. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_conv_transpose.py +0 -0
  214. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_layers.py +0 -0
  215. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_loss.py +0 -0
  216. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_model.py +0 -0
  217. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_padding.py +0 -0
  218. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_pool.py +0 -0
  219. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_pretrained.py +0 -0
  220. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_recurrent.py +0 -0
  221. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_state.py +0 -0
  222. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_transformer.py +0 -0
  223. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_upsample.py +0 -0
  224. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_util.py +0 -0
  225. {pytensor_ml-0.3.0 → pytensor_ml-0.4.0}/tests/test_workflow_groups.py +0 -0
@@ -0,0 +1,34 @@
1
+ name: mypy
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ paths:
8
+ - ".github/workflows/mypy.yml"
9
+ - "pytensor_ml/**"
10
+ - "scripts/run_mypy.py"
11
+ - "pyproject.toml"
12
+ - "pixi.lock"
13
+
14
+ # Cancels all previous workflow runs for pull requests that have not completed.
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ mypy:
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25
+ - uses: prefix-dev/setup-pixi@9dabb60412d3d2d967a8d682f7ce01317af40514 # v0.11.0
26
+ with:
27
+ pixi-version: v0.81.0
28
+ environments: mypy
29
+ activate-environment: true
30
+ locked: true
31
+ cache: true
32
+
33
+ - name: Run mypy
34
+ run: python ./scripts/run_mypy.py
@@ -13,4 +13,9 @@ jobs:
13
13
  steps:
14
14
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
15
15
  - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
16
+ # The pixi hooks call pixi directly and need no environment installed.
17
+ - uses: prefix-dev/setup-pixi@9dabb60412d3d2d967a8d682f7ce01317af40514 # v0.11.0
18
+ with:
19
+ pixi-version: v0.81.0
20
+ run-install: false
16
21
  - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
@@ -14,17 +14,14 @@ concurrency:
14
14
 
15
15
  jobs:
16
16
  unittest:
17
- name: unittest (${{ matrix.os }}, ${{ matrix.python-version }}, ${{ matrix.test-subset.name }})
17
+ name: unittest (${{ matrix.os }}, ${{ matrix.test-subset.name }})
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
21
  os: [ubuntu-latest]
22
- python-version: ["3.12"]
23
- # Off by default, flipped to 1 by the per-backend jobs under `include`. A core job installs no
24
- # backend at all, which is what proves the library runs without one.
25
- install-jax: [0]
26
- install-mlx: [0]
27
- install-torch: [0]
22
+ # The per-backend jobs under `include` swap in an environment carrying their one backend. A core
23
+ # job's environment has no backend at all, which is what proves the library runs without one.
24
+ pixi-environment: [test]
28
25
  # Groups are balanced on measured cold-compile-cache time, which is what a fresh runner pays.
29
26
  # tests/test_workflow_groups.py fails if a test file is missing from every group or listed twice.
30
27
  test-subset:
@@ -35,6 +32,7 @@ jobs:
35
32
  paths: |
36
33
  tests/test_transformer.py
37
34
  tests/test_layers.py
35
+ tests/test_positional.py
38
36
  - name: recurrent
39
37
  paths: |
40
38
  tests/test_recurrent.py
@@ -72,25 +70,22 @@ jobs:
72
70
  # `test-subset` because a matrix entry cannot change `os`, and mlx needs macOS.
73
71
  include:
74
72
  - os: ubuntu-latest
75
- python-version: "3.12"
76
- install-jax: 1
73
+ pixi-environment: test-jax
77
74
  test-subset:
78
75
  name: dispatch-jax
79
76
  paths: tests/dispatch/jax/
80
77
  - os: macos-15
81
- python-version: "3.12"
82
- install-mlx: 1
78
+ pixi-environment: test-mlx
83
79
  test-subset:
84
80
  name: dispatch-mlx
85
81
  paths: tests/dispatch/mlx/
86
82
  - os: ubuntu-latest
87
- python-version: "3.12"
88
- install-torch: 1
83
+ pixi-environment: test-torch
89
84
  test-subset:
90
85
  name: dispatch-torch
91
86
  paths: tests/dispatch/pytorch/
92
87
  - os: windows-latest
93
- python-version: "3.12"
88
+ pixi-environment: test
94
89
  test-subset:
95
90
  name: smoke
96
91
  paths: |
@@ -103,73 +98,33 @@ jobs:
103
98
  env:
104
99
  TEST_SUBSET: ${{ matrix.test-subset.paths }}
105
100
 
106
- defaults:
107
- run:
108
- shell: bash -l {0}
109
-
110
101
  steps:
111
102
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
112
- - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
113
- env:
114
- CACHE_NUMBER: 0
115
- with:
116
- path: ~/conda_pkgs_dir
117
- key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
118
- hashFiles('conda_envs/pytensor_ml.yml') }}
119
- - name: Cache multiple paths
120
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
121
- env:
122
- # Increase this value to reset cache if pyproject.toml has not changed
123
- CACHE_NUMBER: 0
103
+ - uses: prefix-dev/setup-pixi@9dabb60412d3d2d967a8d682f7ce01317af40514 # v0.11.0
124
104
  with:
125
- path: |
126
- ~/.cache/pip
127
- $RUNNER_TOOL_CACHE/Python/*
128
- ~\AppData\Local\pip\Cache
129
- key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
130
- hashFiles('pyproject.toml') }}
105
+ pixi-version: v0.81.0
106
+ environments: ${{ matrix.pixi-environment }}
107
+ activate-environment: true
108
+ locked: true
109
+ cache: true
110
+ # A saved cache entry is immutable, so a key without the commit would freeze the cache at the first
111
+ # run on each lockfile, and every graph changed after it would compile cold on every run. Keying on
112
+ # the commit saves a fresh entry each run, and the restore keys pick up the newest one.
131
113
  - name: Cache the pytensor compile directory
132
114
  uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
133
115
  env:
134
116
  CACHE_NUMBER: 0
135
117
  with:
136
- path: ~/.pytensor
137
- key: ${{ runner.os }}-py${{ matrix.python-version }}-pytensor-${{ env.CACHE_NUMBER }}-${{
138
- matrix.test-subset.name }}-${{ hashFiles('conda_envs/pytensor_ml.yml') }}
118
+ # pytensor compiles into %LOCALAPPDATA%\PyTensor on Windows and ~/.pytensor elsewhere.
119
+ path: ${{ runner.os == 'Windows' && '~/AppData/Local/PyTensor' || '~/.pytensor' }}
120
+ key: ${{ runner.os }}-pytensor-${{ env.CACHE_NUMBER }}-${{
121
+ matrix.test-subset.name }}-${{ hashFiles('pixi.lock') }}-${{ github.sha }}
139
122
  restore-keys: |
140
- ${{ runner.os }}-py${{ matrix.python-version }}-pytensor-${{ env.CACHE_NUMBER }}-${{ matrix.test-subset.name }}-
141
- - uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
142
- with:
143
- miniforge-variant: Miniforge3
144
- miniforge-version: latest
145
- mamba-version: "*"
146
- activate-environment: pytensor_ml
147
- channel-priority: strict
148
- environment-file: conda_envs/pytensor_ml.yml
149
- python-version: 3.12
150
- use-mamba: true
151
-
152
- # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
153
- use-only-tar-bz2: false
154
-
155
- - name: Install the backend this job tests
156
- run: |
157
- conda activate pytensor_ml
158
- if [[ $INSTALL_JAX == "1" ]]; then pip install "jax>=0.8,<0.9.1" jaxlib; fi
159
- if [[ $INSTALL_MLX == "1" ]]; then pip install "mlx>=0.32.2,<0.33"; fi
160
- if [[ $INSTALL_TORCH == "1" ]]; then pip install torch --index-url https://download.pytorch.org/whl/cpu; fi
161
- env:
162
- INSTALL_JAX: ${{ matrix.install-jax }}
163
- INSTALL_MLX: ${{ matrix.install-mlx }}
164
- INSTALL_TORCH: ${{ matrix.install-torch }}
165
-
166
- - name: Install current branch
167
- run: |
168
- conda activate pytensor_ml
169
- pip install -e .
170
- python --version
123
+ ${{ runner.os }}-pytensor-${{ env.CACHE_NUMBER }}-${{ matrix.test-subset.name }}-${{ hashFiles('pixi.lock') }}-
124
+ ${{ runner.os }}-pytensor-${{ env.CACHE_NUMBER }}-${{ matrix.test-subset.name }}-
171
125
 
172
126
  - name: Run tests
127
+ shell: bash
173
128
  run: |
174
129
  python -m pytest -vv --durations=25 --cov=pytensor_ml --cov-report=xml --no-cov-on-fail --cov-report term $TEST_SUBSET
175
130
  - name: Upload coverage to Codecov
@@ -32,6 +32,31 @@ repos:
32
32
 
33
33
  - repo: local
34
34
  hooks:
35
+ - id: pixi-lock-check
36
+ name: pixi.lock is in sync with pyproject.toml
37
+ entry: pixi lock --check
38
+ language: system
39
+ files: ^(pyproject\.toml|pixi\.lock)$
40
+ pass_filenames: false
41
+
42
+ - id: pixi-export-dev
43
+ name: conda_envs/pytensor_ml.yml is exported from the pixi dev environment
44
+ # Called directly rather than through a pixi task so the hook reads the manifest only; `pixi run`
45
+ # would re-solve the lock file and install the environment first. --no-pypi drops the editable
46
+ # install, because conda runs pip from the env file's directory, where `-e .` names conda_envs/.
47
+ # -p pins the export to one platform, so it does not depend on the machine running the hook.
48
+ entry: pixi workspace export conda-environment -e dev -n pytensor_ml -p linux-64 --no-pypi conda_envs/pytensor_ml.yml
49
+ language: system
50
+ files: ^(pyproject\.toml|pixi\.lock|conda_envs/pytensor_ml\.yml)$
51
+ pass_filenames: false
52
+
53
+ - id: pixi-export-docs
54
+ name: conda_envs/environment-docs.yml is exported from the pixi docs environment
55
+ entry: pixi workspace export conda-environment -e docs -n pytensor_ml-docs -p linux-64 --no-pypi conda_envs/environment-docs.yml
56
+ language: system
57
+ files: ^(pyproject\.toml|pixi\.lock|conda_envs/environment-docs\.yml)$
58
+ pass_filenames: false
59
+
35
60
  - id: notebook_name
36
61
  entry: '\(notebook_name\)='
37
62
  language: pygrep
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pytensor_ml
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A(nother) deep learning library, built on top of Pytensor
5
5
  Project-URL: Homepage, https://github.com/pymc-devs/pytensor-ml
6
6
  Project-URL: Documentation, https://pytensor-ml.readthedocs.io
@@ -25,7 +25,7 @@ Classifier: Programming Language :: Python :: 3.14
25
25
  Classifier: Topic :: Scientific/Engineering
26
26
  Requires-Python: >=3.12
27
27
  Requires-Dist: numpy
28
- Requires-Dist: pytensor<4.0.0,>=3.3.3
28
+ Requires-Dist: pytensor<4.0.0,>=3.3.8
29
29
  Provides-Extra: dev
30
30
  Requires-Dist: cloudpickle; extra == 'dev'
31
31
  Requires-Dist: jax; extra == 'dev'
@@ -0,0 +1,24 @@
1
+ name: pytensor_ml-docs
2
+ channels:
3
+ - conda-forge
4
+ - nodefaults
5
+ dependencies:
6
+ - safetensors *
7
+ - matplotlib *
8
+ - ipython *
9
+ - jupyter *
10
+ - sphinx >=7
11
+ - pydata-sphinx-theme *
12
+ - myst-nb *
13
+ - numpydoc *
14
+ - sphinx-copybutton *
15
+ - sphinx-design *
16
+ - sphinx-codeautolink *
17
+ - sphinx-sitemap *
18
+ - sphinx-notfound-page *
19
+ - sphinx-autobuild *
20
+ - jupyter-sphinx *
21
+ - sphinxcontrib-bibtex *
22
+ - pytensor >=3.3.8,<3.4.0
23
+ - numpy *
24
+ - python >=3.12
@@ -0,0 +1,22 @@
1
+ name: pytensor_ml-gpu_jax
2
+ channels:
3
+ - conda-forge
4
+ - nodefaults
5
+ dependencies:
6
+ - safetensors *
7
+ - scikit-learn *
8
+ - cloudpickle *
9
+ - pytest *
10
+ - pytest-cov *
11
+ - pytest-xdist *
12
+ - pytest-benchmark *
13
+ - pytest-mock *
14
+ - pyyaml *
15
+ - mypy >=2.4.0,<2.5.0
16
+ - pre-commit *
17
+ - jax >=0.12,<0.13
18
+ - jaxlib >=0.12,<0.13 cuda*
19
+ - cuda-nvcc *
20
+ - pytensor >=3.3.8,<3.4.0
21
+ - numpy *
22
+ - python >=3.12
@@ -0,0 +1,20 @@
1
+ name: pytensor_ml-gpu_metal
2
+ channels:
3
+ - conda-forge
4
+ - nodefaults
5
+ dependencies:
6
+ - safetensors *
7
+ - scikit-learn *
8
+ - cloudpickle *
9
+ - pytest *
10
+ - pytest-cov *
11
+ - pytest-xdist *
12
+ - pytest-benchmark *
13
+ - pytest-mock *
14
+ - pyyaml *
15
+ - mypy >=2.4.0,<2.5.0
16
+ - pre-commit *
17
+ - mlx >=0.32.4,<0.33
18
+ - pytensor >=3.3.8,<3.4.0
19
+ - numpy *
20
+ - python >=3.12
@@ -0,0 +1,19 @@
1
+ name: pytensor_ml
2
+ channels:
3
+ - conda-forge
4
+ - nodefaults
5
+ dependencies:
6
+ - safetensors *
7
+ - scikit-learn *
8
+ - cloudpickle *
9
+ - pytest *
10
+ - pytest-cov *
11
+ - pytest-xdist *
12
+ - pytest-benchmark *
13
+ - pytest-mock *
14
+ - pyyaml *
15
+ - mypy >=2.4.0,<2.5.0
16
+ - pre-commit *
17
+ - pytensor >=3.3.8,<3.4.0
18
+ - numpy *
19
+ - python >=3.12
@@ -72,6 +72,7 @@ Normalization and regularization
72
72
 
73
73
  BatchNorm
74
74
  LayerNorm
75
+ RMSNorm
75
76
  GroupNorm
76
77
  Dropout
77
78
 
@@ -102,3 +103,5 @@ Attention and transformers
102
103
  FeedForward
103
104
  TransformerBlock
104
105
  scaled_dot_product_attention
106
+ RotaryEmbedding
107
+ rotary_embedding
@@ -10,6 +10,7 @@ Training
10
10
  :toctree: generated/
11
11
 
12
12
  compile_train
13
+ build_train_updates
13
14
 
14
15
  Update rules
15
16
  ------------
@@ -18,13 +18,23 @@ Setting up
18
18
  pip install -e ".[dev]"
19
19
  pre-commit install
20
20
 
21
- The conda environments under ``conda_envs/`` are what CI installs, pinned
22
- harder than the package metadata. Reach for one when a failure reproduces in CI
23
- but not locally:
21
+ CI installs the pixi environments locked in ``pixi.lock``, pinned harder than
22
+ the package metadata. Reach for one when a failure reproduces in CI but not
23
+ locally:
24
+
25
+ .. code-block:: bash
26
+
27
+ pixi run -e test pytest # the core jobs; test-jax, test-mlx, test-torch for a backend
28
+ pixi run -e mypy python scripts/run_mypy.py
29
+
30
+ ``conda_envs/pytensor_ml.yml`` is exported from the pixi ``dev`` environment by a
31
+ pre-commit hook, for setting up with conda instead:
24
32
 
25
33
  .. code-block:: bash
26
34
 
27
35
  conda env create -f conda_envs/pytensor_ml.yml
36
+ conda activate pytensor_ml
37
+ pip install -e .
28
38
 
29
39
  Docs are built with pixi, which owns its own environment:
30
40
 
@@ -71,3 +71,17 @@
71
71
  pages = {170--192},
72
72
  year = {2005},
73
73
  }
74
+
75
+ @article{su2021roformer,
76
+ title = {RoFormer: Enhanced Transformer with Rotary Position Embedding},
77
+ author = {Su, Jianlin and Lu, Yu and Pan, Shengfeng and Murtadha, Ahmed and Wen, Bo and Liu, Yunfeng},
78
+ journal = {arXiv preprint arXiv:2104.09864},
79
+ year = {2021},
80
+ }
81
+
82
+ @article{chen2023interpolation,
83
+ title = {Extending Context Window of Large Language Models via Positional Interpolation},
84
+ author = {Chen, Shouyuan and Wong, Sherman and Chen, Liangjian and Tian, Yuandong},
85
+ journal = {arXiv preprint arXiv:2306.15595},
86
+ year = {2023},
87
+ }