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
- 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
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)
| 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 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 logRelease 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 logSecurity 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.
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 logA 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.