Skip to main content

HF-Torrent

This repository contains an experimental torrent-style download for model weights in Hugging Face.

The core implementation is main_hub.py, which downloads files from Hugging Face and converts them into seedable torrents.

How to use

pip install hf-torrent

Before launching downloads, make sure you have aria2c installed and

run the following command in a separate terminal
aria2c --enable-rpc --rpc-listen-all \
    --max-upload-limit=4M \
    --optimize-concurrent-downloads=true \
    --bt-detach-seed-only=true \
    --seed-ratio=10.0  

Then you can start using HF-Torrent with the following command:

hf-torrent <your target repo>

asciicast

Or if you have your preferred torrent clients, you can pull the torrent file only

hf-torrent --get-torrent <your target repo>

How to contribute

Installation

To install, run the following command:

pip install -r requirements.txt

Seeding

It is easy to contribute to seeding! First, change --seed-ratio=0 (from 10 to 0) when launching the aria2c RPC. Setting 0 means the daemon will seed infinitely. Next, change the upload bandwidth limit to a value that suits you, for example: --max-upload-limit=20M (4M by default).

After making these changes, launching seeding is as simple as downloading models. You can start seeding by running the following script and help distribute your favorite models!

python download.py <your target repo>

Create

To create a popular torrent, run the following command:

python generate_popular_torrents.py -r efederici/retnet-120m

This script will (1) download model files from Hugging Face, (2) iterate through the folder, (3) generate torrents for each file, and then put them under hf-torrent-store/{repo}.

We are looking for a wanted model list. Please open an issue if you have any favorite models to share.

Metadata

Release files for hf-torrent 0.0.1.post2401021916

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

Built distribution (wheel)

Table of built distributions (wheels) for hf-torrent 0.0.1.post2401021916
File Interpreter ABI Platform
hf_torrent-0.0.1.post2401021916-py3-none-any.whl Python 3 none any Details

Release files / hf_torrent-0.0.1.post2401021916-py3-none-any.whl

Download URL hf_torrent-0.0.1.post2401021916-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56c481f4f1c46a2e239417dbc2e22e5608f76f635a2a6eb4f4e7daec7c72785d
BLAKE2b-256 checksum
How to use checksums
71a781ca78bebfce1f8b0f88e4a237e39416beaeb3e5f1e103f97892b4d7101a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Security for hf-torrent 0.0.1.post2401021916

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.

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