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.
- {statedict2pytree-0.5.0 → statedict2pytree-0.5.2}/.gitignore +2 -0
- statedict2pytree-0.5.2/PKG-INFO +64 -0
- statedict2pytree-0.5.2/README.md +36 -0
- statedict2pytree-0.5.2/client/.gitignore +3 -0
- statedict2pytree-0.5.2/client/package-lock.json +4540 -0
- statedict2pytree-0.5.2/client/package.json +36 -0
- statedict2pytree-0.5.2/client/public/bundle.js +9691 -0
- statedict2pytree-0.5.2/client/public/bundle.js.map +1 -0
- statedict2pytree-0.5.2/client/public/index.html +14 -0
- {statedict2pytree-0.5.0/statedict2pytree/static → statedict2pytree-0.5.2/client/public}/output.css +257 -129
- statedict2pytree-0.5.2/client/rollup.config.mjs +44 -0
- statedict2pytree-0.5.2/client/src/App.svelte +343 -0
- statedict2pytree-0.5.2/client/src/empty.ts +0 -0
- statedict2pytree-0.5.2/client/src/main.js +8 -0
- {statedict2pytree-0.5.0 → statedict2pytree-0.5.2/client}/tailwind.config.js +1 -1
- statedict2pytree-0.5.2/client/tsconfig.json +5 -0
- {statedict2pytree-0.5.0 → statedict2pytree-0.5.2}/pyproject.toml +15 -5
- statedict2pytree-0.5.0/.pre-commit-config.yaml +0 -16
- statedict2pytree-0.5.0/PKG-INFO +0 -147
- statedict2pytree-0.5.0/README.md +0 -123
- statedict2pytree-0.5.0/examples/convert_resnet.py +0 -19
- statedict2pytree-0.5.0/examples/doggo.jpeg +0 -0
- statedict2pytree-0.5.0/examples/resnet.py +0 -409
- statedict2pytree-0.5.0/examples/resnet_inference.py +0 -68
- statedict2pytree-0.5.0/package-lock.json +0 -1424
- statedict2pytree-0.5.0/package.json +0 -9
- statedict2pytree-0.5.0/pyrightconfig.json +0 -4
- statedict2pytree-0.5.0/statedict2pytree/__init__.py +0 -7
- statedict2pytree-0.5.0/statedict2pytree/statedict2pytree.py +0 -219
- statedict2pytree-0.5.0/statedict2pytree/templates/index.html +0 -308
- statedict2pytree-0.5.0/tests/test_batchnorm.py +0 -46
- statedict2pytree-0.5.0/tests/test_conv.py +0 -57
- statedict2pytree-0.5.0/tests/test_linear.py +0 -41
- statedict2pytree-0.5.0/torch2jax.png +0 -0
- {statedict2pytree-0.5.0/statedict2pytree/static → statedict2pytree-0.5.2/client/public}/input.css +0 -0
|
@@ -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
|
+

|
|
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
|
+

|
|
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.
|