Skip to main content

Checkpoint Tools

A small collection of helpful command-line tools for working with PyTorch checkpoints.

painebenjamin - checkpoint-tools stars - checkpoint-tools forks - checkpoint-tools
License PyPI - Version PyPI - Downloads

Installation

pip install checkpoint-tools

Available Commands

See all with checkpoint-tools --help

metadata

Usage: checkpoint-tools metadata [OPTIONS] INPUT_FILE

  Print metadata of a SafeTensors checkpoint.

Options:
  --help  Show this message and exit.

convert

Usage: checkpoint-tools convert [OPTIONS] INPUT_FILE

  Convert a PyTorch/SafeTensors checkpoint to SafeTensors format, optionally
  changing the precision of the (floating point) tensors.

  Writes the file with a suffix appropriate for the precision of the tensors
  in the state dictionary.

Options:
  --float8-e5m2-fn-uz           Convert all floating point tensors to
                                float8-e5m2-fn-uz (5 exponent bits, 2 mantissa
                                bits, finite numbers only, no negative zero)
  --float8-e5m2                 Convert all floating point tensors to
                                float8-e5m2 (5 exponent bits, 2 mantissa bits)
  --float8-e4m3-fn-uz           Convert all floating point tensors to
                                float8-e4m3-fn-uz (4 exponent bits, 3 mantissa
                                bits, finite numbers only, no negative zero)
  --float8-e4m3-fn              Convert all floating point tensors to
                                float8-e4m3-fn (4 exponent bits, 3 mantissa
                                bits, finite numbers only)
  --bfloat16                    Convert all floating point tensors to bfloat16
  --float16                     Convert all floating point tensors to float16
  --full                        Leave all tensors as full precision
  --replace-key TEXT            Keys to replace, use `:` to separate old and
                                new key parts
  --ignore-key TEXT             Keys to ignore
  --overwrite / --no-overwrite  Overwrite output file if it exists
  --name TEXT                   Output file name
  --help                        Show this message and exit.

convert-to-diffusers

Usage: checkpoint-tools convert-to-diffusers [OPTIONS] INPUT_FILE

  Convert a non-diffusers PyTorch/SafeTensors checkpoint to Diffusers format
  in SafeTensors.

  Writes the file with a suffix appropriate for the precision of the tensors
  in the state dictionary.

  Supported model types:

      Stable Diffusion 1.5

      Stable Diffusion XL

      Stable Diffusion 3.5

      FLUX.Dev

      FLUX.Schnell

Options:
  --name TEXT                   Output file name
  --model-type TEXT             Model type, default inferred from state
                                dictionary
  --int8                        Quantize all floating point tensors to 8-bit
                                integer using bitsandbytes
  --nf4                         Quantize all floating point tensors to
                                normalized float4 using bitsandbytes
  --float8-e5m2-fn-uz           Convert all floating point tensors to
                                float8-e5m2-fn-uz (5 exponent bits, 2 mantissa
                                bits, finite numbers only, no negative zero)
  --float8-e5m2                 Convert all floating point tensors to
                                float8-e5m2 (5 exponent bits, 2 mantissa bits)
  --float8-e4m3-fn-uz           Convert all floating point tensors to
                                float8-e4m3-fn-uz (4 exponent bits, 3 mantissa
                                bits, finite numbers only, no negative zero)
  --float8-e4m3-fn              Convert all floating point tensors to
                                float8-e4m3-fn (4 exponent bits, 3 mantissa
                                bits, finite numbers only)
  --bfloat16                    Convert all floating point tensors to bfloat16
  --float16                     Convert all floating point tensors to float16
  --full                        Leave all tensors as full precision
  --replace-key TEXT            Keys to replace, use `:` to separate old and
                                new key parts
  --ignore-key TEXT             Keys to ignore
  --overwrite / --no-overwrite  Overwrite output file if it exists
  --name TEXT                   Output file name
  --help                        Show this message and exit.

combine

Usage: checkpoint-tools combine [OPTIONS] [INPUT_FILES]...

  Combine multiple checkpoints into a single checkpoint.

Options:
  --float8-e5m2-fn-uz           Convert all floating point tensors to
                                float8-e5m2-fn-uz (5 exponent bits, 2 mantissa
                                bits, finite numbers only, no negative zero)
  --float8-e5m2                 Convert all floating point tensors to
                                float8-e5m2 (5 exponent bits, 2 mantissa bits)
  --float8-e4m3-fn-uz           Convert all floating point tensors to
                                float8-e4m3-fn-uz (4 exponent bits, 3 mantissa
                                bits, finite numbers only, no negative zero)
  --float8-e4m3-fn              Convert all floating point tensors to
                                float8-e4m3-fn (4 exponent bits, 3 mantissa
                                bits, finite numbers only)
  --bfloat16                    Convert all floating point tensors to bfloat16
  --float16                     Convert all floating point tensors to float16
  --full                        Leave all tensors as full precision
  --replace-key TEXT            Keys to replace, use `:` to separate old and
                                new key parts
  --ignore-key TEXT             Keys to ignore
  --overwrite / --no-overwrite  Overwrite output file if it exists
  --name TEXT                   Output file name
  --help                        Show this message and exit.

Metadata

Release files for checkpoint-tools 0.2.0

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

Source distribution (sdist)

Source distribution for checkpoint-tools 0.2.0
File Size Uploaded Provenance Actions
checkpoint_tools-0.2.0.tar.gz 15.6 kB Without provenance Details for checkpoint_tools-0.2.0.tar.gz

Release files / checkpoint_tools-0.2.0.tar.gz

Download URL checkpoint_tools-0.2.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5d68f5290761d2da62d435f5c5d9eaf99cb46ef1e1fccb40d867b1de3cb26721
BLAKE2b-256 checksum
How to use checksums
9982366ffedfb84684a4ae4210bcc308dd86ab537942776551f432a348ae813f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for checkpoint-tools 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file No provenance

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