hn.today

Decentralizing Hugging Face and open model distribution

github.com5 points0 comments
Screenshot of Decentralizing Hugging Face and open model distribution

A small Python package that transparently redirects Hugging Face model downloads to a BitTorrent swarm, enabling decentralized distribution without changing user code. Once installed (or run under a wrapper), it injects a startup hook that intercepts calls to transformers and huggingface_hub APIs so model files are requested from Pirate Face seeders first; every file retrieved from peers is verified against Hugging Face fingerprints (SHA‑256 for large files, git SHA‑1 for others) before being accepted into the existing HF cache. If a torrent isn’t available, no peer responds in time, or integrity checks fail, downloads fall back to Hugging Face as usual, so existing scripts and cache layout require no modification. A minimal CLI (pf download) and simple install (pip install pirateface) complete the user-facing workflow.

Implementation details emphasize safety and configurability: the hook waits up to 30 seconds for peer file lists and will abandon stalled transfers after 60 seconds, keeping HF as a rescue source. Environment variables control enable/disable, verbosity, cache location, API server, listen interfaces, and debug logging. Libtorrent is required, so supported Python versions are currently limited (notably 3.12-3.13); the project is MIT‑licensed and aims to reduce central load while preserving Hugging Face’s integrity guarantees.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.