Substrax
Shared training and hardware infrastructure for the Avitai JAX stack.
Research preview. Substrax is under rapid iteration and the API will change while the sibling packages migrate onto it. Pin a version.
Substrax is the bottom of the Avitai dependency chain:
substrax → calibrax → datarax → artifex → opifex
It holds the code those packages used to carry separately, so that each concern has one home and one test suite:
| Subpackage | What it owns |
|---|---|
substrax.devices |
Device information and device placement, including the batch-size recommendation table |
substrax.mesh |
Device meshes on jax.make_mesh, mesh rules and partition-spec helpers, sharding strategies on flax.nnx.spmd |
substrax.spmd |
Data-parallel placement, spmd_train_step, gradient reduction and collectives on the flat-state path |
substrax.checkpoint |
One CheckpointStore protocol and one Orbax implementation over CheckpointManager |
substrax.callbacks |
The training-callback protocol, BestMetricTracker, EarlyStopping |
substrax.tracking |
Step-wise experiment tracking with console, CSV, Weights & Biases and MLflow backends |
Not in Substrax: optimizers and schedules (optax), loss scaling and gradient accumulation
(flax.training.dynamic_scale.DynamicScale, optax.MultiSteps), profiling and hardware
spec tables (calibrax), data pipelines (datarax), models and trainers (artifex, opifex).
Installation
uv add substrax # or: pip install substrax
Substrax requires Python 3.12 or later, jax>=0.11.1, flax>=0.12.9 and
orbax-checkpoint>=0.11.33.
Development setup
git clone https://github.com/avitai/substrax.git
cd substrax
./setup.sh
source ./activate.sh
setup.sh creates the environment with uv, syncs the dev and test extras plus the
backend extra for this machine, and writes the managed environment file .substrax.env
that activate.sh loads. A user-owned .env is never modified.
| Flag | Effect |
|---|---|
--backend <auto|cpu|cuda12|metal> |
Choose the backend policy; auto resolves to cuda12 on Linux with a visible NVIDIA GPU, metal on Apple Silicon, otherwise cpu |
--python <version> |
Create the environment with a specific Python version |
--extra <name> |
Sync an additional extra (repeatable), e.g. --extra docs |
--recreate |
Remove the existing .venv before syncing |
--force-clean |
Remove .venv, .substrax.env and repo-local test artifacts |
--dry-run |
Print the resolved backend and the uv commands without changing files |
Run the checks the way CI does:
uv run --locked pytest
uv run --locked pre-commit run --all-files
uv run --locked mkdocs build --strict --clean
Documentation
https://substrax.readthedocs.io
Contributing
See CONTRIBUTING.md. Security reports go to the address in SECURITY.md, not to a public issue.
License
MIT — see LICENSE.
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 substrax-0.1.1.tar.gz.
File metadata
- Download URL: substrax-0.1.1.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff1ab8b3c70b9fd3d34ee57ebc92d056215a4116660e6c627d98652cc3a8eb44
|
|
| MD5 |
3619373ffef75fce654080d8fb6f01df
|
|
| BLAKE2b-256 |
48fcccae4760d551708bff4d6ee893121d5ddbf8a77d67c8beaca1a9aa18773e
|
Provenance
The following attestation bundles were made for substrax-0.1.1.tar.gz:
Publisher:
publish.yml on avitai/substrax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
substrax-0.1.1.tar.gz -
Subject digest:
ff1ab8b3c70b9fd3d34ee57ebc92d056215a4116660e6c627d98652cc3a8eb44 - Sigstore transparency entry: 2763718490
- Sigstore integration time:
-
Permalink:
avitai/substrax@7e9ecdf250e503f401966ed4c6a91664d1285969 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/avitai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e9ecdf250e503f401966ed4c6a91664d1285969 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file substrax-0.1.1-py3-none-any.whl.
File metadata
- Download URL: substrax-0.1.1-py3-none-any.whl
- Upload date:
- Size: 45.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44b8ae712ea19e61c6e41164606e7ca6732288439de961cf0b56d2e2ed8bc4f0
|
|
| MD5 |
9bc7402c88d7c71ddb8708b25f3350f9
|
|
| BLAKE2b-256 |
db7b578b9d3bc27ccd95cfd315d1cac72a4cfbe2279204d0c85bc362139ffea0
|
Provenance
The following attestation bundles were made for substrax-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on avitai/substrax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
substrax-0.1.1-py3-none-any.whl -
Subject digest:
44b8ae712ea19e61c6e41164606e7ca6732288439de961cf0b56d2e2ed8bc4f0 - Sigstore transparency entry: 2763718501
- Sigstore integration time:
-
Permalink:
avitai/substrax@7e9ecdf250e503f401966ed4c6a91664d1285969 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/avitai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e9ecdf250e503f401966ed4c6a91664d1285969 -
Trigger Event:
workflow_dispatch
-
Statement type: