A library for autoscaling JAX models.
Project description
Parallax
Parallax is a library for automatically scaling JAX models. It simplifies the process of training large models by offering automatic parallelism strategies and memory optimizations, allowing you to focus on your model architecture rather than sharding configurations.
Parallax helps you:
- Automatically shard your JAX models and functions without manually
defining
PartitionSpecs. - Apply advanced parallelism strategies like Fully Sharded Data Parallel (FSDP) and Distributed Data Parallel (DDP) with ease.
- Optimize memory usage through model offloading (keeping weights in CPU RAM) and rematerialization.
With Parallax, you can scale off-the-shelf JAX models to run on larger hardware configurations or fit larger models on existing hardware without extensive code modifications.
This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.
Installation
You can install Parallax using pip:
pip install google-parallax
Usage
Parallax integrates seamlessly with Flax NNX models. Here is a simple example of how to use auto-sharding:
import parallax
from flax import nnx
import jax
import jax.numpy as jnp
model = parallax.create_sharded_model(
model_or_fn=lambda: Model(...),
sample_inputs=(jnp.ones((1, 32)),),
strategy=parallax.ShardingStrategy.AUTO,
data_axis_name='fsdp',
model_axis_name='tp',
)
Features
- AutoSharding: Automatically discover optimal sharding strategies.
- FSDP & DDP: Ready-to-use implementations of common parallel training strategies.
- Model Offloading: Stream model weights from CPU to device memory to train larger models.
- Rematerialization: Automatic activation recomputation to save memory.
Contributing
We welcome contributions! Please check
docs/contributing.md for details on how to submit
pull requests and report bugs.
Support
If you encounter any issues, please report them on our GitHub Issues page.
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 google_parallax-0.0.1.tar.gz.
File metadata
- Download URL: google_parallax-0.0.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4830fb9a132421a162637cc1ee29f99767292b5d0037fbfd7c3aabc84c911ef6
|
|
| MD5 |
7cd8bda2464df0a4bfce3ad6525057ca
|
|
| BLAKE2b-256 |
0dccf63a97966fc493fb9d8ba8c4276e269a7d2d9f2869abff13a611c8561136
|
File details
Details for the file google_parallax-0.0.1-py3-none-any.whl.
File metadata
- Download URL: google_parallax-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3194dc635c2529ecf1e1ec11552193226bcf1cc02bed7604c8918ee05390db37
|
|
| MD5 |
4094cb3ab7e2904ae38f1378aed68c6c
|
|
| BLAKE2b-256 |
d3d3b9518435c6b74b02c23ab955f0dd9f7c8c1aa103efb743f09d91b5d6b2fc
|