statedict2pytree 0.5.0__tar.gz → 0.5.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 (35) hide show
  1. {statedict2pytree-0.5.0 → statedict2pytree-0.5.2}/.gitignore +2 -0
  2. statedict2pytree-0.5.2/PKG-INFO +64 -0
  3. statedict2pytree-0.5.2/README.md +36 -0
  4. statedict2pytree-0.5.2/client/.gitignore +3 -0
  5. statedict2pytree-0.5.2/client/package-lock.json +4540 -0
  6. statedict2pytree-0.5.2/client/package.json +36 -0
  7. statedict2pytree-0.5.2/client/public/bundle.js +9691 -0
  8. statedict2pytree-0.5.2/client/public/bundle.js.map +1 -0
  9. statedict2pytree-0.5.2/client/public/index.html +14 -0
  10. {statedict2pytree-0.5.0/statedict2pytree/static → statedict2pytree-0.5.2/client/public}/output.css +257 -129
  11. statedict2pytree-0.5.2/client/rollup.config.mjs +44 -0
  12. statedict2pytree-0.5.2/client/src/App.svelte +343 -0
  13. statedict2pytree-0.5.2/client/src/empty.ts +0 -0
  14. statedict2pytree-0.5.2/client/src/main.js +8 -0
  15. {statedict2pytree-0.5.0 → statedict2pytree-0.5.2/client}/tailwind.config.js +1 -1
  16. statedict2pytree-0.5.2/client/tsconfig.json +5 -0
  17. {statedict2pytree-0.5.0 → statedict2pytree-0.5.2}/pyproject.toml +15 -5
  18. statedict2pytree-0.5.0/.pre-commit-config.yaml +0 -16
  19. statedict2pytree-0.5.0/PKG-INFO +0 -147
  20. statedict2pytree-0.5.0/README.md +0 -123
  21. statedict2pytree-0.5.0/examples/convert_resnet.py +0 -19
  22. statedict2pytree-0.5.0/examples/doggo.jpeg +0 -0
  23. statedict2pytree-0.5.0/examples/resnet.py +0 -409
  24. statedict2pytree-0.5.0/examples/resnet_inference.py +0 -68
  25. statedict2pytree-0.5.0/package-lock.json +0 -1424
  26. statedict2pytree-0.5.0/package.json +0 -9
  27. statedict2pytree-0.5.0/pyrightconfig.json +0 -4
  28. statedict2pytree-0.5.0/statedict2pytree/__init__.py +0 -7
  29. statedict2pytree-0.5.0/statedict2pytree/statedict2pytree.py +0 -219
  30. statedict2pytree-0.5.0/statedict2pytree/templates/index.html +0 -308
  31. statedict2pytree-0.5.0/tests/test_batchnorm.py +0 -46
  32. statedict2pytree-0.5.0/tests/test_conv.py +0 -57
  33. statedict2pytree-0.5.0/tests/test_linear.py +0 -41
  34. statedict2pytree-0.5.0/torch2jax.png +0 -0
  35. {statedict2pytree-0.5.0/statedict2pytree/static → statedict2pytree-0.5.2/client/public}/input.css +0 -0
@@ -159,3 +159,5 @@ cython_debug/
159
159
  # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
160
  #.idea/
161
161
  node_modules/
