Seli - Fast Neural Networks Research in Jax
Minimizing the time from idea to implementation with flexible neural networks in seli. Less boilerplate, more utilities for quick iteration speed.
Features
- Mutable modules for quick and dirty modifications via Module
- Serialization of modules via
@saveable,save, andload - Systematically modifying modules by traversing nested modules
- Safely handling shared/cyclical references and static arguments through
seli.jit - Commonly used NN layers and optimizers are included
- As a small codebase, it is relatively easy to understand and extend
Quick Example
Define new layers by subclassing seli.Module. All modules are PyTrees.
Check out the examples for more sophisticated usage.
# add a name to make the module saveable
class Linear(seli.Module, name="example:Linear");
def __init__(self, dim: int)
self.dim = dim
# parameters can be directly initialized
# or an initialization method can be passed
self.weight = seli.netParam(init=seli.net.InitNormal("He"))
def __call__(self, x):
# the weight gets initialized on the first call
# by providing the shape, the value is stored
return x @ self.weight((x.shape[-1], self.dim))
# set the rngs for all submodules at once
# no code for passing rngs around is needed
model = Linear(10).set_rngs(42)
y = model(jnp.ones(8))
A training step can be written as follows, it requires python 3.11 or newer.
optimizer = seli.opt.Adam(1e-3)
loss = seli.opt.MeanSquaredError()
x = jax.numpy.ones(32, 8)
y = jax.numpy.ones(32, 10)
optimizer, model, loss_value = optimizer.minimize(loss, model, y, x)
Models can be serialized and loaded. This process is safe and does not use pickling.
seli.save(model, "model.npz")
# load the model
model = seli.load("model.npz")
assert isinstance(model, Linear)
Installation
You can install from PyPI using pip
pip install seli
See Also
- Jax Docs: Jax is a library for numerical computing that is designed to be composable and fast.
- Equinox library: FlareJax is heavily inspired by this awesome library.
- torch.nn.Module: Many of the principles of mutability are inspired by PyTorch's
torch.nn.Module. - NNX Docs: NNX is a library for neural networks in flax that also supports mutability.
- Always feel free to reach out to me via email.
Metadata
Release files for seli 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| seli-0.1.2.tar.gz | 49.0 kB | With provenance | Details for seli-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seli-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for seli-0.1.2-py3-none-any.whl |
Total release size: 85.8 kB
Release files / seli-0.1.2.tar.gz
| Download URL | seli-0.1.2.tar.gz |
|---|---|
| Size | 49.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90f5301aadc2393bd1ac2f23b0fb0d1b9ec5b70ec8c2390c1faefa479373c272
|
|
BLAKE2b-256 checksum How to use checksums |
f71ba2b5de815e5951787e1d821a59200cd85433f7f9764d0ced69e076a8d0b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 26, 2025.
Transparency logRelease files / seli-0.1.2-py3-none-any.whl
| Download URL | seli-0.1.2-py3-none-any.whl |
|---|---|
| Size | 36.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d390d3f0d5d341dbf5e1ab68aef434b7c2ab6fa43fbf23f336349ed695651a74
|
|
BLAKE2b-256 checksum How to use checksums |
b34b1ce66f85e91f9dc39bfcf4070bad2618041b9c0f3d809b0b469b4510170b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 26, 2025.
Transparency logSecurity for seli 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for seli-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 26, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.