Skip to main content

A lightweight machine learning package for computational mechanics.

Project description

logo

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: MLPs with customizable initialization, fully and partially input convex neural networks (ICNNs), matrix-valued neural networks, e.g., skew symmetric matrices, and more.
  • Parameter constraints: Differentiable and non-differentiable parameter constraints, e.g., non-negativity and symmetry constraints.
  • Highly customizable training and logging utlities: Methods for calibrating abitrary trainable PyTrees with custom loss functions, callbacks, and metrics logging.
  • Full JAX compatibility: Seamless integration with JAX's automatic differentiation and acceleration

Klax is build around the highly successfull JAX, Equinox, and Optax projects and designed to be minimally intrusive. All models inherit directly from equinox.Module without additional abstraction layers, ensuring full compatibility with the 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 training utilities (klax.fit, klax.Loss, klax.Callback) are designed to operate on arbitrarily shaped model and data PyTrees, 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 meachine learning architectures implemented in Klax work seamlessly in any JAX-compatible training loop.

Currently Klax's training utilities are built around Optax, but different optimization libraries could be supported in the future if desired.

Support us!

If you like using Klax, feel free to leave a GitHub star, and if there is a machine learning architecture or anything else that you think should be included in Klax, please consider opening a PR.

Installation

Klax can be installed via pip using

pip install klax

If you want to add the latest release to your Python uv project run

uv add klax

or directly install the main branch via

uv add "klax @ git+https://github.com/Drenderer/klax.git@main"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

klax-0.2.0.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

klax-0.2.0-py3-none-any.whl (54.0 kB view details)

Uploaded Python 3

File details

Details for the file klax-0.2.0.tar.gz.

File metadata

  • Download URL: klax-0.2.0.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"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

Hashes for klax-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5ac818c6fdd44edd78672473c4460df1c7d277b64885e72783c9defc51f39752
MD5 b4c08442d7a1c20aa224e4e0d769bdaa
BLAKE2b-256 9dfd828b71861585e47931901ace6432eacd7feebfd054df022d64979e47ca65

See more details on using hashes here.

File details

Details for the file klax-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: klax-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"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

Hashes for klax-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 146306d0fbe9a1f3f48a9b05c9964d5a461fab2eb2c08d3cc86eaf25d69ee171
MD5 dbca897b58afb2a0e9a8041905d5753c
BLAKE2b-256 a9992d489b4a9d14ad5da989d8873eede0cb3d5f93582022ac75d831a70a561a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page