Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch2bt-0.1.0a1.tar.gz (77.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch2bt-0.1.0a1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file torch2bt-0.1.0a1.tar.gz.

File metadata

  • Download URL: torch2bt-0.1.0a1.tar.gz
  • Upload date:
  • Size: 77.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torch2bt-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 4d27d71fd1b38907729145a620e2a59771bdfa89e5e11bdc1585e42b461eae50
MD5 d77e5a4115b90711149a38b08beb0184
BLAKE2b-256 6f8a2f60be57c1745c5cc3dc43ab3f23de441b830b05fd4a960bfffa652142a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for torch2bt-0.1.0a1.tar.gz:

Publisher: release.yml on Shindora/torch2bt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torch2bt-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: torch2bt-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torch2bt-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e1e558b8883d290f7a198df4fc665719800264eeabe05b2c870909ae4364a68
MD5 dafd3f051df72c48d774cab6003e0062
BLAKE2b-256 77242cd76b9dc5ef6cf69e8de86aa92a541cb54bc05f688e1ab280a11c42e49d

See more details on using hashes here.

Provenance

The following attestation bundles were made for torch2bt-0.1.0a1-py3-none-any.whl:

Publisher: release.yml on Shindora/torch2bt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page