Lossless by default¶
Jabara restores every tensor bit for bit unless you opt in to a lossy codec, so that training resumes as if it had never stopped. A checkpoint that restores approximately cannot promise that. You therefore ask for approximation in code, per tensor, and the archive records the error that it introduced.
What is verified, and when¶
Every read, every chunk. Each chunk stores a CRC-32 of the bytes that a reader must produce. A reader checks it after decoding and raises
ChecksumErroron a mismatch. For a lossless chunk these are the original bytes, so a pass means that the original is back.Every compression of a file.
compress_filewrites the archive under a temporary name, reopens and verifies it, and only then renames it and deletes the source. An archive under its final name has been verified.compress_dirverifies every archive before it deletes any original.Every lossy write. The writer decodes each lossy chunk once and stores the largest absolute difference from the input as
max_abs_err. The checksum of a lossy chunk covers the decoded bytes, soverifyconfirms that the archive decodes to what the writer measured. It cannot confirm closeness to the original, which the archive does not hold (see Opt in to a lossy codec and read the recorded error).On demand.
jabara verifyandArchive.verify()decode everything and check every checksum.The index. The index has its own CRC-32, and the file has a magic number at each end. A reader rejects a file that it does not understand before it touches a chunk.
What lossless means for each file type¶
A file in any format that jabara compress takes, safetensors or a torch.save zip, is restored byte for byte (see Checkpoint file formats). An archive that Jabara 0.1.0 wrote from a torch file is restored with the same nested types, key order, dtypes, shapes, and tensor bits, NaN and -0.0 included, but its file bytes can differ, because that restore pickles the state again with torch.save.
The opt-in¶
A codec declares whether it is lossless. A write whose assigner picks a lossy codec raises LossyNotAllowedError unless the caller passes allow_lossy=True. The PyTorch Lightning plugin and jabara compress offer no such opt-in, so they never write a lossy tensor. jabara bench runs lossy candidates freely, because it writes nothing.