A lightweight machine learning package for computational mechanics.
Project description
A lightweight machine learning package for computational mechanics built on JAX.
Check out the Documentation for examples and reference material.
What is Klax?
Klax provides specialized machine learning architectures, constraints, and training utilities for mechanics and physics applications. Built on top of JAX, Equinox, and Optax, it offers:
- Special Neural Networks: Implementations of, e.g., Input Convex Neural Networks (ICNNs), matrix-valued neural networks, MLPs with custom initialization, and more.
- JAX Compatibility: Seamless integration with JAX's automatic differentiation and acceleration.
- Parameter Constraints: Differentiable and non-differentiable parameter constraints through
klax.Unwrappableandklax.Constraint - Customizable Training: Methods and APIs for customized calibrations on arbitrary PyTree data structures through
klax.fit,klax.Loss, andklax.Callback.
Klax is designed to be minimally intrusive - all models inherit directly from equinox.Module without additional abstraction layers. This ensures full compatibility with the JAX/Equinox ecosystem.
The constraint system is derived from Paramax's paramax.AbstractUnwrappable, extending it to support non-differentiable/zero-gradient parameter constraints such as ReLU-based non-negativity constraints.
The provided calibration utilities (klax.fit, klax.Loss, klax.Callback) are designed to operate on arbitrarily shaped PyTrees of data, fully utilizing the flexibility of JAX and Equinox. While they cover most common machine learning use cases, as well as our specialized requirements, they remain entirely optional. The core building blocks of Klax work seamlessly in custom training loops.
Currently Klax's training utilities are built around Optax, but different optimization libraries could be supported in the future if desired.
If you like using Klax, feel free to leave a GitHub star, and if there is a machine learning architecture that you think should be included in Klax, please consider making a PR.
Installation
Klax requires python 3.12+.
pip install klax
or get the most recent changes from the main branch via
pip install "klax @ git+https://github.com/Drenderer/klax.git@main"
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 klax-0.1.4.tar.gz.
File metadata
- Download URL: klax-0.1.4.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
115b04cfb8f113ef6af70f3bcaef6e2eb75a5cb11e8aacf15e097d57591042f9
|
|
| MD5 |
68eb794e6668fdd7bcd68db66e443512
|
|
| BLAKE2b-256 |
8652231bb691a600315244cc08a691e682841c46dabcf60362a3920bb626c528
|
File details
Details for the file klax-0.1.4-py3-none-any.whl.
File metadata
- Download URL: klax-0.1.4-py3-none-any.whl
- Upload date:
- Size: 43.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32c7c971f356180ce174327073b501c7d8ecde8cd6e385bdf68ec916ae2b29a5
|
|
| MD5 |
da4ea2f4bc9c7a8e375862da25916fe9
|
|
| BLAKE2b-256 |
99d3d1660935b95bf64153577d2f0d439d1bebc36023701ff7423b12dbacea1d
|