transcribe-cpp
Python bindings for transcribe.cpp, a C/C++ speech-to-text library built on ggml.
Status: in development. Until wheels are published, use a locally built
libtranscribethrough repo auto-discovery orTRANSCRIBE_LIBRARY.
Upgrading from 0.1? See the
0.2 migration guide,
including the replacement of gpu_device= with exact device objects.
import transcribe_cpp
with transcribe_cpp.Model("model.gguf") as model:
with model.session() as session:
result = session.run(pcm_float32_16k_mono)
print(result.text)
run() takes mono 16 kHz float32 PCM (buffer-protocol object or sequence). It
does not decode containers or resample; convert audio before calling it.
import numpy as np
pcm = np.asarray(audio, dtype=np.float32) # 1-D, 16 kHz mono
# Downmix stereo first; 2-D input is rejected:
# pcm = audio.mean(axis=1).astype(np.float32)
result = session.run(pcm)
Punctuation, capitalization, and text normalization
Generic run controls use "default" to preserve each model family's shipped
behavior. Models advertising model.supports("pnc") accept pnc="off" or
pnc="on"; models advertising model.supports("itn") accept the equivalent
itn values. The options are available on run(), run_batch(), stream(),
and the one-shot transcribe() helper.
result = session.run(pcm, pnc="off", itn="on")
Streaming models expose incremental transcription with committed/tentative
text views — see examples/stream_wav.py:
with model.session() as session, session.stream() as stream:
for chunk in pcm_chunks:
stream.feed(chunk)
text = stream.text() # .committed (stable) + .tentative
stream.finalize()
result = stream.snapshot() # language, segments, words, tokens, timings
Long transcriptions can be cancelled from another thread with
session.cancel() — the run raises Aborted with the partial transcript on
exc.partial_result (same for OutputTruncated).
Backends
Model(backend=...) applies a backend policy ("auto" uses the best
available). transcribe_cpp.backends() returns process-local device objects;
pass one as Model(device=device) for exact selection with no fallback. Persist
a device's device_id, not its runtime handle or index. backend_available(kind)
checks whether a backend policy can currently be satisfied.
device = next(d for d in transcribe_cpp.backends() if d.device_type == "cpu")
with transcribe_cpp.Model("model.gguf", device=device) as model:
print(model.device)
| Variable | Effect |
|---|---|
TRANSCRIBE_BACKEND |
overrides the "auto" default; explicit backend= still wins |
TRANSCRIBE_NATIVE_PROVIDER |
forces an installed native provider package, for example cu12 |
TRANSCRIBE_LIBRARY |
loads exactly this shared library |
Planned wheels will bundle CPU plus platform accelerators;
transcribe-cpp[cu12] will add the CUDA 12 provider.
Running from a working tree
The binding loads the native library at import and verifies its ABI layout and
version before use. Build a shared library, then run from the repo or point
TRANSCRIBE_LIBRARY at it:
cmake -B build-shared -DTRANSCRIBE_BUILD_SHARED=ON
cmake --build build-shared --target transcribe
cd bindings/python
PYTHONPATH=src uv run --no-project python examples/transcribe_wav.py \
../../models/whisper-tiny.en/whisper-tiny.en-Q5_K_M.gguf ../../samples/jfk.wav
No-model tests always run; model tests skip unless smoke assets are present.
Override paths with TRANSCRIBE_SMOKE_MODEL, TRANSCRIBE_SMOKE_AUDIO, and
TRANSCRIBE_SMOKE_STREAMING_MODEL.
cd bindings/python
TRANSCRIBE_LIBRARY=../../build-shared/src/libtranscribe.dylib \
uv run --extra test pytest
Notes
- One run/stream at a time per
Modelin 0.x: sessions share the model's compute backend, so serialize runs across sessions (or load one model per worker). See theModeldocstring. - Import package:
transcribe_cpp - Distribution:
transcribe-cpp - License: MIT
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 transcribe_cpp-0.2.3.tar.gz.
File metadata
- Download URL: transcribe_cpp-0.2.3.tar.gz
- Upload date:
- Size: 92.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4458cbad6ba2945c6f3be39065ccef80c96f73c0a78731e2ac92495270c1137
|
|
| MD5 |
761117bc1dadc5ab264835e482135290
|
|
| BLAKE2b-256 |
290d5fb5d9aa2cd54ff6995958d887e429a624353684914e8aef1ba00b9519d6
|
Provenance
The following attestation bundles were made for transcribe_cpp-0.2.3.tar.gz:
Publisher:
publish.yml on handy-computer/transcribe.cpp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transcribe_cpp-0.2.3.tar.gz -
Subject digest:
b4458cbad6ba2945c6f3be39065ccef80c96f73c0a78731e2ac92495270c1137 - Sigstore transparency entry: 2650364304
- Sigstore integration time:
-
Permalink:
handy-computer/transcribe.cpp@63a44d9239d610b3908e8a66b384924cd4a77217 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/handy-computer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
publish.yml@63a44d9239d610b3908e8a66b384924cd4a77217 -
Trigger Event:
push
-
Statement type:
File details
Details for the file transcribe_cpp-0.2.3-py3-none-any.whl.
File metadata
- Download URL: transcribe_cpp-0.2.3-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be4ec773c3e48993301f5b4256781ee5ef96ff075e904fc495c0effd096f1a03
|
|
| MD5 |
19b6053499e2fafaeefb689a5c60b394
|
|
| BLAKE2b-256 |
c639832282b7d27e29ee48f2c89c243b431078dfc235ca48b59b35c74431ce55
|
Provenance
The following attestation bundles were made for transcribe_cpp-0.2.3-py3-none-any.whl:
Publisher:
publish.yml on handy-computer/transcribe.cpp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transcribe_cpp-0.2.3-py3-none-any.whl -
Subject digest:
be4ec773c3e48993301f5b4256781ee5ef96ff075e904fc495c0effd096f1a03 - Sigstore transparency entry: 2650364351
- Sigstore integration time:
-
Permalink:
handy-computer/transcribe.cpp@63a44d9239d610b3908e8a66b384924cd4a77217 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/handy-computer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
publish.yml@63a44d9239d610b3908e8a66b384924cd4a77217 -
Trigger Event:
push
-
Statement type: