Jabara
English / 日本語
Jabara compresses training checkpoints: model weights and optimizer state. Lossless compression, deltas against an earlier checkpoint, and quantization all sit behind one codec interface. By default Jabara restores every tensor bit for bit, every read checks a CRC-32, and an archive gets a lossy codec only when you opt in.

Who it is for
Jabara is for checkpoints that you keep and read back later: the checkpoints of seed and hyperparameter sweeps, intermediate checkpoints kept for analysis, and runs that resume after an interruption or that someone else resumes. Saves and loads take longer than without Jabara, and a framework cannot memory-map an archive, so it is not a format to serve a model from. Who Jabara is for gives the measured sizes and costs, and Compress the checkpoints of many runs shows the commands for a finished sweep. Jabara and general-purpose archivers compares it with tar, zip, gzip, and zstd.
What you can do
- Take many file formats through one registry.
jabara compress reads safetensors, torch.save files (without unpickling them), NumPy, GGUF, Keras and HDF5, ONNX, TensorFlow and MindSpore checkpoints, Core ML weight files, and Flax msgpack files, and a lossless archive restores each file byte for byte. A new format is one CheckpointFormat subclass plus the code that finds the tensor bytes in the file, and the built-in format modules are 86 to 290 lines each (Checkpoint file formats).
- Split an archive by size or by count, and join it back.
--part-size 2GB or --parts 4 cuts each archive, and jabara split and jabara join change an archive that exists without encoding it again (Split an archive into parts and join it back).
- Handle a whole run.
--recursive takes every checkpoint directory of a run, and compress --dry-run lists what it would do before it changes anything (Compress the checkpoints of many runs).
- Store deltas.
--delta first codes each later checkpoint against the first one and --delta previous against the one before it, which saves only a few points more and restores slower. --base takes a directory too, and jabara.hf.attach(trainer, delta="first") saves deltas from a Trainer (Delta checkpoints).
- Read options from a file.
--config FILE takes JSON, YAML, or TOML, and --show-config prints the settings without running the command (Run from a config file).
- Find your way in the command.
-h and -H print the short and the full help, jabara man COMMAND shows the manual page, and jabara codecs --long lists each codec with the works it builds on (Command-line reference).
- Hand it to an agent. The repository ships an agent skill for Claude Code, Codex CLI, GitHub Copilot CLI, Cursor, and Gemini CLI, an
AGENTS.md, and a test of the command's contract (Use Jabara from an AI agent).
Install
Jabara needs Python 3.10 or newer. Install it from PyPI into a virtual environment:
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install "jabara[torch]"
In a uv project, run uv add "jabara[torch]" instead.
The extras are torch (PyTorch state, and the tensor names and roles of .pt files), hf (the Hugging Face Trainer adapter), lightning (the PyTorch Lightning plugin), zipnn (the zipnn/1 codec), yaml (YAML config files), and hdf5 (HDF5 and Keras files). See Installation.
Quickstart
Compress a checkpoint directory, check it, and restore it. compress replaces each *.safetensors file and optimizer.pt with a verified .jbr archive and leaves the other files alone. It also takes the files that Accelerate, PyTorch Lightning, DeepSpeed, and Megatron-LM write with torch.save, without unpickling them, TensorFlow data shards, MindSpore .ckpt files, and a Flax model's flax_model.msgpack, and, when you name the file, NumPy .npy and .npz, GGUF, Keras .keras and HDF5 files, ONNX models and their external data, Core ML weight.bin files, and any Flax .msgpack file. Each format is one class in a registry, and a lossless archive restores the file byte for byte (see Checkpoint file formats).
$ jabara compress checkpoint-1000
checkpoint-1000/model.safetensors.jbr: ... -> ... bytes (...% of original)
checkpoint-1000/optimizer.pt.jbr: ... -> ... bytes (...% of original)
$ jabara verify checkpoint-1000
ok checkpoint-1000/model.safetensors.jbr
ok checkpoint-1000/optimizer.pt.jbr
$ jabara decompress checkpoint-1000
checkpoint-1000/model.safetensors
checkpoint-1000/optimizer.pt
Save and load a PyTorch state from Python:
import torch
from jabara.torch import load_state, save_state
model = torch.nn.Linear(16, 16)
optimizer = torch.optim.AdamW(model.parameters())
model(torch.randn(4, 16)).sum().backward()
optimizer.step()
save_state(optimizer.state_dict(), "optimizer.jbr")
optimizer.load_state_dict(load_state("optimizer.jbr"))
The tutorial explains both examples. Every command that has options also reads them from a JSON, YAML, or TOML file with --config FILE; see Run from a config file.
An archive can also be written as several files, parts of at most a given size (jabara compress --part-size 2GiB) or a given number of parts (--parts 4). Every command reads the parts as one archive, and jabara join gives back the archive byte for byte; see Split an archive into parts and join it back.
Codecs
| Codec |
Type |
Needs a base |
bytegroup-zstd/1 |
lossless |
no |
quant8-linear/1 |
lossy |
no |
quant8-log/1 |
lossy |
no |
raw/1 |
lossless |
no |
sub-delta/1 |
lossless |
yes |
xor-delta/1 |
lossless |
yes |
zipnn/1 |
lossless |
no |
zstd/1 |
lossless |
no |
A codec that needs a base stores each tensor as its difference from the same tensor in an earlier archive. The codec reference gives the dtypes, the parameters, and the error bounds of the lossy codecs.
Extend Jabara
To extend Jabara, subclass one of these abstract base classes. You change no other code. Each example is a complete script, and a test runs all of them.
Documentation
Read the documentation on the published site. GitHub shows its MyST sources as raw text.
To build the site from the clone, run uv run --group docs sphinx-build -W --keep-going -b html docs docs/_build/html and open docs/_build/html/index.html. docs/README.md gives the Japanese build and explains how the sources are tested.
To work on Jabara, run uv sync in the clone to install the locked dev group, then uv run tox to run the tests, ruff, and mypy.
License
MIT. See LICENSE.