What the Trainer adapter does inside a save¶
jabara.hf.attach compresses a checkpoint inside the Trainer's save call. The call is synchronous: the save returns after the archives are written and verified, and no thread outlives it. Training waits for the compression.
What a save does¶
The Trainer first writes its usual files, including its rotation of old checkpoints. Then Jabara turns every *.safetensors file and optimizer.pt of the new checkpoint directory into a verified .jbr archive. It deletes the originals only after all archives are written. If one archive fails, the checkpoint stays uncompressed, and an error such as LossyNotAllowedError propagates out of Trainer.train.
An interrupted save leaves each file as the original, the archive, or both. A resume with Jabara attached loads the original where there is one, and the archive otherwise. A hard crash can also leave a *.tmp file, which a resume ignores and you can delete (see Use Jabara with the Hugging Face Trainer).
What threads sets¶
threads sets the size of the thread pool that codes chunks in parallel. All tensors of a file share the pool, so the chunks of different tensors are coded at the same time, and a checkpoint of many small tensors is not limited to one thread. Two kinds of tensor are exceptions. A delta tensor reads its base tensor first, so it starts only when the chunks before it are done, and delta tensors of one chunk are coded one at a time. A tensor whose codec runs threads of its own, such as zipnn/1, is coded alone, and the codec gets all threads threads for each chunk. Files are coded one after another. The comparison report times the codec's share of the wait, not the whole save (see Compare codecs on your own checkpoint).
Why the Hub strategies are refused¶
With hub_strategy set to checkpoint or all_checkpoints, the Trainer uploads the checkpoint directory in the background. That upload would race with compression, so check_arguments and attach refuse both strategies.