Nabla is a Python library that provides three key features:
- Multidimensional Array computation (like NumPy) with strong GPU acceleration
- Composable Function Transformations:
vmap
,grad
,jit
, and other Automatic Differentiation tools - Deep integration with MAX and (custom) Mojo kernels
For tutorials and API reference, visit: nablaml.com
Now available on PyPI!
pip install nabla-ml
import nabla as nb
# Example function using Nabla's array operations
def foo(input):
return nb.sum(input * input, axes=0)
# Vectorize, differentiate, accelerate
foo_grads = nb.jit(nb.vmap(nb.grad(foo)))
gradients = foo_grads(nb.randn((10, 5)))
This guide is for contributors or for reproducing the validation and benchmark results presented in the thesis.
First, clone the repository and set up a virtual environment with all necessary dependencies.
# Clone the repository
git clone https://github.com/nabla-ml/nabla.git
cd nabla
# Create and activate a virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate
# Install all core and development dependencies
pip install -r requirements-dev.txt
This runs the full test suite to verify Nabla's correctness against JAX.
# Navigate to the unit test directory from the project root
cd nabla/tests/unit
# Execute the unified test script
python unified.py all -all-configs
This script reproduces the performance benchmarks for Nabla, JAX, and PyTorch.
# Navigate to the benchmark directory
cd nabla/tests/benchmarks
# Run the benchmark script
python benchmark.py
nabla/
├── nabla/ # Core Python library
│ ├── core/ # Array 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
└── experimental/ # Core (pure) Mojo library (WIP!)
Contributions welcome! Discuss significant changes in Issues first. Submit PRs for bugs, docs, and smaller features.
Nabla is licensed under the Apache-2.0 license.
Thank you for checking out Nabla!