cax 0.1.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.
cax-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Maxence Faldor
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.
cax-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.1
2
+ Name: cax
3
+ Version: 0.1.0
4
+ Summary: Cellular Automata Accelerated in JAX
5
+ Author-email: Maxence Faldor <maxencefaldor@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Maxence Faldor
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/maxencefaldor/cax
29
+ Project-URL: Issues, https://github.com/maxencefaldor/cax/issues
30
+ Keywords: cellular automata,self-organization,emergence
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Operating System :: OS Independent
34
+ Requires-Python: >=3.11
35
+ Description-Content-Type: text/markdown
36
+ License-File: LICENSE
37
+ Requires-Dist: numpy>=2.1.0
38
+ Requires-Dist: jax>=0.4.31
39
+ Requires-Dist: flax>=0.9.0
40
+ Requires-Dist: optax>=0.2.3
41
+ Requires-Dist: datasets>=2.21.0
42
+ Requires-Dist: pillow>=10.4.0
43
+ Requires-Dist: ipython>=8.26.0
44
+ Requires-Dist: ipykernel>=6.29.5
45
+ Requires-Dist: ipywidgets>=8.1.5
46
+ Requires-Dist: mediapy>=1.2.2
47
+ Provides-Extra: cuda
48
+ Requires-Dist: jax[cuda12]; extra == "cuda"
49
+ Provides-Extra: tpu
50
+ Requires-Dist: jax[tpu]; extra == "tpu"
51
+ Provides-Extra: dev
52
+ Requires-Dist: pytest>=8.3.2; extra == "dev"
53
+ Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
54
+ Requires-Dist: ruff>=0.6.4; extra == "dev"
55
+ Requires-Dist: mypy>=1.11.2; extra == "dev"
56
+ Requires-Dist: pre-commit; extra == "dev"
57
+
58
+ # CAX: Cellular Automata Accelerated
59
+
60
+ CAX is a high-performance cellular automata library built on top of JAX/Flax that is **designed for flexiblity**.
61
+
62
+ ## Overview 🔎
63
+
64
+ CAX is a cutting-edge library designed to implement and accelerate various types of cellular automata using the JAX framework. Whether you're a researcher, a hobbyist, or just curious about the fascinating world of emergent and self-organizing systems, CAX has got you covered! 🧬
65
+
66
+ Despite their conceptual simplicity, cellular automata often demand significant computational resources. The parallel update of numerous cells, coupled with the need for backpropagation through time in neural cellular automata training, can render these models computationally intensive. CAX leverages hardware accelerators and massive parallelization to run cellular automata experiments in minutes. 🚀
67
+
68
+ The library works with discrete or continuous cellular automata of any spatial dimension, offering exceptional flexibility. From simulating one-dimensional [elementary cellular automata](https://github.com/maxencefaldor/cax/blob/main/examples/elementary_ca.ipynb) to training three-dimensional [self-autoencoding neural cellular automata](https://github.com/maxencefaldor/cax/blob/main/examples/self_autoencoding_mnist.ipynb), and even creating beautiful [Lenia simulations](https://github.com/maxencefaldor/cax/blob/main/examples/lenia.ipynb), CAX provides a versatile platform for exploring the rich world of self-organizing systems. ✨
69
+
70
+ ## Implemented Cellular Automata 🦎
71
+
72
+ | Cellular Automata | Reference | Example |
73
+ | --- | --- | --- |
74
+ | Elementary Cellular Automata | [Wolfram, Stephen (2002)](https://www.wolframscience.com/nks/) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/elementary_ca.ipynb) |
75
+ | Conway's Game of Life | [Gardner, Martin (1970)](https://web.stanford.edu/class/sts145/Library/life.pdf) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/life.ipynb) |
76
+ | Lenia | [Chan, Bert Wang-Chak (2020)](https://arxiv.org/pdf/2005.03742) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/lenia.ipynb) |
77
+ | Growing Neural Cellular Automata | [Mordvintsev, et al. (2020)](https://distill.pub/2020/growing-ca/) |[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_nca.ipynb) |
78
+ | Growing Conditional Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_conditional_nca.ipynb) |
79
+ | Growing Unsupervised Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_unsupervised_nca.ipynb) |
80
+ | Self-classifying MNIST Digits | [Randazzo, et al. (2020)](https://distill.pub/2020/selforg/mnist/) |[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/self_classifying_mnist.ipynb) |
81
+ | Self-autoencoding MNIST Digits | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/self_autoencoding_mnist.ipynb) |
82
+ | Diffusing Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/diffusing_nca.ipynb) |
83
+
84
+ ## Installation 🛠️
85
+
86
+ You will need Python 3.12 or later. Then, install CAX from PyPi:
87
+
88
+ ```
89
+ pip install cax
90
+ ```
91
+
92
+ To upgrade to the latest version of CAX, you can use:
93
+
94
+ ```
95
+ pip install --upgrade git+https://github.com/maxencefaldor/cax.git
96
+ ```
97
+
98
+ By default, CAX is installed on CPU, but you can install it on GPU or TPU with:
99
+
100
+ ```
101
+ pip install jax[cuda12]
102
+ pip install jax[tpu]
103
+ ```
104
+
105
+ ## Getting Started 🚦
106
+
107
+ ```python
108
+ import jax
109
+ from cax.core.ca import CA
110
+ from cax.core.perceive.dwconv_perceive import DWConvPerceive
111
+ from cax.core.update.nca_update import NCAUpdate
112
+ from flax import nnx
113
+
114
+ seed = 0
115
+
116
+ channel_size = 16
117
+ num_kernels = 3
118
+ hidden_size = 128
119
+ cell_dropout_rate = 0.5
120
+
121
+ key = jax.random.PRNGKey(seed)
122
+ rngs = nnx.Rngs(seed)
123
+
124
+ perceive = DWConvPerceive(channel_size, rngs)
125
+ update = NCAUpdate(
126
+ channel_size,
127
+ num_kernels*channel_size,
128
+ (hidden_size,),
129
+ rngs,
130
+ cell_dropout_rate=cell_dropout_rate
131
+ )
132
+ ca = CA(perceive, update)
133
+
134
+ state = jax.random.normal(key, (64, 64, channel_size))
135
+ state = ca(state, num_steps=128)
136
+ ```
137
+
138
+ ## Citing CAX 📝
139
+
140
+ To cite this repository:
141
+
142
+ ```
143
+ @software{cax2024,
144
+ author = {Faldor, Maxence and Cully, Antoine},
145
+ title = {{CAX}: Cellular Automata Accelerated in {JAX}},
146
+ url = {http://github.com/maxencefaldor/cax},
147
+ version = {0.1.0},
148
+ year = {2024},
149
+ }
150
+ ```
cax-0.1.0/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # CAX: Cellular Automata Accelerated
2
+
3
+ CAX is a high-performance cellular automata library built on top of JAX/Flax that is **designed for flexiblity**.
4
+
5
+ ## Overview 🔎
6
+
7
+ CAX is a cutting-edge library designed to implement and accelerate various types of cellular automata using the JAX framework. Whether you're a researcher, a hobbyist, or just curious about the fascinating world of emergent and self-organizing systems, CAX has got you covered! 🧬
8
+
9
+ Despite their conceptual simplicity, cellular automata often demand significant computational resources. The parallel update of numerous cells, coupled with the need for backpropagation through time in neural cellular automata training, can render these models computationally intensive. CAX leverages hardware accelerators and massive parallelization to run cellular automata experiments in minutes. 🚀
10
+
11
+ The library works with discrete or continuous cellular automata of any spatial dimension, offering exceptional flexibility. From simulating one-dimensional [elementary cellular automata](https://github.com/maxencefaldor/cax/blob/main/examples/elementary_ca.ipynb) to training three-dimensional [self-autoencoding neural cellular automata](https://github.com/maxencefaldor/cax/blob/main/examples/self_autoencoding_mnist.ipynb), and even creating beautiful [Lenia simulations](https://github.com/maxencefaldor/cax/blob/main/examples/lenia.ipynb), CAX provides a versatile platform for exploring the rich world of self-organizing systems. ✨
12
+
13
+ ## Implemented Cellular Automata 🦎
14
+
15
+ | Cellular Automata | Reference | Example |
16
+ | --- | --- | --- |
17
+ | Elementary Cellular Automata | [Wolfram, Stephen (2002)](https://www.wolframscience.com/nks/) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/elementary_ca.ipynb) |
18
+ | Conway's Game of Life | [Gardner, Martin (1970)](https://web.stanford.edu/class/sts145/Library/life.pdf) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/life.ipynb) |
19
+ | Lenia | [Chan, Bert Wang-Chak (2020)](https://arxiv.org/pdf/2005.03742) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/lenia.ipynb) |
20
+ | Growing Neural Cellular Automata | [Mordvintsev, et al. (2020)](https://distill.pub/2020/growing-ca/) |[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_nca.ipynb) |
21
+ | Growing Conditional Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_conditional_nca.ipynb) |
22
+ | Growing Unsupervised Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_unsupervised_nca.ipynb) |
23
+ | Self-classifying MNIST Digits | [Randazzo, et al. (2020)](https://distill.pub/2020/selforg/mnist/) |[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/self_classifying_mnist.ipynb) |
24
+ | Self-autoencoding MNIST Digits | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/self_autoencoding_mnist.ipynb) |
25
+ | Diffusing Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/diffusing_nca.ipynb) |
26
+
27
+ ## Installation 🛠️
28
+
29
+ You will need Python 3.12 or later. Then, install CAX from PyPi:
30
+
31
+ ```
32
+ pip install cax
33
+ ```
34
+
35
+ To upgrade to the latest version of CAX, you can use:
36
+
37
+ ```
38
+ pip install --upgrade git+https://github.com/maxencefaldor/cax.git
39
+ ```
40
+
41
+ By default, CAX is installed on CPU, but you can install it on GPU or TPU with:
42
+
43
+ ```
44
+ pip install jax[cuda12]
45
+ pip install jax[tpu]
46
+ ```
47
+
48
+ ## Getting Started 🚦
49
+
50
+ ```python
51
+ import jax
52
+ from cax.core.ca import CA
53
+ from cax.core.perceive.dwconv_perceive import DWConvPerceive
54
+ from cax.core.update.nca_update import NCAUpdate
55
+ from flax import nnx
56
+
57
+ seed = 0
58
+
59
+ channel_size = 16
60
+ num_kernels = 3
61
+ hidden_size = 128
62
+ cell_dropout_rate = 0.5
63
+
64
+ key = jax.random.PRNGKey(seed)
65
+ rngs = nnx.Rngs(seed)
66
+
67
+ perceive = DWConvPerceive(channel_size, rngs)
68
+ update = NCAUpdate(
69
+ channel_size,
70
+ num_kernels*channel_size,
71
+ (hidden_size,),
72
+ rngs,
73
+ cell_dropout_rate=cell_dropout_rate
74
+ )
75
+ ca = CA(perceive, update)
76
+
77
+ state = jax.random.normal(key, (64, 64, channel_size))
78
+ state = ca(state, num_steps=128)
79
+ ```
80
+
81
+ ## Citing CAX 📝
82
+
83
+ To cite this repository:
84
+
85
+ ```
86
+ @software{cax2024,
87
+ author = {Faldor, Maxence and Cully, Antoine},
88
+ title = {{CAX}: Cellular Automata Accelerated in {JAX}},
89
+ url = {http://github.com/maxencefaldor/cax},
90
+ version = {0.1.0},
91
+ year = {2024},
92
+ }
93
+ ```
@@ -0,0 +1,3 @@
1
+ """CAX: Cellular Automata Accelerated."""
2
+
3
+ __version__ = "0.1.0"
cax-0.1.0/cax/types.py ADDED
@@ -0,0 +1,8 @@
1
+ """Type definitions for CAX."""
2
+
3
+ import jax
4
+ from typing import TypeAlias
5
+
6
+ State: TypeAlias = jax.Array
7
+ Perception: TypeAlias = jax.Array
8
+ Input: TypeAlias = jax.Array | None
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.1
2
+ Name: cax
3
+ Version: 0.1.0
4
+ Summary: Cellular Automata Accelerated in JAX
5
+ Author-email: Maxence Faldor <maxencefaldor@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Maxence Faldor
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/maxencefaldor/cax
29
+ Project-URL: Issues, https://github.com/maxencefaldor/cax/issues
30
+ Keywords: cellular automata,self-organization,emergence
31
+ Classifier: Programming Language :: Python :: 3
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Operating System :: OS Independent
34
+ Requires-Python: >=3.11
35
+ Description-Content-Type: text/markdown
36
+ License-File: LICENSE
37
+ Requires-Dist: numpy>=2.1.0
38
+ Requires-Dist: jax>=0.4.31
39
+ Requires-Dist: flax>=0.9.0
40
+ Requires-Dist: optax>=0.2.3
41
+ Requires-Dist: datasets>=2.21.0
42
+ Requires-Dist: pillow>=10.4.0
43
+ Requires-Dist: ipython>=8.26.0
44
+ Requires-Dist: ipykernel>=6.29.5
45
+ Requires-Dist: ipywidgets>=8.1.5
46
+ Requires-Dist: mediapy>=1.2.2
47
+ Provides-Extra: cuda
48
+ Requires-Dist: jax[cuda12]; extra == "cuda"
49
+ Provides-Extra: tpu
50
+ Requires-Dist: jax[tpu]; extra == "tpu"
51
+ Provides-Extra: dev
52
+ Requires-Dist: pytest>=8.3.2; extra == "dev"
53
+ Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
54
+ Requires-Dist: ruff>=0.6.4; extra == "dev"
55
+ Requires-Dist: mypy>=1.11.2; extra == "dev"
56
+ Requires-Dist: pre-commit; extra == "dev"
57
+
58
+ # CAX: Cellular Automata Accelerated
59
+
60
+ CAX is a high-performance cellular automata library built on top of JAX/Flax that is **designed for flexiblity**.
61
+
62
+ ## Overview 🔎
63
+
64
+ CAX is a cutting-edge library designed to implement and accelerate various types of cellular automata using the JAX framework. Whether you're a researcher, a hobbyist, or just curious about the fascinating world of emergent and self-organizing systems, CAX has got you covered! 🧬
65
+
66
+ Despite their conceptual simplicity, cellular automata often demand significant computational resources. The parallel update of numerous cells, coupled with the need for backpropagation through time in neural cellular automata training, can render these models computationally intensive. CAX leverages hardware accelerators and massive parallelization to run cellular automata experiments in minutes. 🚀
67
+
68
+ The library works with discrete or continuous cellular automata of any spatial dimension, offering exceptional flexibility. From simulating one-dimensional [elementary cellular automata](https://github.com/maxencefaldor/cax/blob/main/examples/elementary_ca.ipynb) to training three-dimensional [self-autoencoding neural cellular automata](https://github.com/maxencefaldor/cax/blob/main/examples/self_autoencoding_mnist.ipynb), and even creating beautiful [Lenia simulations](https://github.com/maxencefaldor/cax/blob/main/examples/lenia.ipynb), CAX provides a versatile platform for exploring the rich world of self-organizing systems. ✨
69
+
70
+ ## Implemented Cellular Automata 🦎
71
+
72
+ | Cellular Automata | Reference | Example |
73
+ | --- | --- | --- |
74
+ | Elementary Cellular Automata | [Wolfram, Stephen (2002)](https://www.wolframscience.com/nks/) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/elementary_ca.ipynb) |
75
+ | Conway's Game of Life | [Gardner, Martin (1970)](https://web.stanford.edu/class/sts145/Library/life.pdf) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/life.ipynb) |
76
+ | Lenia | [Chan, Bert Wang-Chak (2020)](https://arxiv.org/pdf/2005.03742) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/lenia.ipynb) |
77
+ | Growing Neural Cellular Automata | [Mordvintsev, et al. (2020)](https://distill.pub/2020/growing-ca/) |[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_nca.ipynb) |
78
+ | Growing Conditional Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_conditional_nca.ipynb) |
79
+ | Growing Unsupervised Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/growing_unsupervised_nca.ipynb) |
80
+ | Self-classifying MNIST Digits | [Randazzo, et al. (2020)](https://distill.pub/2020/selforg/mnist/) |[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/self_classifying_mnist.ipynb) |
81
+ | Self-autoencoding MNIST Digits | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/self_autoencoding_mnist.ipynb) |
82
+ | Diffusing Neural Cellular Automata | Faldor, et al. (2024) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maxencefaldor/cax/blob/main/examples/diffusing_nca.ipynb) |
83
+
84
+ ## Installation 🛠️
85
+
86
+ You will need Python 3.12 or later. Then, install CAX from PyPi:
87
+
88
+ ```
89
+ pip install cax
90
+ ```
91
+
92
+ To upgrade to the latest version of CAX, you can use:
93
+
94
+ ```
95
+ pip install --upgrade git+https://github.com/maxencefaldor/cax.git
96
+ ```
97
+
98
+ By default, CAX is installed on CPU, but you can install it on GPU or TPU with:
99
+
100
+ ```
101
+ pip install jax[cuda12]
102
+ pip install jax[tpu]
103
+ ```
104
+
105
+ ## Getting Started 🚦
106
+
107
+ ```python
108
+ import jax
109
+ from cax.core.ca import CA
110
+ from cax.core.perceive.dwconv_perceive import DWConvPerceive
111
+ from cax.core.update.nca_update import NCAUpdate
112
+ from flax import nnx
113
+
114
+ seed = 0
115
+
116
+ channel_size = 16
117
+ num_kernels = 3
118
+ hidden_size = 128
119
+ cell_dropout_rate = 0.5
120
+
121
+ key = jax.random.PRNGKey(seed)
122
+ rngs = nnx.Rngs(seed)
123
+
124
+ perceive = DWConvPerceive(channel_size, rngs)
125
+ update = NCAUpdate(
126
+ channel_size,
127
+ num_kernels*channel_size,
128
+ (hidden_size,),
129
+ rngs,
130
+ cell_dropout_rate=cell_dropout_rate
131
+ )
132
+ ca = CA(perceive, update)
133
+
134
+ state = jax.random.normal(key, (64, 64, channel_size))
135
+ state = ca(state, num_steps=128)
136
+ ```
137
+
138
+ ## Citing CAX 📝
139
+
140
+ To cite this repository:
141
+
142
+ ```
143
+ @software{cax2024,
144
+ author = {Faldor, Maxence and Cully, Antoine},
145
+ title = {{CAX}: Cellular Automata Accelerated in {JAX}},
146
+ url = {http://github.com/maxencefaldor/cax},
147
+ version = {0.1.0},
148
+ year = {2024},
149
+ }
150
+ ```
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ cax/__init__.py
5
+ cax/types.py
6
+ cax.egg-info/PKG-INFO
7
+ cax.egg-info/SOURCES.txt
8
+ cax.egg-info/dependency_links.txt
9
+ cax.egg-info/requires.txt
10
+ cax.egg-info/top_level.txt
@@ -0,0 +1,23 @@
1
+ numpy>=2.1.0
2
+ jax>=0.4.31
3
+ flax>=0.9.0
4
+ optax>=0.2.3
5
+ datasets>=2.21.0
6
+ pillow>=10.4.0
7
+ ipython>=8.26.0
8
+ ipykernel>=6.29.5
9
+ ipywidgets>=8.1.5
10
+ mediapy>=1.2.2
11
+
12
+ [cuda]
13
+ jax[cuda12]
14
+
15
+ [dev]
16
+ pytest>=8.3.2
17
+ pytest-cov>=5.0.0
18
+ ruff>=0.6.4
19
+ mypy>=1.11.2
20
+ pre-commit
21
+
22
+ [tpu]
23
+ jax[tpu]
@@ -0,0 +1 @@
1
+ cax
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["setuptools>=74.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cax"
7
+ version = "0.1.0"
8
+ dependencies = [
9
+ "numpy>=2.1.0",
10
+ "jax>=0.4.31",
11
+ "flax>=0.9.0",
12
+ "optax>=0.2.3",
13
+ "datasets>=2.21.0",
14
+ "pillow>=10.4.0",
15
+ "ipython>=8.26.0",
16
+ "ipykernel>=6.29.5",
17
+ "ipywidgets>=8.1.5",
18
+ "mediapy>=1.2.2",
19
+ ]
20
+ requires-python = ">=3.11"
21
+ authors = [
22
+ { name="Maxence Faldor", email="maxencefaldor@gmail.com" },
23
+ ]
24
+ description = "Cellular Automata Accelerated in JAX"
25
+ readme = "README.md"
26
+ license = {file = "LICENSE"}
27
+ keywords = ["cellular automata", "self-organization", "emergence"]
28
+ classifiers = [
29
+ "Programming Language :: Python :: 3",
30
+ "License :: OSI Approved :: MIT License",
31
+ "Operating System :: OS Independent",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ cuda = [
36
+ "jax[cuda12]",
37
+ ]
38
+ tpu = [
39
+ "jax[tpu]",
40
+ ]
41
+ dev = [
42
+ "pytest>=8.3.2",
43
+ "pytest-cov>=5.0.0",
44
+ "ruff>=0.6.4",
45
+ "mypy>=1.11.2",
46
+ "pre-commit",
47
+ ]
48
+
49
+ [project.urls]
50
+ Homepage = "https://github.com/maxencefaldor/cax"
51
+ Issues = "https://github.com/maxencefaldor/cax/issues"
52
+
53
+ [tool]
54
+ [tool.setuptools]
55
+ packages = ["cax"]
56
+
57
+ [tool.ruff]
58
+ src = ["cax", "tests"]
59
+ target-version = "py312"
60
+ line-length = 120
61
+
62
+ [tool.ruff.lint]
63
+ select = ["E", "D", "F", "I", "N", "SIM", "UP", "W"]
64
+ ignore = ["D203", "D206", "D213", "W191"]
65
+
66
+ [tool.ruff.format]
67
+ indent-style = "tab"
68
+
69
+ [tool.mypy]
70
+ python_version = "3.12"
71
+
72
+ [[tool.mypy.overrides]]
73
+ module = ["requests.*"]
74
+ ignore_missing_imports = true
cax-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+