Skip to main content

alt text

Nabla is a Machine Learning library for the emerging Mojo/Python ecosystem, featuring:

  • Gradient computation the PyTorch way (imperatively via .backward())
  • Purely-functional, JAX-like composable function transformations: grad, vmap, jit, etc.
  • Custom differentiable CPU/GPU kernels

For tutorials and API reference, visit: nablaml.com

Installation

pip install nabla-ml

Quick Start

The most simple, but fully functional Neural Network training setup:

import nabla as nb

# Defines MLP forward pass and loss.
def loss_fn(params, x, y):
    for i in range(0, len(params) - 2, 2):
        x = nb.relu(x @ params[i] + params[i + 1])
    predictions = x @ params[-2] + params[-1]
    return nb.mean((predictions - y) ** 2)

# JIT-compiled training step via SGD
@nb.jit(auto_device=True)
def train_step(params, x, y, lr):
    loss, grads = nb.value_and_grad(loss_fn)(params, x, y)
    return loss, [p - g * lr for p, g in zip(params, grads)]

# Setup network (hyper)parameters.
LAYERS = [1, 32, 64, 32, 1]
params = [p for i in range(len(LAYERS) - 1) for p in (nb.glorot_uniform((LAYERS[i], LAYERS[i + 1])), nb.zeros((1, LAYERS[i + 1])),)]

# Run training loop.
x, y = nb.rand((256, 1)), nb.rand((256, 1))
for i in range(1001):
    loss, params = train_step(params, x, y, 0.01)
    if i % 100 == 0: print(i, loss.to_numpy())

For Developers

  1. Clone the repository
  2. Create a virtual environment (recommended)
  3. Install dependencies
git clone https://github.com/nabla-ml/nabla.git
cd nabla

python3 -m venv venv
source venv/bin/activate

pip install -r requirements-dev.txt
pip install -e ".[dev]"

Repository Structure

nabla/
├── nabla/                     # Core Python library
│   ├── core/                  # Tensor class and MAX compiler integration
│   ├── nn/                    # Neural network modules and models
│   ├── ops/                   # Mathematical operations (binary, unary, linalg, etc.)
│   ├── transforms/            # Function transformations (vmap, grad, jit, etc.)
│   └── utils/                 # Utilities (formatting, types, MAX-interop, etc.)
├── tests/                     # Comprehensive test suite
├── tutorials/                 # Notebooks on Nabla usage for ML tasks
└── examples/                  # Example scripts for common use cases

Contributing

Contributions welcome! Discuss significant changes in Issues first. Submit PRs for bugs, docs, and smaller features.

License

Nabla is licensed under the Apache-2.0 license.


Thank you for checking out Nabla!

Development Status PyPI version Python 3.12+ License: Apache 2.0

Metadata

Release files for nabla-ml 25.10191431

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

Source distribution (sdist)

Source distribution for nabla-ml 25.10191431
File Size Uploaded Provenance Actions
nabla_ml-25.10191431.tar.gz 104.5 kB Without provenance Details for nabla_ml-25.10191431.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nabla-ml 25.10191431
File Interpreter ABI Platform Actions
nabla_ml-25.10191431-py3-none-any.whl Python 3 none any Details for nabla_ml-25.10191431-py3-none-any.whl

Total release size: 239.4 kB

Release files / nabla_ml-25.10191431.tar.gz

Download URL nabla_ml-25.10191431.tar.gz
Size 104.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d5ef96818822e1d9611a2449ecd33617f5e8f23545aefeada4e10460ff4505ab
BLAKE2b-256 checksum
How to use checksums
e9ff3282d74a8b871689a152a38cb9d6ac62eae9cecfa89302bf8bf805cb9fc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

Release files / nabla_ml-25.10191431-py3-none-any.whl

Download URL nabla_ml-25.10191431-py3-none-any.whl
Size 134.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d9ae0ef1bb8460bd03b304e5d4df5ebcc2013a55011c45f5c1e464c0bc02a1b
BLAKE2b-256 checksum
How to use checksums
2001e5f2d7a44125fdafe7d8cebf94e8e008aa65894d77d4c677b22ca9e4b875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

Security for nabla-ml 25.10191431

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