Skip to main content

Taktiny

A neural networks library for JAX. Build models from Python modules, pass them through JAX transformations, and use the data and training tools that fit your project.

Taktiny is experimental; APIs may change.

Installation · Quickstart · Guides · API reference

Install

Taktiny requires Python 3.12 or newer. Install the PyPI release with uv or pip:

uv add taktiny
# or
pip install taktiny

The default installation uses JAX on CPU. For accelerator extras and source installs, see the installation guide. The master branch is the more-stable source branch; experiment has newer, less-tested changes.

Build and train a model

Modules own their parameters and are JAX PyTrees. Pass a model and optimizer through a compiled training step just as you would pass arrays:

import jax
import jax.numpy as jnp
import optax

from taktiny import nn
from taktiny.takt import Optimizer


class MLP(nn.Module):
    def __init__(self, *, rngs: nn.Rngs):
        self.hidden = nn.Linear(8, 32, rngs=rngs)
        self.output = nn.Linear(32, 1, rngs=rngs)

    def __call__(self, x):
        return self.output(jax.nn.silu(self.hidden(x)))


model = MLP(rngs=nn.Rngs(0))
optimizer = Optimizer(model, optax.adam(1e-2))


@jax.jit
def train_step(model, optimizer, x, y):
    def loss_fn(model):
        return jnp.mean((model(x) - y) ** 2)

    loss, grads = jax.value_and_grad(loss_fn)(model)
    model = optimizer.update(model, grads)
    return model, optimizer, loss


x = jax.random.normal(jax.random.key(1), (32, 8))
y = jnp.sum(x, axis=-1, keepdims=True)

for _ in range(20):
    model, optimizer, loss = train_step(model, optimizer, x, y)

print(loss)

Optimizer(include=[r"hidden\..*"]) selects parameters by full regex match when you want to update only part of a model. The quickstart continues with data loading, evaluation, and inference.

Work with weights

Use dotted paths to obtain or load a subset of parameters:

hidden_state = model.flat_state_dict(include=[r"hidden\..*"])

restored = MLP(rngs=nn.Rngs(2))
restored.load_flat_state_dict(hidden_state, include=[r"hidden\..*"])

state_dict() and load_state_dict() offer the same include filter with a nested dictionary. All four methods accept None for the full state or [] for no parameters. See the checkpoint guide for saving to disk and restoring sharded weights.

Explore

  • Layers and modules: linear and convolutional layers, embeddings, normalization, recurrent layers, attention, and more. Linear and convolutional layers support structured feature dimensions.
  • Data: Grain-backed loading, transforms, batching, and packing for caller-provided records.
  • Sharding: logical axis names and JAX mesh placement.
  • Quantization: Qwix-backed quantization utilities and operations.
  • Trainer: an experimental configurable training loop with evaluation, callbacks, accumulation, and Orbax checkpoints.
  • PEFT: low-rank layers and an experimental adapter framework.

Development

uv sync --frozen --group dev
JAX_PLATFORMS=cpu make test-fast

The code lives in src/taktiny/, with tests in tests/. Taktiny is licensed under Apache 2.0.

Metadata

Release files for taktiny 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taktiny 0.0.1
File Size Uploaded
taktiny-0.0.1.tar.gz 790.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taktiny 0.0.1
File Interpreter ABI Platform
taktiny-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 975.2 kB

Release files / taktiny-0.0.1.tar.gz

Download URL taktiny-0.0.1.tar.gz
Size 790.4 kB
Tags Source
SHA-256 checksum
How to use checksums
220a58b5051b0c8793ed583ded4c22e74aa557d1b924728d969150a81050683d
BLAKE2b-256 checksum
How to use checksums
03ee7498673d2c732ed2a9e822671616219b1f235f3ce38f0cfc89b05316a5f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / taktiny-0.0.1-py3-none-any.whl

Download URL taktiny-0.0.1-py3-none-any.whl
Size 184.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42cace5baad0ce3ca65ebfad9443916d026db03f76b1508aab94748998dfa32f
BLAKE2b-256 checksum
How to use checksums
d9345b505a0b640dd56a654adafd538a42e934fbf5fa306b25c32e4449ef21a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page