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
- Inspect — Analyzes your model's
forward()signature via reflection - Synthesize — Generates
protocol.py,miner.py, andDockerfileusing Python 3.14 t-strings - 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 modelforward()signature via reflection -
codegen.py— generateprotocol.py,miner.py,Dockerfile,pyproject.tomlusing Python 3.14 t-strings -
subnets/— protocol registry for SN1 (Text Prompting) and SN18 (Cortex) -
testing/—MockValidator+MockSynapsefor 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.0a1to 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
btclipost-deploy - Dynamic TAO (dTAO / BIT001) profitability dashboard integration
- Auto-quantization — convert FP32 models to INT4/INT8 on the fly with bitsandbytes
-
uv.lockgeneration 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d27d71fd1b38907729145a620e2a59771bdfa89e5e11bdc1585e42b461eae50
|
|
| MD5 |
d77e5a4115b90711149a38b08beb0184
|
|
| BLAKE2b-256 |
6f8a2f60be57c1745c5cc3dc43ab3f23de441b830b05fd4a960bfffa652142a2
|
Provenance
The following attestation bundles were made for torch2bt-0.1.0a1.tar.gz:
Publisher:
release.yml on Shindora/torch2bt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch2bt-0.1.0a1.tar.gz -
Subject digest:
4d27d71fd1b38907729145a620e2a59771bdfa89e5e11bdc1585e42b461eae50 - Sigstore transparency entry: 1115210950
- Sigstore integration time:
-
Permalink:
Shindora/torch2bt@b522964f536d6a8276333c1b3aa7e71cff7c73d3 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/Shindora
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b522964f536d6a8276333c1b3aa7e71cff7c73d3 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e1e558b8883d290f7a198df4fc665719800264eeabe05b2c870909ae4364a68
|
|
| MD5 |
dafd3f051df72c48d774cab6003e0062
|
|
| BLAKE2b-256 |
77242cd76b9dc5ef6cf69e8de86aa92a541cb54bc05f688e1ab280a11c42e49d
|
Provenance
The following attestation bundles were made for torch2bt-0.1.0a1-py3-none-any.whl:
Publisher:
release.yml on Shindora/torch2bt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch2bt-0.1.0a1-py3-none-any.whl -
Subject digest:
5e1e558b8883d290f7a198df4fc665719800264eeabe05b2c870909ae4364a68 - Sigstore transparency entry: 1115210959
- Sigstore integration time:
-
Permalink:
Shindora/torch2bt@b522964f536d6a8276333c1b3aa7e71cff7c73d3 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/Shindora
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b522964f536d6a8276333c1b3aa7e71cff7c73d3 -
Trigger Event:
push
-
Statement type: