Skip to main content

Pirate Face CLI

Downloads HF models over BitTorrent from Pirate Face seeders. Your code stays the same.

Install

pip install pirateface

Or without installing: uv run -p 3.13 --with pirateface python your_script.py. Needs Python 3.12 or 3.13. With uvx, pass -p 3.13.

Anything that downloads through HF (transformers, diffusers, hf download) now pulls from the swarm. Files are checked against Hugging Face's SHA-256 before they are trusted; offline, with the cached index, the same bytes are checked against the torrent's own piece hashes. If a model isn't on Pirate Face or a peer stalls, that file comes from Hugging Face as usual. Set PF_HF_FIRST=1 to reverse the order: Hugging Face first, swarm only when it fails.

Commands

pf download org/model      # download into the Hugging Face cache (--local-dir DIR for a folder)
pf seed org/model [FOLDER] # seed a model, submitting it first if Pirate Face doesn't list it
pf submit --repo org/model FOLDER  # package and submit a folder (--dry-run to preview)
pf work                    # build torrents for queued model requests, streamed from Hugging Face
pf restore PATH            # upload .torrent files to fix a listing whose magnet stalls
pf index [--sync]          # the cached magnet index: what it holds, and mirror the newest build

pf work builds torrents for queued model requests, streamed from Hugging Face into memory; no model bytes are saved to disk. Progress is saved in a private checkpoint (completed pieces plus the unfinished piece's SHA-256 state, or file boundaries when the native hasher is unavailable) and an interrupted run resumes it on the next run while the lease is still active; a new lease for the same model revision and files can also reuse it. Completed file checkpoints are retained when the native hasher is unavailable. A checkpoint that does not check out (corrupt, missing block hashes, a different job) is discarded automatically and the job rebuilds from scratch. Piece-boundary checkpoints are saved at most every few seconds. pf work --clear-progress discards the saved hashes (keeping the lease), and --name keeps concurrent workers' checkpoints apart.

Run pf <command> --help for every flag.

When Pirate Face is down

The site's magnet index lists every model's magnet as a weekly torrent, mirrored into $PF_CACHE/index/shards/. When Pirate Face cannot be reached, a listed model in that copy still downloads: checked against the Hugging Face fingerprint first, and when Hugging Face cannot answer, against the torrent's own piece hashes via the infohash the shard commits to. A model not listed, a torrent that carries only some files, an unreadable removals list, or a download with no fingerprint falls back to Hugging Face, with the reason printed.

pf index          # the build this copy holds, how many models, whether the site has a newer one
pf index --sync   # mirror the build the site names, replacing copies the build has changed
pf index --add    # add every magnet in the index to qBittorrent, your seeding tracker on new ones

Settings

Variable
PIRATEFACE_KEY Account key (otherwise asked once and saved)
QBT_URL, QBT_USER, QBT_PASS qBittorrent Web UI (default http://localhost:8080)
OLLAMA_MODELS Ollama model store root (default: the detected Ollama model directory)
TR_HOST, TR_AUTH Transmission RPC (default localhost:9091), user:pass
HF_TOKEN For gated repos
PF_DISABLE Set to 1 to turn the download hook off
PF_HF_FIRST 1 = download from Hugging Face first, swarm only when it fails
PF_NO_BLOCK_PROOFS 1 = pf work, submit and seed submit without block proofs (default: they prove random 16 KiB blocks against the torrent's v2 hashes)
PF_LISTEN libtorrent listen interfaces (default 0.0.0.0:0,[::]:0)

Downloads use libtorrent's defaults: listen on 0.0.0.0:0,[::]:0 (change via PF_LISTEN), UPnP and NAT-PMP port mapping, DHT and LSD peer discovery, and uncapped upload while downloading.

Development

uv run --group dev ruff check

Contributing

  • One change per PR, small enough to read in one sitting.
  • Please don't add tests for now. We're still settling how we test, so check your change by hand and say how in the PR.
  • uv run --group dev ruff check and ruff format --check should pass with nothing new.
  • When you replace code, delete the old code. No disabled flags or leftover branches.
  • Fix problems where they start rather than adding special cases around them.
  • If Pirate Face can't be reached, say so and carry on. Never crash, and never write outside the model folder.
  • Add your Pirate Face username to the PR so we can credit you.

Metadata

Release files for pirateface 0.2.32

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

Source distribution (sdist)

Source distribution for pirateface 0.2.32
File Size Uploaded Provenance Actions
pirateface-0.2.32.tar.gz 99.6 kB Without provenance Details for pirateface-0.2.32.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pirateface 0.2.32
File Interpreter ABI Platform Actions
pirateface-0.2.32-py3-none-any.whl Python 3 none any Details for pirateface-0.2.32-py3-none-any.whl

Total release size: 206.4 kB

Release files / pirateface-0.2.32.tar.gz

Download URL pirateface-0.2.32.tar.gz
Size 99.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b200de73c5d766e72a47902ec5a1236e4b5db4d826eb707fd37ffb5a40c48d21
BLAKE2b-256 checksum
How to use checksums
64672fc9ca4e43fc02bb5104d29b1943b416c378fb84bff1c0f7c96e09d0f023
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pirateface-0.2.32-py3-none-any.whl

Download URL pirateface-0.2.32-py3-none-any.whl
Size 106.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c1c7b7e170bddb125f864ba3e97378be5f80e8ae5a962a9abad50608df4d874
BLAKE2b-256 checksum
How to use checksums
fa0a4f3d214dea75900dd3e695e758c226d09aae0de30dd71394109d36e22a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pirateface 0.2.32

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.32 This release

2 release files 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