Skip to main content

pt-loader

CI Crates.io docs.rs PyPI Python Versions License: MIT

Safe parser-based PyTorch checkpoint converter to safetensors with both Rust and Python APIs.

Active Development Notice

pt-loader is under active development. During v0.1.x, we may introduce breaking API and behavior changes in both Rust and Python interfaces without backward-compatibility guarantees.

Features

  • Parses torch zip .pt checkpoints with strict safety limits.
  • Converts checkpoints to model.safetensors + model.yaml.
  • Inspects checkpoint metadata and tensor summaries.
  • Loads tensors directly into Python as NumPy arrays.

Installation

Python

Install from PyPI:

pip install pt-safe-loader

Install from source (local repo):

uv sync --group dev
uv run maturin develop --features pyo3

Rust

Add dependency:

[dependencies]
pt-loader = "0.1"

Python Usage

Example:

from pt_loader import PtCheckpoint

ckpt = PtCheckpoint.load("samples/yolo26n.pt")
print(ckpt.metadata()["tensor_count"])

result = ckpt.export(format="safetensors", dir="out")
print(result["weights_path"])

tensors = ckpt.state_dict(backend="numpy")
print(next(iter(tensors.values())).shape)

Rust Usage

use pt_loader::{ExportFormat, ExportOptions, LoadOptions, PtCheckpoint};
use std::path::Path;

let input = "samples/yolo26n.pt";
let ckpt = PtCheckpoint::load(input, LoadOptions::default())?;
let result = ckpt.export("out", ExportOptions::new(ExportFormat::Safetensors, Some(Path::new(input))))?;
println!("{}", result.weights_path.display());

Development

cargo test
cargo check --features pyo3
uv run pytest -q

Metadata

Release files for pt-safe-loader 0.1.4

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

Source distribution (sdist)

Source distribution for pt-safe-loader 0.1.4
File Size Uploaded Provenance Actions
pt_safe_loader-0.1.4.tar.gz 39.4 kB With provenance Details for pt_safe_loader-0.1.4.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pt-safe-loader 0.1.4
File Interpreter ABI Platform Actions
pt_safe_loader-0.1.4-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for pt_safe_loader-0.1.4-cp38-abi3-win_amd64.whl
pt_safe_loader-0.1.4-cp38-abi3-manylinux_2_34_x86_64.whl CPython 3.8 abi3 Linux glibc 2.34+ x86-64 Details for pt_safe_loader-0.1.4-cp38-abi3-manylinux_2_34_x86_64.whl
pt_safe_loader-0.1.4-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for pt_safe_loader-0.1.4-cp38-abi3-macosx_11_0_arm64.whl

Total release size: 1.7 MB

Release files / pt_safe_loader-0.1.4.tar.gz

Download URL pt_safe_loader-0.1.4.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f0e252d6d5606122b66d4764232b5898818a4c5d9f3bc5987d1bc14cc8d85eee
BLAKE2b-256 checksum
How to use checksums
3e896d22d7036ce04e2d8a30ae45e6638d4d90041b39aac619ca920855cacec6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

Release files / pt_safe_loader-0.1.4-cp38-abi3-win_amd64.whl

Download URL pt_safe_loader-0.1.4-cp38-abi3-win_amd64.whl
Size 506.9 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
69370080c617ea0d381dd42732d577c8856c87c222245634b55156493440326a
BLAKE2b-256 checksum
How to use checksums
f2b21687291bb341fc4590dfd9e2be271bc04760dfd89680ef07fbc675c33f89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

Release files / pt_safe_loader-0.1.4-cp38-abi3-manylinux_2_34_x86_64.whl

Download URL pt_safe_loader-0.1.4-cp38-abi3-manylinux_2_34_x86_64.whl
Size 599.9 kB
Tags CPython 3.8 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
36147db57bb2cd7bbdf84db46e23a4d823f201d5fa5fd6964c6f0e6f5fa40e45
BLAKE2b-256 checksum
How to use checksums
8c3f19bb3a14bfc31f84eb7c7e85c43eaf2b1cf9336bc438b4e41bc5024e8a07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

Release files / pt_safe_loader-0.1.4-cp38-abi3-macosx_11_0_arm64.whl

Download URL pt_safe_loader-0.1.4-cp38-abi3-macosx_11_0_arm64.whl
Size 530.1 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
58004dbf27f349e064ae726ea8587ab34722721a0bf17311382cbd97a303bd72
BLAKE2b-256 checksum
How to use checksums
f8f8979020e15b0b7a0a11ed95d790b70733a2bfee46761dd35e916dc26389b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

Security for pt-safe-loader 0.1.4

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for pt_safe_loader-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

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.

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