Skip to main content

A lightweight neural-network library built on JAX

Project description

JAXFlow Logo

PyPI version License Build Status Coverage Status


JAXFlow: A JAX-based Deep Learning and Machine Learning  Framework

JAXFlow is a modern, lightweight neural network library built on top of JAX. It is a pure-functional, multi-device-ready, and modular deep learning framework designed for research, experimentation, and production-ready machine learning pipelines.

If you're searching for a fast, flexible, and fully-JAX-compatible framework for building neural networks, JAXFlow is designed for you.


🚀 Why JAXFlow?

JAXFlow is not just another wrapper around JAX—it's a ground-up, PyTree-aware system for creating, training, and deploying high-performance deep learning models with minimal overhead and full control.

🔑 Key Features

  • Modular Model API Define networks using Sequential, subclassed Models, or flexible functional blocks.

  • 🦮 JAX-Compatible Execution Built from the ground up to support jit, vmap, pmap, pjit, and full PyTree semantics.

  • 🗺 Rich Layer Library Includes Dense, Conv, BatchNorm, Embedding, Dropout, and custom Layer classes.

  • 🏋️ Training API Use .compile() + .fit() or write custom training loops for full control.

  • ⚙️ Optimizers & Schedulers Built-in integration with Optax.

  • 📊 Losses & Streaming Metrics Includes CrossEntropy, MSE, Accuracy, F1, Precision, and more.

  • 📂 Callbacks & Checkpoints Support for EarlyStopping, LearningRateScheduler, and Orbax save/load.

  • 🧠 Built-in Models Comes with ready-to-use ResNet, MLP, Transformer, and composable blocks.

  • Lazy Imports Fast to import, loading deep components only when needed.


📦 Installation

pip install jaxflow

Requires Python ≥3.9 and a valid JAX installation.

To install JAX with GPU or TPU support:

pip install "jax[cuda]>=0.6.0" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

Or use:

pip install --upgrade jaxflow[GPU]
pip install --upgrade jaxflow[TPU]

🧑‍💻 Quickstart: Build Your First JAXFlow Model

JAXFlow supports two modeling styles: subclassing and sequential-style.

1. Subclassing a Model

import jaxflow as jf
from jaxflow.models import Model
from jaxflow.layers import Conv2D, MaxPooling2D, Dense
from jaxflow.initializers import GlorotUniform, Zeros

class CNN(Model):
    def __init__(self, num_classes: int = 10):
        super().__init__()
        self.conv1 = Conv2D(32, (3, 3), activation=jf.activations.relu)
        self.pool1 = MaxPooling2D((2, 2))
        self.conv2 = Conv2D(64, (3, 3), activation=jf.activations.relu)
        self.pool2 = MaxPooling2D((2, 2))
        self.flatten = jf.layers.GlobalAveragePooling2D()
        self.dense1 = Dense(64, activation=jf.activations.relu)
        self.outputs = Dense(num_classes, activation=jf.activations.softmax)

    def call(self, inputs, training=False):
        x = self.conv1(inputs, training=training)
        x = self.pool1(x)
        x = self.conv2(x, training=training)
        x = self.pool2(x)
        x = self.flatten(x)
        x = self.dense1(x, training=training)
        return self.outputs(x, training=training)

2. Sequential API with .add()

model = jf.models.Model()
model.add(jf.layers.Conv2D(32, (3, 3), activation=jf.activations.relu))
model.add(jf.layers.MaxPooling2D((2, 2)))
model.add(jf.layers.Conv2D(64, (3, 3), activation=jf.activations.relu))
model.add(jf.layers.MaxPooling2D((2, 2)))
model.add(jf.layers.GlobalAveragePooling2D())
model.add(jf.layers.Dense(64, activation=jf.activations.relu))
model.add(jf.layers.Dense(10, activation=jf.activations.softmax))

model.build(input_shape=(None, 28, 28, 1))
model.compile(optimizer=jf.optimizers.Adam(0.001), loss_fn=jf.losses.SparseCategoricalCrossentropy())
model.fit(x_train, y_train, epochs=5, batch_size=64, validation_split=0.1)

📖 Documentation

Full documentation and API reference available:


🗂️ Project Structure

jaxflow/
├── activations/       # ReLU, GELU, Swish, etc.
├── callbacks/         # EarlyStopping, Logger, Checkpointing
├── core/              # Base module, scopes, tree utilities
├── gradient/          # JAX custom grad support
├── initializers/      # Glorot, He, Zeros, ...
├── layers/            # Dense, Conv2D, Embedding, ...
├── losses/            # CrossEntropy, MSE, ...
├── metrics/           # Accuracy, F1, Precision, ...
├── models/            # Sequential, Transformer, ResNet
├── optimizers/        # Optax integrations
└── regularizers/      # L1, L2, Dropout

🔮 What’s Next

Planned additions to JAXFlow:

  • ☑️ Transformer layer with attention support
  • ☑️ Full callback system with exportable training logs
  • ☑️ Model persistence and loading with Orbax
  • ☑️ Classical ML algorithms: SVM, KNN, Logistic Regression

📄 License

JAXFlow is licensed under the Apache-2.0 License.

💖 Built with care for the JAX community. Keep your models clean, fast, and functional—with JAXFlow.

jaxflow, jax deep learning, jax neural network library, jax model framework, python deep learning, neural network in jax, jaxflow documentation, jaxflow github, functional deep learning, modular jax library

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jaxflow-0.1.5.dev0.tar.gz (67.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaxflow-0.1.5.dev0-py3-none-any.whl (92.4 kB view details)

Uploaded Python 3

File details

Details for the file jaxflow-0.1.5.dev0.tar.gz.

File metadata

  • Download URL: jaxflow-0.1.5.dev0.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jaxflow-0.1.5.dev0.tar.gz
Algorithm Hash digest
SHA256 a624c5e25aad15d3edb7bcbaa3431d67e729966d4210379c1b1e94a9411f41bd
MD5 f6744d250f784618ea24b0b7fc89c45f
BLAKE2b-256 28d85483de0b5c933c093c51e3e481453ffcf6854a63aa587097b16c0c72f90c

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxflow-0.1.5.dev0.tar.gz:

Publisher: python-publish.yml on mthd98/JAXFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jaxflow-0.1.5.dev0-py3-none-any.whl.

File metadata

  • Download URL: jaxflow-0.1.5.dev0-py3-none-any.whl
  • Upload date:
  • Size: 92.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jaxflow-0.1.5.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c0a90e92bd4865b312ff9b455161bcb76258e6fe2f283031f17c01087c41c4e
MD5 0a616cc2c73c09a29718d0f8c246dc75
BLAKE2b-256 5454ebea6a892a87bfb3051df11e2d2ba447276132216db34d7df74c0c333000

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxflow-0.1.5.dev0-py3-none-any.whl:

Publisher: python-publish.yml on mthd98/JAXFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page