Skip to main content

Pirate Face CLI

Downloads HF models over BitTorrent from Pirate Face seeders.

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 find-model FILE         # which listed models hold this file (sha256)
pf dedupe                  # duplicate Hugging Face cache blobs (--apply to hardlink, default dry run)

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.

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.

Community Contributors

ZeroPointSynergy dmitryrn AndriiZvorygin chloecaffeinexo

Metadata

Release files for pirateface 0.2.35

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.35
File Size Uploaded Provenance Actions
pirateface-0.2.35.tar.gz 113.5 kB Without provenance Details for pirateface-0.2.35.tar.gz

Built distribution (wheel)

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

Total release size: 238.8 kB

Release files / pirateface-0.2.35.tar.gz

Download URL pirateface-0.2.35.tar.gz
Size 113.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d86a889c08d347d815400ff7803fdb0ea765e02aa23593244f95a537e932f26b
BLAKE2b-256 checksum
How to use checksums
6b6dd838824a6de6ebb49638538f487e8abf2466e223f3367a2f8fa65ec0270a
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.35-py3-none-any.whl

Download URL pirateface-0.2.35-py3-none-any.whl
Size 125.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81ae9b9a96de76f275101404780a93ba4b0f6698c6c26ac49b889008d2e21aee
BLAKE2b-256 checksum
How to use checksums
29e488f573b27ce118e614c5196c95fa31363d02b6453fe33aae103d92d8b5d8
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.35

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.35 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