Skip to main content

paxjaxlib

A simple and functional neural network library built on JAX.

CI PyPI version


paxjaxlib is a lightweight and modular deep learning library that embraces JAX's functional programming paradigm. Just a simple, yet powerful, API for building and training neural networks.

Installation

You can install paxjaxlib directly from PyPI:

pip install paxjaxlib

Or, for development, clone the repository and install in editable mode:

git clone https://github.com/paxamans/paxjaxlib.git
cd paxjaxlib
pip install -e .[dev]

Quick Start

Here's a quick example of how to define, train, and evaluate a simple NeuralNetwork on dummy data.

import jax
import jax.numpy as jnp
import optax
from paxjaxlib.layers import Dense
from paxjaxlib.models import NeuralNetwork
from paxjaxlib.training import Trainer

# 1. Generate dummy data
key = jax.random.PRNGKey(0)
X = jax.random.normal(key, (100, 10))
y = jax.random.normal(key, (100, 1))

# 2. Define the model
# The model is a pytree, so its parameters can be manipulated functionally.
model = NeuralNetwork([
    Dense(10, 64),
    jax.nn.relu,
    Dense(64, 1)
])

# 3. Initialize the trainer with an Optax optimizer
# The trainer manages the training loop and state.
trainer = Trainer(model, optimizer=optax.adam(1e-3))

# 4. Train the model
# The `train` method returns a history of metrics.
history = trainer.train(X, y, epochs=10, batch_size=32)
print("Training loss:", history['loss'][-1])

# 5. Make predictions
# The trained model is available at `trainer.model`.
predictions = trainer.model(X)

Architecture

The core of paxjaxlib is the paxjaxlib.core.Module, which serves as the base for all layers and models. By inheriting from Module, classes are automatically registered as JAX pytrees.

  • Models are data: A NeuralNetwork or Dense layer is a simple data structure. All parameters are stored as attributes.
  • Stateless updates: Training updates produce a new, updated model object instead of modifying an existing one in place.
  • Gradients with respect to models: You can compute gradients directly with respect to the entire model object, for example: grads = jax.grad(loss_fn)(model, X, y).

Wiki & Documentation

Coming soon

License

This project is licensed under the MIT LICENSE.

Metadata

Release files for paxjaxlib 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paxjaxlib 0.2.1
File Size Uploaded Provenance Actions
paxjaxlib-0.2.1.tar.gz 28.5 kB Without provenance Details for paxjaxlib-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for paxjaxlib 0.2.1
File Interpreter ABI Platform Actions
paxjaxlib-0.2.1-py3-none-any.whl Python 3 none any Details for paxjaxlib-0.2.1-py3-none-any.whl

Total release size: 54.7 kB

Release files / paxjaxlib-0.2.1.tar.gz

Download URL paxjaxlib-0.2.1.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6250f0c9ddf6a6be256391cbb243871fdf51c5c3f182cd0f4073a1398ca07f23
BLAKE2b-256 checksum
How to use checksums
63c98840acd49743c629e763f3a831c8efe0fecfe4f4f7c9d2060fe55018c8e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / paxjaxlib-0.2.1-py3-none-any.whl

Download URL paxjaxlib-0.2.1-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e6c95a05993a62ac581d54f1531c5495fc0158b1b3ea2d5bef6d55bee6bc751
BLAKE2b-256 checksum
How to use checksums
31e3919f7e969e37db5c94357f349f4a680a33312857a3488bb3a384a5e4168f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for paxjaxlib 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page