Command line¶
The jabara command compresses, restores, lists, verifies, and compares checkpoints. PATH is a checkpoint file or directory. The command sections below are generated from the argument parser.
Commands¶
jabara compress¶
jabara compress [-h] [--threads N] [--base BASE] [--recursive] [--keep] [--dry-run] [--delta MODE] [--config FILE] [--show-config] PATH
Compress a checkpoint file, or the files it recognises in a checkpoint directory.
With --base BASE (an archive of an earlier checkpoint, or the directory of one), float tensors are stored as differences from the tensors of the same name in it. With --recursive, PATH holds several checkpoint directories (checkpoint-100, checkpoint-200, ...): each is compressed in turn as a directory is, the first failure stops the run, --delta first codes every checkpoint but the first against the first, and --delta previous codes each against the one before it, a chain that restores in order. --dry-run lists what would be compressed and changes nothing.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
a file, a checkpoint directory, or with --recursive their parent [path] |
|
worker threads (default: up to 8) [positive integer] |
|
an archive of an earlier checkpoint, or its directory [path] |
|
take every checkpoint directory in PATH, one level down (also --recursive=true or --recursive=false) |
|
keep the input files (also --keep=true or --keep=false) |
|
print what would be compressed, with its size on disk, and change nothing (also --dry-run=true or --dry-run=false) |
|
with --recursive: first or previous, the checkpoint each one is coded against |
|
read options from a .json, .yaml, .yml, or .toml file [path] |
|
print the settings to be used, as JSON, and exit |
jabara decompress¶
jabara decompress [-h] [--threads N] [--base BASE] [--recursive] [--keep] [--config FILE] [--show-config] PATH
Restore the original file from an archive, or every archive in a directory.
An archive written with --base needs the same --base BASE here. With --recursive, PATH holds several checkpoint directories: each is restored in turn as a directory is, dependants of another checkpoint's archives first, and the first failure stops the run. Without --keep, a checkpoint whose archives a sibling checkpoint still needs as its base is not restored before that sibling.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
an archive, a checkpoint directory, or with --recursive their parent [path] |
|
worker threads (default: up to 8) [positive integer] |
|
an archive of an earlier checkpoint, or its directory [path] |
|
take every checkpoint directory in PATH, one level down (also --recursive=true or --recursive=false) |
|
keep the input files (also --keep=true or --keep=false) |
|
read options from a .json, .yaml, .yml, or .toml file [path] |
|
print the settings to be used, as JSON, and exit |
jabara ls¶
jabara ls [-h] [--json] [--recursive] [--config FILE] [--show-config] PATH
List the tensors of an archive, or of every archive in a directory. A directory without one is an error.
With --recursive, PATH holds several checkpoint directories, and the archives of each are listed.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
an archive or a directory, or with --recursive their parent [path] |
|
print JSON (also --json=true or --json=false) |
|
take every checkpoint directory in PATH, one level down (also --recursive=true or --recursive=false) |
|
read options from a .json, .yaml, .yml, or .toml file [path] |
|
print the settings to be used, as JSON, and exit |
jabara verify¶
jabara verify [-h] [--threads N] [--base BASE] [--recursive] [--config FILE] [--show-config] PATH
Decode every chunk of an archive, or of every archive in a directory, and check its checksum.
A directory without an archive is an error. A delta archive needs --base BASE, as for decompress. With --recursive, PATH holds several checkpoint directories: every archive of each is checked, a delta archive against the archives of the other checkpoints that it names, and a failure does not stop the others.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
an archive or a directory, or with --recursive their parent [path] |
|
worker threads (default: up to 8) [positive integer] |
|
the base archive of a delta archive, or its directory [path] |
|
take every checkpoint directory in PATH, one level down (also --recursive=true or --recursive=false) |
|
read options from a .json, .yaml, .yml, or .toml file [path] |
|
print the settings to be used, as JSON, and exit |
jabara export-weights¶
jabara export-weights [-h] [--config FILE] [--show-config] ARCHIVE OUT
Write the weight tensors of ARCHIVE as a safetensors file.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
[path] |
|
the safetensors file to write; must not exist [path] |
|
read options from a .json, .yaml, .yml, or .toml file [path] |
|
print the settings to be used, as JSON, and exit |
jabara bench¶
jabara bench [-h] [--json] [--base BASE] [--repeats N] [--threads N] [--candidates a,b,c] [--config FILE] [--show-config] PATH
Compare codecs in memory on the tensors of PATH: an archive, a safetensors or torch file, or a directory.
Default candidates are the lossless codecs that need no base; with --base (a path of the same kinds) the delta codecs join them. --candidates a,b,c names codecs instead, lossy ones included. It takes no --recursive: it holds every tensor in memory, and a parent of several checkpoints would multiply that.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
an archive, a safetensors or torch file, or a directory [path] |
|
print the report as JSON (also --json=true or --json=false) |
|
the base tensors, a path of the same kinds [path] |
|
timed runs per codec [positive integer, default 3] |
|
worker threads (default: up to 8) [positive integer] |
|
the codecs to compare instead of the default ones [codec ids, comma-separated] |
|
read options from a .json, .yaml, .yml, or .toml file [path] |
|
print the settings to be used, as JSON, and exit |
jabara codecs¶
jabara codecs [-h] [--long] [--json] [--config FILE] [--show-config] [ID]
List the registered codecs: their ids, or with --long, --json or an ID what each is and builds on.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
show everything about this codec |
|
show each codec's properties and references (also --long=true or --long=false) |
|
print JSON: a list of codecs, or one codec for an ID (also --json=true or --json=false) |
|
read options from a .json, .yaml, .yml, or .toml file [path] |
|
print the settings to be used, as JSON, and exit |
jabara help¶
jabara help [-h] [COMMAND]
Print the full help of jabara or of a command.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
a command; jabara itself without it [command name] |
jabara man¶
jabara man [-h] [COMMAND]
Show the manual page of jabara or of a command.
Argument |
Description |
|---|---|
|
print the short (-h) or the full help and exit |
|
a command; jabara itself without it [command name] |
Files and directories¶
compresson a file takes*.safetensors,*.pt,*.pth,*.bin,*.ckpt,*.npy,*.npz,*.gguf,*.h5,*.hdf5, and*.keras, and writes<name>.jbrnext to it. On a directory it takes the regular files named*.safetensors,optimizer.pt,optimizer.bin,pytorch_model*.bin,*.ckpt,mp_rank_*_model_states.pt,*_optim_states.pt, ormodel_optim_rng.pt, not recursively, and leaves every other file alone. Checkpoint file formats lists the frameworks that write these files.decompresswrites each file back byte for byte when its archive is lossless. The files of a sharded model, such asmodel-00001-of-00002.safetensors, get one archive each, andmodel.safetensors.index.jsonstays. A directory with none of them is an error.decompresson a file takes*.jbrand writes the name without the suffix. It refuses to write over a file that exists. On a directory it restores every*.jbrfile.Before they change anything,
compressanddecompressrefuse a file that sits next to its own archive (model.safetensorsbesidemodel.safetensors.jbr). Remove one of the two first.On a directory,
compressanddecompressare all or nothing. They write and verify every output first, then delete the inputs unless you pass--keep. If one file fails, they delete the outputs that they wrote, and every input stays in place.lsandverifytake an archive or a directory. On a directory they read its*.jbrfiles, and a directory with no archive is an error.For
compress,decompress, andverify,--basenames an archive of an earlier checkpoint, or the directory of that checkpoint, for a file and for a directory alike. With a directory, each tensor is coded against the tensor of the same name in any of its archives, and the directory must hold no checkpoint file without its archive. An archive written withcompress --baseneeds a--basethat holds its base archives fordecompressandverify. Forbench,--baseis a path of any kind thatbenchreads.export-weightswrites the tensors with the roleweightto a safetensors file.For an archive of a safetensors file, every tensor has that role, and the output is the original file, byte for byte.
For any other archive, the output holds the tensors with the role
weightand leaves the rest out. An archive made withsave_stateandWeightsSchemahas only such tensors.compressgives the tensors of a torch file the optimizer roles by their path, so the tensors of a modelstate_dictget the roleother.export-weightsrefuses that archive, printsjabara: model.pt.jbr: no tensors with role 'weight'and exits with status 1. The same holds for an archive ofoptimizer.pt.OUTmust not exist.export-weightstakes no base, so it cannot read a delta archive.
benchreads an archive, a file thatcompresstakes, or a directory. In a directory it reads the files thatcompresstakes and the*.jbrfiles, and prefixes each tensor name with the file name and/. An archive counts under the name of the file that it restores, so a compressed and an uncompressed directory give the same tensor names. A directory that holds a file and its archive is an error.benchcannot read a delta archive.
A parent directory of checkpoints¶
compress, decompress, verify, and ls take --recursive. PATH is then a parent, such as the output_dir of a Hugging Face Trainer, and the command works on its checkpoints one after the other.
A checkpoint directory directly holds a regular file that
compresstakes in a directory, or a*.jbrarchive. The checkpoints are the immediate subdirectories that are checkpoint directories, in natural order of name (checkpoint-200beforecheckpoint-1000), thenPATHitself last if it is one. A directory such asbestsorts beforecheckpoint-*, and with--deltait becomes the first checkpoint, so check the order with--dry-run. The walk goes one level down, never deeper, and skips hidden directories and symbolic links to directories. Files that are not checkpoint files are never touched.jabara.files.checkpoint_dirs(path)returns the same list in Python.Without
--recursive, aPATHthat holds no file of its own to work on is still an error. The message names the checkpoint directories that it found and suggests--recursive.compressanddecompresstake one checkpoint at a time, each all or nothing, and stop at the first failure. The checkpoints before it stay done, so disk space is freed as the run goes. The one that failed and the later ones stay as they were. The command exits with status 1 and prints one line,jabara: <checkpoint>: <error>; stopped there: <k> checkpoints done or skipped before it, this one and <n> after it left as they were. Before it changes anything, the command refuses a file beside its own archive in any checkpoint.A checkpoint with nothing to do prints
<dir>: skipped, already compressed(already decompressedfordecompress) and is not an error. After a stop, run the same command again.compress --dry-runworks with anyPATH. It prints what would be compressed and its size on disk, after the same refusals, without reading a tensor and without changing anything.compress --recursive --delta firstcompresses the first checkpoint, in the order above, as full archives, or uses it as it is if it holds only full archives. It codes every other checkpoint,PATHitself included, against that first one, as--basedoes for a directory. A first checkpoint that holds a delta archive is refused.compress --recursive --delta previouscodes every checkpoint but the first against the checkpoint before it in that order, so the archives form a chain, and a checkpoint compressed earlier stays as it is: a later run codes a new checkpoint against the last one. A restore follows the chain: the checkpoint at position k decodes k archives per tensor, and one lost archive loses every checkpoint after it. Usefirstwhen any checkpoint may be needed at any time, andpreviouswhen most are rarely read and disk is the constraint (the how-to guide has measurements).--deltaneeds--recursiveand cannot be combined with--base, and--recursivecannot be combined with--base: each is a usage error.decompress --recursiveandverify --recursivefind the base archives of a delta archive among the archives of the other checkpoints, by the recorded file name and index CRC-32.decompress --recursiverestores the checkpoints that hold delta archives before the ones they need, so in a chain the last checkpoint goes first. It checks every base first, down each chain, so a base that no checkpoint holds stops it before it restores anything. For a link behind an archive's own base, the message names both archives:<archive>: <owner>: base <name> (index crc <c>) is missing or changed.decompressof a checkpoint directory or of one archive, without--keep, is refused before it changes anything when a sibling checkpoint holds a delta archive written against an archive that it would delete, and no copy of that archive (the same index CRC-32) remains in a sibling. Decompress those first, or pass--keep.decompress --recursivemakes the same check forPATHitself, whose siblings are not checkpoints of the parent. A delta archive whose base lies outside the parent stopsdecompress --recursive: restore that checkpoint on its own with--base.Do not delete or move a checkpoint of a parent compressed with
--deltawhile a later one is compressed.jabara.hf.attach(trainer, delta="first")writes thefirstlayout and keeps the first checkpoint when theTrainerrotates old ones.benchtakes no--recursive. It holds every tensor in memory, and a parent would multiply that.
Output¶
Sizes are tensor bytes, not file sizes: <raw> counts the bytes of the tensors, and <stored> counts their encoded chunks. The percentage is 100 * stored / raw with one decimal, or empty when raw is 0.
compressprints one line per archive:<path>: <raw> -> <stored> bytes (<p>% of original).decompressprints the path of each restored file.With
--recursive,compressanddecompressprint their usual lines for each checkpoint, then<dir>: <n> archives, <raw> -> <stored> bytes (<p>% of original), and at the endtotal: <k> checkpoints, <s> skipped, <raw> -> <stored> bytes (<p>% of original).<k>counts every checkpoint found, and<s>the skipped ones.decompresstakes the sizes from the archives before it restores them.compress --dry-runprints<path>: would compress, <n> bytes on diskper file and a last linetotal: <n> files, <size> bytes on disk. With--recursiveit also prints<dir>: <n> files, <size> bytes on diskper checkpoint (followed by, delta against <base>with--delta), and the last line istotal: <k> checkpoints, <s> skipped, <n> files, <size> bytes on disk.lsprints one line per archive,<path>: <n> tensors, <raw> -> <stored> bytes (<p>% of original), then one line per tensor with its name, dtype, shape, role, codec, and sizes.ls --jsonprints a JSON list of objects with the keyspathandtensors, also with--recursive.verifyprintsok <path>for each archive.verify --recursivechecks every archive and does not stop at the first failure. It printsFAILED <path>: <reason>for an archive that fails, such asbase <name> (index crc <c>) is missing or changed, and exits with status 1 afterjabara: <m> of <n> archives failed.export-weightsprints nothing.codecsprints one codec id per line. Built-in codecs describescodecs --long,codecs ID, andcodecs --json.benchprints a header line,<n> threads, best of <repeats>, <w> warm-up, chunk <size> bytes, then one line per candidate and role: sizes, encode and decode throughput in MB/s (10^6 bytes per second), andexactorNOT EXACT. Throughput is the raw bytes divided by the smallest of the timed runs. A run times only the codec's encode or decode of the chunks in memory, not file access.<w>untimed rounds run first. In every round, each candidate in turn encodes and decodes once, and the candidate order reverses on every other timed round. Right before each timed encode and decode, the pool's threads and the calling thread run a busy loop for 0.1 s, untimed. A lossy row that decoded addsmax_abs_err=<value>. When a decode failed, the line saysdecode failed (<message>)in place of the decode throughput. When a delta candidate fell back for some tensors, the line ends with, 1 tensor used the fallbackfor one tensor and, <n> tensors used the fallbackfor more. The command exits 0 even with aNOT EXACTrow.bench --jsonprints the report described in JSON schemas.
Parsing rules¶
jabara parses and checks the whole argument list before it runs a command, so an argument list that it refuses, or that asks for help, changes no file. The first of these rules that matches decides:
-h,-H, or--help, spelled exactly that way and placed anywhere, prints the help of the command named first, or the overview if the first argument is not a command.-hprints the short help, and-Hand--helpprint the full help. It exits 0 and runs nothing. Another spelling, such as-hx,-hh, or--help=x, is a usage error. No other short flag exists.--is a usage error wherever it stands.Every other argument that starts with
-must be a flag of the command. It is never a path or a value. Write a path that starts with-as./-name. An unknown flag, a misspelled flag, a prefix of a flag (--kee), and a flag of another command are usage errors.Every other argument is a string. Nothing is read as a Python literal, so
run#2,123,a,b, andTrueare paths. An empty path, such as the one an unset"$CKPT"gives, is a usage error. A missing positional argument or a surplus one is a usage error.--keep,--json,--recursive, and--dry-runare switches.--keep,--keep=true, and--keep=falseare accepted, and any other value, such as--keep=0, is a usage error. A switch takes no separate value, so in--keep falsethe wordfalseis a surplus argument.--threadsand--repeatstake a positive integer in ASCII digits, as--threads 2or--threads=2.--candidatestakes one codec id, or several separated by commas. A flag given twice takes the last value.
Configuration files¶
compress, decompress, ls, verify, export-weights, bench, and codecs take --config FILE, a .json, .yaml, .yml, or .toml file that holds a mapping. Run from a config file shows one of each.
The keys are the destinations of the command's own options and arguments: the long option names with underscores (
base,keep,threads,candidates) and the names of the positional arguments (path,archive,out). The generated sections above list them. An option that a later version adds is a key without another change.The precedence is the command line, then the file, then the defaults. A positional argument on the command line replaces the same one of the file, and the command line fills them from the left.
The values have the types of the command line: a string for a path, an integer for a count,
trueorfalsefor a switch, and a list of strings forcandidates. Each value goes through the checks of its option, sothreads = 0fails as--threads 0does. A key that the command lacks, a value of another type,null, a suffix that is not listed, text that does not parse, and a top level that is not a mapping are usage errors.configandshow_configare not keys.A usage error from a file prints one line,
jabara: <file>: key '<key>': <reason>orjabara: <file>: <reason>, and exits with status 2. A file that cannot be read exits with status 1. A YAML file without PyYAML exits with status 1 and says to installjabara[yaml].--show-configprints{"command": ..., "config": ..., "settings": {...}}as JSON, with every key of the command, and exits with status 0. It runs nothing.YAML is read with PyYAML's
safe_load. TOML is read withtomllib, or withtomlion Python 3.10.
Help and manual pages¶
jabara help COMMAND prints the same text as jabara COMMAND --help. jabara with no argument prints the short overview on standard error and exits 2, as a usage error.
The package installs a manual page for jabara and for each command, such as jabara-compress(1), under share/man/man1 of its environment. man jabara finds them when the environment's bin directory is on PATH, as in an activated virtual environment or after pipx install. uv tool install does not link them. jabara man COMMAND shows the same page anywhere. When standard output is not a terminal, it prints the page's roff source.
Exit status¶
Status |
When |
|---|---|
0 |
The command succeeded, or help was printed. |
1 |
The command raised a |
2 |
Usage error. |
Any other exception is not caught and ends the command with a Python traceback.