Skip to main content

Python ctypes bindings and wheel packaging for qwentts.cpp

Project description

qwentts-cpp-python

Python bindings and wheel packaging for Pascal's qwentts.cpp C ABI.

This package is intentionally small:

  • it loads libqwen with ctypes
  • it exposes buffered and streaming synthesis
  • it can bundle prebuilt libqwen/libggml binaries in platform wheels
  • it does not bundle GGUF model weights

CUDA development build with an existing qwentts.cpp checkout:

python scripts/build_native.py \
  --source /path/to/qwentts.cpp \
  --backend cuda \
  --clean
QWENTTS_CPP_WHEEL_BUILD_TAG=1cu128 python -m build --wheel

CPU development build:

python scripts/build_native.py \
  --source /path/to/qwentts.cpp \
  --backend cpu \
  --clean
QWENTTS_CPP_WHEEL_BUILD_TAG=1cpu python -m build --wheel

--backend cuda is the default because faster-qwen3-tts is a CUDA-first package. CPU builds are still useful for development and smoke tests, but they are not the primary release target.

The CI wheel build defaults to qwentts.cpp 9dbe7ea26a01b30fccb117ae5e86807c1dc23d42, which includes the scheduler resets and ABI v2 cached voice-reference fields. CPU and CUDA both stay on the backend prompt-projection path.

QWENTTS_CPP_WHEEL_BUILD_TAG is useful for local wheelhouses. For public indexes, publish one backend flavor per package/version/platform compatibility tag; otherwise pip has no way to choose between CPU and CUDA binaries.

Local smoke test with a built library:

QWENTTS_CPP_LIBRARY=/path/to/libqwen.so python - <<'PY'
from qwentts_cpp import QwenLibrary
lib = QwenLibrary()
print(lib.version())
PY

Model files are resolved with huggingface-hub by QwenTTS.from_pretrained(...) or passed directly to QwenTTS(...) as GGUF paths.

Cached voice references

qwentts.cpp ABI v2 can skip reference WAV encoding for Base voice cloning by passing precomputed latents:

  • .spk: raw float32 speaker embedding from qwen-codec --talker
  • .rvq: packed 11-bit reference codec stream from qwen-codec
from qwentts_cpp import QwenTTS, load_speaker_embedding

tts = QwenTTS.from_pretrained("Qwen/Qwen3-TTS-12Hz-1.7B-Base", quant="Q4_K_M")

spk = load_speaker_embedding("reference.spk")
audio, sr = tts.synthesize(
    text="The sky is blue today.",
    lang="english",
    ref_spk_emb=spk,
    max_new_tokens=128,
)

For ICL clone mode, load the RVQ matrix with the model's codebook count and also pass the reference transcript:

from qwentts_cpp import load_rvq_codes

rvq = load_rvq_codes("reference.rvq", tts.num_codebooks())
audio, sr = tts.synthesize(
    text="The sky is blue today.",
    lang="english",
    ref_spk_emb=spk,
    ref_codes=rvq,
    ref_text="Transcript of the reference audio.",
)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_x86_64.whl (104.3 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_aarch64.whl (104.0 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ ARM64

File details

Details for the file qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 b69107670f0de0d6e57483d42c7c716ec18ad5680d3a97e9a5d4b7e43718ee0d
MD5 370da40c5ecba34cf75a056b17023364
BLAKE2b-256 11f9574dd4c371bb96bbcbbf71cbd8ed45f2b8975501db531322a7e3f771858a

See more details on using hashes here.

Provenance

The following attestation bundles were made for qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_x86_64.whl:

Publisher: publish.yml on andimarafioti/qwentts-cpp-python

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

File details

Details for the file qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 d4449ea502cc213d8ebd589385786da88e6a6c32652a8bfcf66cd8889cd750b2
MD5 d862af10a3124b21516aa5aea0bee0a8
BLAKE2b-256 d5ce7e8c77dac538dec972a0f4556e7fb7edd345e0697b3df8013a286cace624

See more details on using hashes here.

Provenance

The following attestation bundles were made for qwentts_cpp_python-0.2.0-1cu128-py3-none-manylinux_2_39_aarch64.whl:

Publisher: publish.yml on andimarafioti/qwentts-cpp-python

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