Zlynx is a lightweight, highly-customizable deep learning library built on top of JAX and Flax NNX
Project description
Zlynx
[!CAUTION] Zlynx is currently an experimental library. APIs are subject to change without notice. We recommend pinning versions for production use.
An experimental, lightweight deep learning library built on JAX and Flax NNX. It explores providing researchers and developers with fine-grained control over model architectures, training loops, and distributed setups.
Install
uv pip install zlynx
Experimental Model Interface
Zlynx introduces Z as an experimental base class for models, aiming to provide built-in utilities for saving, loading, and sharing model artifacts.
import jax
from flax import nnx
from zlynx import Z
class MyModel(Z):
def __init__(self, rngs: nnx.Rngs, in_features: int, hidden: int, out_features: int):
self.linear1 = nnx.Linear(in_features, hidden, rngs=rngs)
self.linear2 = nnx.Linear(hidden, out_features, rngs=rngs)
def __call__(self, x):
x = jax.nn.relu(self.linear1(x))
return self.linear2(x)
# Initialize
model = MyModel(nnx.Rngs(42), in_features=784, hidden=256, out_features=10)
# Save & Load
model.save("./my-model", format="safetensors")
restored = MyModel.load("./my-model", rngs=nnx.Rngs(0), in_features=784, hidden=256, out_features=10)
# Push to Hubs (Experimental)
model.push_hf("username/my-model")
model.push_kaggle("username/my-model")
Training
The Trainer is designed to handle common tasks of the training loop, including optimization, checkpointing, and logging.
from zlynx.trainer import Trainer, TrainerConfig
trainer = Trainer(
model=model,
loss_fn=loss_fn,
train_dataset=dataset,
config=TrainerConfig(
batch_size=32,
learning_rate=5e-5,
num_epochs=3,
sharding="auto", # Experimental sharding
),
)
trainer.train()
PEFT (LoRA, DoRA, VeRA, LoHa, LoKr, AdaLoRA)
Zlynx provides utilities to apply various parameter-efficient fine-tuning (PEFT) methods.
from zlynx.module.peft import apply_peft
model = apply_peft(
model,
method="lora",
r=16,
alpha=32,
target_modules=["linear1", "linear2"]
)
Goals & Features
- JAX + Flax NNX Integration — Explores combining XLA speed with the flexible NNX module system.
- Checkpointing Utilities — Experimental support for Orbax + SafeTensors, HuggingFace Hub, and Kaggle.
- Training Helpers — Gradient accumulation, LR scheduling, and multi-backend logging.
- Sharding Support — Initial support for transitioning between single-device and distributed (DDP, FSDP) training.
- PEFT Methods — Implementation of 6 adapter methods via
apply_peft(). - GaLore — Experimental gradient low-rank projection for memory-efficient fine-tuning.
Documentation
For full guides and current API references, visit the Documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zlynx-0.1.11.tar.gz.
File metadata
- Download URL: zlynx-0.1.11.tar.gz
- Upload date:
- Size: 68.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2afea9e8e5b3bb8b287c7e249895c660495b4664e65e8c2a1d52d075213e3122
|
|
| MD5 |
d9c4d952d4a047d674136aabe5d81f92
|
|
| BLAKE2b-256 |
0ce8440147d39a4298bbb4eb2fa3b5600b6b88f541cd55400ca3a93d784ebbf5
|
Provenance
The following attestation bundles were made for zlynx-0.1.11.tar.gz:
Publisher:
publish.yml on zlynx-ai/zlynx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zlynx-0.1.11.tar.gz -
Subject digest:
2afea9e8e5b3bb8b287c7e249895c660495b4664e65e8c2a1d52d075213e3122 - Sigstore transparency entry: 1484997760
- Sigstore integration time:
-
Permalink:
zlynx-ai/zlynx@a9abb29f0b9004f0e473d57b0a214432fe664dd4 -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/zlynx-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9abb29f0b9004f0e473d57b0a214432fe664dd4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file zlynx-0.1.11-py3-none-any.whl.
File metadata
- Download URL: zlynx-0.1.11-py3-none-any.whl
- Upload date:
- Size: 79.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
657585aa97b06fb029d759b7497124d9af78dabbdc46d81b0854861977303ad9
|
|
| MD5 |
53e6287d67bb8629510ab7c6ebba1e59
|
|
| BLAKE2b-256 |
6eac9e07fd417eecbac506373f9c8de3ead086531e23d2698611bb66053b6f02
|
Provenance
The following attestation bundles were made for zlynx-0.1.11-py3-none-any.whl:
Publisher:
publish.yml on zlynx-ai/zlynx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zlynx-0.1.11-py3-none-any.whl -
Subject digest:
657585aa97b06fb029d759b7497124d9af78dabbdc46d81b0854861977303ad9 - Sigstore transparency entry: 1484997810
- Sigstore integration time:
-
Permalink:
zlynx-ai/zlynx@a9abb29f0b9004f0e473d57b0a214432fe664dd4 -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/zlynx-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9abb29f0b9004f0e473d57b0a214432fe664dd4 -
Trigger Event:
push
-
Statement type: