Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

torch2bt

The bridge between PyTorch research and the Bittensor decentralized intelligence network.

Turn any torch.nn.Module into a revenue-generating Bittensor miner — zero boilerplate.

How it works

  1. Inspect — Analyzes your model's forward() signature via reflection
  2. Synthesize — Generates protocol.py, miner.py, and Dockerfile using Python 3.14 t-strings
  3. Deploy — Drop the output into any GPU host and start mining

Install

uv add torch2bt

Usage

import torch2bt as t2b
from my_models import SuperNeuralNet

t2b.package(
    model=SuperNeuralNet(),
    target_subnet=18,
    optimization="fp16",
    wallet_name="mining_key",
)

Output: torch2bt_output/protocol.py, miner.py, Dockerfile, pyproject.toml

Supported subnets

NetUID Name Optimizations
1 Text Prompting FP32/FP16/BF16/INT8/INT4
18 Cortex FP16/BF16

Local testing

from torch2bt.testing import MockValidator

validator = MockValidator(MySynapse, subnet_id=18, forward_fn=my_forward)
result = validator.query({"prompt": "a red cat"})

Examples

See examples/ for full runnable scripts:

Script Subnet Description
sn1_text_prompting.py SN1 Transformer LM → Text Prompting miner
sn18_image_generation.py SN18 Diffusion model → Cortex image miner

TODO

Phase A — Alpha (current)

  • inspector.py — extract model forward() signature via reflection
  • codegen.py — generate protocol.py, miner.py, Dockerfile, pyproject.toml using Python 3.14 t-strings
  • subnets/ — protocol registry for SN1 (Text Prompting) and SN18 (Cortex)
  • testing/ — MockValidator + MockSynapse for offline miner testing
  • t2b.package() — end-to-end packaging API
  • CI — ruff lint/format, zuban type check, pytest
  • PyPI metadata — version 0.1.0a1, classifiers, license, URLs
  • Publish 0.1.0a1 to PyPI

Phase B — Beta

  • t2b.deploy(platform="runpod") — provision GPU instance via RunPod API
  • t2b.deploy(platform="lambda") — Lambda Labs GPU support
  • Auto-register hotkey with btcli post-deploy
  • Dynamic TAO (dTAO / BIT001) profitability dashboard integration
  • Auto-quantization — convert FP32 models to INT4/INT8 on the fly with bitsandbytes
  • uv.lock generation for deterministic miner environments

Phase C — Production

  • Multi-subnet mining — host multiple models on a single Axon
  • Self-healing miners — auto-restart on OOM or network failure
  • Expand subnet registry beyond SN1 + SN18
  • t2b.benchmark() — measure model latency vs subnet timeout requirements

Metadata

Release files for torch2bt 0.1.0a1

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

Source distribution (sdist)

Source distribution for torch2bt 0.1.0a1
File Size Uploaded Provenance Actions
torch2bt-0.1.0a1.tar.gz 77.1 kB With provenance Details for torch2bt-0.1.0a1.tar.gz

Built distribution (wheel)

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

Total release size: 94.4 kB

Release files / torch2bt-0.1.0a1.tar.gz

Download URL torch2bt-0.1.0a1.tar.gz
Size 77.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4d27d71fd1b38907729145a620e2a59771bdfa89e5e11bdc1585e42b461eae50
BLAKE2b-256 checksum
How to use checksums
6f8a2f60be57c1745c5cc3dc43ab3f23de441b830b05fd4a960bfffa652142a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release files / torch2bt-0.1.0a1-py3-none-any.whl

Download URL torch2bt-0.1.0a1-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e1e558b8883d290f7a198df4fc665719800264eeabe05b2c870909ae4364a68
BLAKE2b-256 checksum
How to use checksums
77242cd76b9dc5ef6cf69e8de86aa92a541cb54bc05f688e1ab280a11c42e49d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Security for torch2bt 0.1.0a1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for torch2bt-0.1.0a1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

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