162
+ examples/llama/Meta-Llama-3-8B/
163
+ .zed/
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.3
2
+ Name: statedict2pytree
3
+ Version: 0.5.2
4
+ Summary: Converts torch models into PyTrees for Equinox
5
+ Author-email: "Artur A. Galstyan" <mail@arturgalstyan.dev>
6
+ Requires-Python: ~=3.10
7
+ Requires-Dist: beartype
8
+ Requires-Dist: equinox
9
+ Requires-Dist: flask
10
+ Requires-Dist: jax
11
+ Requires-Dist: jaxlib
12
+ Requires-Dist: jaxonmodels
13
+ Requires-Dist: jaxtyping
14
+ Requires-Dist: loguru
15
+ Requires-Dist: penzai
16
+ Requires-Dist: pydantic
17
+ Requires-Dist: torch
18
+ Requires-Dist: torchvision
19
+ Requires-Dist: typing-extensions
20
+ Provides-Extra: dev
21
+ Requires-Dist: mkdocs; extra == 'dev'
22
+ Requires-Dist: nox; extra == 'dev'
23
+ Requires-Dist: pre-commit; extra == 'dev'
24
+ Requires-Dist: pytest; extra == 'dev'
25
+ Provides-Extra: examples
26
+ Requires-Dist: jaxonmodels; extra == 'examples'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # statedict2pytree
30
+
31
+ ![statedict2pytree](statedict2pytree.png "A ResNet demo")
32
+
33
+ ## Important
34
+
35
+ This package is still in its infancy and hihgly experimental! The code works, but it's far from perfect. With more and more iterations, it will eventually become stable and well tested.
36
+ PRs and other contributions are *highly* welcome! :)
37
+
38
+ ## Info
39
+
40
+ The goal of this package is to simplify the conversion from PyTorch models into JAX PyTrees (which can be used e.g. in Equinox). The way this works is by putting both models side my side and aligning the weights in the right order. Then, all statedict2pytree is doing, is iterating over both lists and matching the weight matrices.
41
+
42
+ Usually, if you _declared the fields in the same order as in the PyTorch model_, you don't have to rearrange anything -- but the option is there if you need it.
43
+
44
+ (Theoretically, you can rearrange the model in any way you like - e.g. last layer as the first layer - as long as the shapes match!)
45
+
46
+ ## Shape Matching? What's that?
47
+
48
+ Currently, there is no sophisticated shape matching in place. Two matrices are considered "matching" if the product of their shape match. For example:
49
+
50
+ (8, 1, 1) and (8, ) match, because (8 _ 1 _ 1 = 8)
51
+
52
+ ## Get Started
53
+
54
+ ### Installation
55
+
56
+ Run
57
+
58
+ ```bash
59
+ pip install statedict2pytree
60
+ ```
61
+
62
+ ### Docs
63
+
64
+ Documentation will appear as soon as I have all the necessary features implemented. Until then, check out the "main.py" file for a better example.
@@ -0,0 +1,36 @@
1
+ # statedict2pytree
2
+
3
+ ![statedict2pytree](statedict2pytree.png "A ResNet demo")
4
+
5
+ ## Important
6
+
7
+ This package is still in its infancy and hihgly experimental! The code works, but it's far from perfect. With more and more iterations, it will eventually become stable and well tested.
8
+ PRs and other contributions are *highly* welcome! :)
9
+
10
+ ## Info
11
+
12
+ The goal of this package is to simplify the conversion from PyTorch models into JAX PyTrees (which can be used e.g. in Equinox). The way this works is by putting both models side my side and aligning the weights in the right order. Then, all statedict2pytree is doing, is iterating over both lists and matching the weight matrices.
13
+
14
+ Usually, if you _declared the fields in the same order as in the PyTorch model_, you don't have to rearrange anything -- but the option is there if you need it.
15
+
16
+ (Theoretically, you can rearrange the model in any way you like - e.g. last layer as the first layer - as long as the shapes match!)
17
+
18
+ ## Shape Matching? What's that?
19
+
20
+ Currently, there is no sophisticated shape matching in place. Two matrices are considered "matching" if the product of their shape match. For example:
21
+
22
+ (8, 1, 1) and (8, ) match, because (8 _ 1 _ 1 = 8)
23
+
24
+ ## Get Started
25
+
26
+ ### Installation
27
+
28
+ Run
29
+
30
+ ```bash
31
+ pip install statedict2pytree
32
+ ```
33
+
34
+ ### Docs
35
+
36
+ Documentation will appear as soon as I have all the necessary features implemented. Until then, check out the "main.py" file for a better example.
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ node_modules
3
+ public/bundle.*