Equimo 0.1.0__py3-none-any.whl
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.
- Equimo-0.1.0.dist-info/LICENSE.md +21 -0
- Equimo-0.1.0.dist-info/METADATA +104 -0
- Equimo-0.1.0.dist-info/RECORD +29 -0
- Equimo-0.1.0.dist-info/WHEEL +5 -0
- Equimo-0.1.0.dist-info/top_level.txt +1 -0
- equimo/__init__.py +0 -0
- equimo/layers/__init__.py +0 -0
- equimo/layers/attention.py +1526 -0
- equimo/layers/convolution.py +329 -0
- equimo/layers/downsample.py +58 -0
- equimo/layers/dropout.py +217 -0
- equimo/layers/ffn.py +184 -0
- equimo/layers/generic.py +68 -0
- equimo/layers/mamba.py +169 -0
- equimo/layers/norm.py +87 -0
- equimo/layers/patch.py +399 -0
- equimo/layers/posemb.py +416 -0
- equimo/layers/sharing.py +160 -0
- equimo/layers/squeeze_excite.py +143 -0
- equimo/models/__init__.py +7 -0
- equimo/models/emamodel.py +99 -0
- equimo/models/fastervit.py +488 -0
- equimo/models/mlla.py +166 -0
- equimo/models/partialformer.py +407 -0
- equimo/models/shvit.py +376 -0
- equimo/models/vit.py +472 -0
- equimo/models/vssd.py +189 -0
- equimo/ops/scan.py +246 -0
- equimo/utils.py +127 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Clément POIRET
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: Equimo
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Implementation of popular vision models in Jax
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE.md
|
|
8
|
+
Requires-Dist: einops>=0.8.0
|
|
9
|
+
Requires-Dist: equinox>=0.11.5
|
|
10
|
+
Requires-Dist: jax>=0.4.25
|
|
11
|
+
Requires-Dist: jaxlib>=0.4.25
|
|
12
|
+
|
|
13
|
+
# Equimo: Modern Vision Models in JAX/Equinox
|
|
14
|
+
|
|
15
|
+
**WARNING**: This is a research library implementing recent computer vision models. The implementations are based on paper descriptions and may not be exact replicas of the original implementations. Use with caution in production environments.
|
|
16
|
+
|
|
17
|
+
Equimo (Equinox Image Models) provides JAX/Equinox implementations of recent computer vision models, currently focusing (but not limited to) on transformer and state-space architectures.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- Pure JAX/Equinox implementations
|
|
22
|
+
- Focus on recent architectures (2023-2024 papers)
|
|
23
|
+
- Modular design for easy experimentation
|
|
24
|
+
- Extensive documentation and type hints
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### From PyPI
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install equimo
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### From Source
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/clementpoiret/equimo.git
|
|
38
|
+
cd equimo
|
|
39
|
+
pip install -e .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Implemented Models
|
|
43
|
+
|
|
44
|
+
| Model | Paper | Year | Status |
|
|
45
|
+
|-------|-------|------|--------|
|
|
46
|
+
| FasterViT | [FasterViT: Fast Vision Transformers with Hierarchical Attention](https://arxiv.org/abs/2306.06189) | 2023 | ✅ |
|
|
47
|
+
| Castling-ViT | [Castling-ViT: Compressing Self-Attention via Switching Towards Linear-Angular Attention During Vision Transformer Inference](https://arxiv.org/abs/2211.10526) | 2023 | Partial* |
|
|
48
|
+
| MLLA | [Mamba-like Linear Attention](https://arxiv.org/abs/2405.16605) | 2024 | ✅ |
|
|
49
|
+
| PartialFormer | [Efficient Vision Transformers with Partial Attention](https://eccv.ecva.net/virtual/2024/poster/1877) | 2024 | ✅ |
|
|
50
|
+
| SHViT | [SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design](https://arxiv.org/abs/2401.16456) | 2024 | ✅ |
|
|
51
|
+
| VSSD | [VSSD: Vision Mamba with Non-Causal State Space Duality](https://arxiv.org/abs/2407.18559) | 2024 | ✅ |
|
|
52
|
+
|
|
53
|
+
*: Only contains the [Linear Angular Attention](https://github.com/clementpoiret/Equimo/blob/f8fcc79e45ca65e9deb1d970c4286c0b8562f9c2/equimo/layers/attention.py#L1407) module. It is straight forward to build a ViT around it, but may require an additional `__call__` kwarg to control the `sparse_reg` bool.
|
|
54
|
+
|
|
55
|
+
## Basic Usage
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import jax
|
|
59
|
+
|
|
60
|
+
import equimo.models as em
|
|
61
|
+
|
|
62
|
+
# Create a model (e.g. `faster_vit_0_224`)
|
|
63
|
+
key = jax.random.PRNGKey(0)
|
|
64
|
+
model = em.FasterViT(
|
|
65
|
+
img_size=224,
|
|
66
|
+
in_channels=3,
|
|
67
|
+
dim=64,
|
|
68
|
+
in_dim=64,
|
|
69
|
+
depths=[2, 3, 6, 5],
|
|
70
|
+
num_heads=[2, 4, 8, 16],
|
|
71
|
+
hat=[False, False, True, False],
|
|
72
|
+
window_size=[7, 7, 7, 7],
|
|
73
|
+
ct_size=2,
|
|
74
|
+
key=key,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Generate random input
|
|
78
|
+
x = jax.random.normal(key, (3, 224, 224))
|
|
79
|
+
|
|
80
|
+
# Run inference
|
|
81
|
+
output = model(x, enable_dropout=False, key=key)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Contributing
|
|
85
|
+
|
|
86
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
91
|
+
|
|
92
|
+
## Citation
|
|
93
|
+
|
|
94
|
+
If you use Equimo in your research, please cite:
|
|
95
|
+
|
|
96
|
+
```bibtex
|
|
97
|
+
@software{equimo2024,
|
|
98
|
+
author = {Clément POIRET},
|
|
99
|
+
title = {Equimo: Modern Vision Models in JAX/Equinox},
|
|
100
|
+
year = {2024},
|
|
101
|
+
publisher = {GitHub},
|
|
102
|
+
url = {https://github.com/clementpoiret/equimo}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
equimo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
equimo/utils.py,sha256=A6s6mRAvdnKWgTniZRYmSNNc0b7slAPFy5XwtSkl9dQ,3507
|
|
3
|
+
equimo/layers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
equimo/layers/attention.py,sha256=BMMBIgMAgC24BZSeICqRoYJOd07QzhK6sLgXyJSZpqA,46132
|
|
5
|
+
equimo/layers/convolution.py,sha256=HlnnoRkDXKOuUVWlNVvm2eCT_CPU3a68-FZFU_4dwYQ,10529
|
|
6
|
+
equimo/layers/downsample.py,sha256=z3l6iiww8-k976q-WlbYk1iaSeyniMg7RD_Q-BwZV-Y,1691
|
|
7
|
+
equimo/layers/dropout.py,sha256=wXVccY87q5080nJKmQycw75QYwna8V-zUb0OMpoNYAw,7457
|
|
8
|
+
equimo/layers/ffn.py,sha256=fBzeQMXjAaUmSZ7F3ann5QT13apF5bNhPVyXvbiaYeY,5469
|
|
9
|
+
equimo/layers/generic.py,sha256=o2RzVxKj74Lkr6ADtIq8XD0ujLBbChDV5ALMHK3GaBY,2159
|
|
10
|
+
equimo/layers/mamba.py,sha256=WupMpWZ4OmtVMyhP_iu5_s3CAUBvnDDqzPmkg-GKTm8,5567
|
|
11
|
+
equimo/layers/norm.py,sha256=TwqT2DmV7ljEiIHTtBz3s8adx99VHItivy6UmJzjPtM,2425
|
|
12
|
+
equimo/layers/patch.py,sha256=xHTzIalPXuq_EisMZP3RpR2Ks5R7qIz6tF0FXlGCbyg,12634
|
|
13
|
+
equimo/layers/posemb.py,sha256=eAa7yc4MxeGJGadApJrFnEYh4h275eF53YxV4_QM0Go,13392
|
|
14
|
+
equimo/layers/sharing.py,sha256=brqIRjXv1rytqIejt1AB0sDXdL1378c0Ubax5ZnNZfs,4003
|
|
15
|
+
equimo/layers/squeeze_excite.py,sha256=BVhuX2s_sQStdKd-Xg3sn76d7r1AW8JmRlVHtN7LTtM,4142
|
|
16
|
+
equimo/models/__init__.py,sha256=6-CNU6Ww5_abbfOJJrcdVgsCf584i3QbgL0w6ZsjhVA,211
|
|
17
|
+
equimo/models/emamodel.py,sha256=v4eYSUJVl5nV6P2_HNc1L2715DUJfuWQfJwogCxvS5M,2916
|
|
18
|
+
equimo/models/fastervit.py,sha256=Vj-IcVmtGUcjE-i8YnUJAqrQUYmy6MhIWSgHMyuy7Go,15061
|
|
19
|
+
equimo/models/mlla.py,sha256=9EY51VUJT1SzwqpdRz-UrCLJaI5kmqmDUE27DJa9jio,5519
|
|
20
|
+
equimo/models/partialformer.py,sha256=-QyvgFGvJTU67DbFQGTLV8K6si51E3y4FGECyVUrngk,12813
|
|
21
|
+
equimo/models/shvit.py,sha256=3ljwoAMCPxA5y09pSVqrO1kKIYHegRUIYtmVyeFlpO4,11028
|
|
22
|
+
equimo/models/vit.py,sha256=ZWsLlvwyDJMLd7twMhJgOcHQyaXBjMgcD49-cQyM-d8,15885
|
|
23
|
+
equimo/models/vssd.py,sha256=_UByQTnfmRi_IyNQgAh9Ddipr7QG-d5rFK_srkT4tls,6284
|
|
24
|
+
equimo/ops/scan.py,sha256=1v80gkIkmQ0QoUj5YJpVQQ7ZjF3AfPfQchGLqSOqf4g,8729
|
|
25
|
+
Equimo-0.1.0.dist-info/LICENSE.md,sha256=NDoiESQBdng_tbHOUj6BvMHpxu5P8JtsRbqVz-4rNIM,1072
|
|
26
|
+
Equimo-0.1.0.dist-info/METADATA,sha256=6v5O8AiLaWdj9yX0F_uBTFAIK1OFEBlirVWnjEhLLfY,3412
|
|
27
|
+
Equimo-0.1.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
28
|
+
Equimo-0.1.0.dist-info/top_level.txt,sha256=wfqgodqy_2pxpHWYoY89Fzr2I0-zPOER8zQ5bHWUxH0,7
|
|
29
|
+
Equimo-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
equimo
|
equimo/__init__.py
ADDED
|
File without changes
|
|
File without changes
|