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

Metadata

Release files for pirateface 0.2.34

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.34
File Size Uploaded Provenance Actions
pirateface-0.2.34.tar.gz 108.4 kB Without provenance Details for pirateface-0.2.34.tar.gz

Built distribution (wheel)

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

Total release size: 229.1 kB

Release files / pirateface-0.2.34.tar.gz

Download URL pirateface-0.2.34.tar.gz
Size 108.4 kB
Tags Source
SHA-256 checksum
How to use checksums
87e05566d3012954541a07ab62b342334dfb01ce32cd06525f172167477d5b48
BLAKE2b-256 checksum
How to use checksums
f147201a3b552f29c227b2e42e5bc2810fcae8b41f3cbed691d172dc2c52a73d
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.34-py3-none-any.whl

Download URL pirateface-0.2.34-py3-none-any.whl
Size 120.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3407d86c6cda339836c0d3354609009d8a6275d43a06a3e75c712e2981b3d08
BLAKE2b-256 checksum
How to use checksums
80f9b487b46e1082839aa64a83d8e2129cb233119be059bff4647f0de50fb94d
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.34

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