Hugging Face of Tenstorrent: pip-installable TTNN-accelerated drop-in for transformers.
Project description
tt_symbiote
The transformers API, accelerated on Tenstorrent silicon.
tt_symbiote is a pip-installable Python library whose public surface mirrors
Hugging Face transformers and
whose model implementations run on Tenstorrent Wormhole hardware (N150 / N300 /
T3K) via TTNN. The only line you
add to a normal HF script is set_device(model, mesh):
import ttnn
from transformers import AutoTokenizer
from tt_symbiote import AutoModelForCausalLM, set_device
ttnn.set_fabric_config(ttnn.FabricConfig.FABRIC_1D_RING)
mesh = ttnn.open_mesh_device(mesh_shape=ttnn.MeshShape(1, 8), trace_region_size=200_000_000)
tokenizer = AutoTokenizer.from_pretrained("inclusionAI/Ling-mini-2.0", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"inclusionAI/Ling-mini-2.0", trust_remote_code=True, dtype="auto",
kv_cache_kwargs={"max_num_blocks": 512}, # paged-attention budget
)
set_device(model, mesh) # <-- the one TT-specific line
inputs = tokenizer.apply_chat_template(
[{"role": "user", "content": "Explain Python vs C++ in two sentences."}],
add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt",
).to(model.device)
out = model.generate(**inputs, max_new_tokens=256, use_cache=True, past_key_values=model._tt_kv_cache)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:]))
ttnn.close_mesh_device(mesh)
Runnable copies of this and every supported variant live in
examples/e2e/.
The design rules:
- Public API =
transformers'sAuto*surface — same class names, samefrom_pretrained(...), samemodel.generate(...). Drop-in. - One device-binding step —
set_device(model, mesh)takes exactly two arguments; all configuration flows throughfrom_pretrained. - Per-module TTNN with a CPU safety net — modules with a TTNN implementation
run on device; anything else falls back to its CPU
nn.Module.
Installation
tt_symbiote runs on Linux, Python 3.10 – 3.12, on a host with a Tenstorrent
Wormhole device attached (N150 / N300 / T3K).
python -m venv .venv && source .venv/bin/activate
pip install tt_symbiote # text-only causal LMs
pip install "tt_symbiote[vision]" # multimodal / vision (Gemma-4, Qwen3-VL, ResNet)
pip install "tt_symbiote[all]" # every model's optional deps
The install pulls the transitive HF stack (torch, transformers==5.9.0,
accelerate, tokenizers, …). The [vision] extra adds torchvision, which
HF's multimodal AutoProcessor classes require (mirrors the upstream
transformers[vision] extra).
ttnnis NOT installed by pip — you must provide it from source.ttnnis a compiled extension tied to a specifictt-metalcommit, sott_symbiotedeliberately does not depend on it: a PyPIttnnwheel would silently overwrite the source build and corrupt numerics. Buildtt-metalat the model's pinned commit and set$TT_METAL_HOMEsottnnis importable;import tt_symbioteauto-wires the source-builtttnn(and raises a clear, actionable error if none is found). Each model records the specifictt_metal_commitit was verified against — metadata enforced at load time by a compatibility gate that warns when the installedttnnwas built from a different commit.ttnn JIT-compiles firmware kernels at the first
open_mesh_device(...)call using thesfpiRISC-V toolchain. Seedocs/install_prerequisites.mdfor details.
Public API
tt_symbiote re-exports the entire transformers Auto* loader surface (same
class names) and adds a small TT-specific surface:
from tt_symbiote import (
AutoModelForCausalLM, # plus the rest of the Auto* loaders
set_device, # bind a loaded model to a TTNN mesh device
register_modules, # public hook for new recipe authors
register_recipe, # recipe decorator
TT_MODEL_REGISTRY, # {HF_class_name: Recipe}
compatibility, # runtime coverage observation
)
set_device(model, mesh) is the only required new line. compatibility.report(model)
returns a JSON dict of which modules ran on TTNN vs fell back to CPU — see
docs/development/cpu_vs_device_coverage.md
for the schema.
Supported models
| Architecture (HF class) | Variants | Hardware | Status |
|---|---|---|---|
BailingMoeV2ForCausalLM |
inclusionAI/Ling-mini-2.0 |
T3K (1×8) | full TTNN |
ResNetForImageClassification |
microsoft/resnet-{18,34,50,101,152} |
N150 (1×1) | full TTNN |
Gemma4ForConditionalGeneration |
google/gemma-4-{E2B,E4B}-it |
N150 (1×1) | partial TTNN |
Gemma4ForConditionalGeneration |
google/gemma-4-{31B,26B-A4B}-it |
T3K (1×8) | CPU-first via budget gate |
Qwen3VLForConditionalGeneration |
Qwen/Qwen3-VL-{2B,4B,8B,32B}-Instruct |
N150 / T3K | partial TTNN |
See docs/supported_models.md for the full
per-variant matrix and examples/e2e/README.md for the
per-script index.
From-source (contributors)
For the bundled e2e demos and the test suite; a built tt-metal at
$TT_METAL_HOME provides ttnn. scripts/bootstrap_venv.sh is optional (wires
ttnn, checks sfpi, pip install -e . + pre-commit hook); with $TT_METAL_HOME
set, a plain pip install -e . also works because import tt_symbiote
auto-wires the source-built ttnn. The layout mirrors
transformers/src/transformers/:
src/tt_symbiote/
├── __init__.py # public API (Auto* + set_device + register_modules + …)
├── core/ # TTNNModule, run_config, arch helpers (internal)
├── models/auto/ # transformers Auto* loaders
├── models/<name>/ # per-model recipes (bailing_moe_v2, gemma4, qwen3_vl, resnet, …)
├── modules/ # generic TTNN building blocks (Linear, Embedding, …)
└── utils/ # set_device, register_modules, compatibility, hf_compat, …
Examples and tests live at the repo root (not inside the package), under
examples/e2e/ and tests/. See
docs/development/PROJECT_PROPOSAL.md for
the layout rationale and the porting recipe contract.
Links
- Repository: https://github.com/alnah005/tt_symbiote
- Issues / discussions: https://github.com/alnah005/tt_symbiote/issues
- TTNN documentation: https://docs.tenstorrent.com/ttnn/latest/
- License: Apache-2.0 (
LICENSE)
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
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 tt_symbiote-0.1.6.tar.gz.
File metadata
- Download URL: tt_symbiote-0.1.6.tar.gz
- Upload date:
- Size: 308.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
183f7389f0da98bee87bda266d0e5f308f3bfefddaf57ad5623bc4dbd19ccde2
|
|
| MD5 |
ab53be2e7aeedf0f93355d2a352cbe1e
|
|
| BLAKE2b-256 |
4cc6bc16e3dbe11e41226be6ea230aa0629b810ff78d55016bf62f7196c7825a
|
Provenance
The following attestation bundles were made for tt_symbiote-0.1.6.tar.gz:
Publisher:
release.yml on alnah005/tt_symbiote
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tt_symbiote-0.1.6.tar.gz -
Subject digest:
183f7389f0da98bee87bda266d0e5f308f3bfefddaf57ad5623bc4dbd19ccde2 - Sigstore transparency entry: 1932818463
- Sigstore integration time:
-
Permalink:
alnah005/tt_symbiote@1582098b8da28ff72a75d93ec2d09823bb28471a -
Branch / Tag:
refs/heads/transformers5.9.0 - Owner: https://github.com/alnah005
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1582098b8da28ff72a75d93ec2d09823bb28471a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file tt_symbiote-0.1.6-py3-none-any.whl.
File metadata
- Download URL: tt_symbiote-0.1.6-py3-none-any.whl
- Upload date:
- Size: 351.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b8271c3dfbf95f5ce2b0ce88ffbe0946c83a4d18df4654fb1b71f9a7c46b8c4
|
|
| MD5 |
bc72945df064a201855026e6d1650ecb
|
|
| BLAKE2b-256 |
dd939325f2226e9062eefa0b54242d5b797da34d2b1bc61b154cc68d8977edb6
|
Provenance
The following attestation bundles were made for tt_symbiote-0.1.6-py3-none-any.whl:
Publisher:
release.yml on alnah005/tt_symbiote
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tt_symbiote-0.1.6-py3-none-any.whl -
Subject digest:
9b8271c3dfbf95f5ce2b0ce88ffbe0946c83a4d18df4654fb1b71f9a7c46b8c4 - Sigstore transparency entry: 1932818659
- Sigstore integration time:
-
Permalink:
alnah005/tt_symbiote@1582098b8da28ff72a75d93ec2d09823bb28471a -
Branch / Tag:
refs/heads/transformers5.9.0 - Owner: https://github.com/alnah005
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1582098b8da28ff72a75d93ec2d09823bb28471a -
Trigger Event:
workflow_dispatch
-
Statement type: