Skip to main content

Production toolkit around Qwen3-ForcedAligner: VAD pre-segmentation, multi-language word/char-level alignment, and speaker diarization.

Project description

qwen-aligner-toolkit

Production toolkit around Qwen3-ForcedAligner: VAD pre-segmentation, multi-language word/char-level forced alignment, and speaker diarization.

Why

qwen-asr ships an excellent forced aligner (Qwen3-ForcedAligner-0.6B) that handles multiple languages with one model — no per-language wav2vec2 needed, no kanji vocab gaps. This toolkit packages it with the surrounding pieces you typically need in production:

  • VAD (pyannote/segmentation-3.0) to chunk long audio
  • Diarization (pyannote/speaker-diarization-community-1) with per-word speaker assignment and run smoothing
  • Audio utilities (path / URL / bytes / np.ndarray → 16 kHz mono)
  • AVX-less CPU compatibility via a nagisa char-level stub

The toolkit does not do ASR. Bring your own transcript (from Whisper via vLLM, faster-whisper, qwen-asr itself, or any other system) and the toolkit will time-align it and label speakers.

Install

pip install qwen-aligner-toolkit
pip install qwen-aligner-toolkit[full]    # with VAD + diarization

Usage

Simple alignment (short audio)

from qwen_aligner_toolkit import Aligner

aligner = Aligner.from_pretrained()
words = aligner.align(
    text="甚至出现交易几乎停滞的情况。",
    audio="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-ASR-Repo/asr_zh.wav",
    language="Chinese",
)
for w in words:
    print(w.start_time, w.end_time, w.text)

ASR segments → word-level + speakers

from qwen_aligner_toolkit import Pipeline

pipeline = Pipeline.from_pretrained(hf_token="hf_...", device="cuda")

segments = [
    {"text": "おはようございます。", "start": 0.0, "end": 2.3},
    {"text": "今日は良い天気ですね。", "start": 2.3, "end": 5.1},
]

result = pipeline.align_segments(
    segments=segments,
    audio="audio.wav",
    language="Japanese",
    diarize=True,
)

for w in result.words:
    print(f"{w.start_time:.2f}-{w.end_time:.2f} [{w.speaker}] {w.text}")

VAD only

from qwen_aligner_toolkit import VAD

vad = VAD.from_pretrained(hf_token="hf_...")
chunks = vad.detect("audio.wav")

CPU compatibility (AVX requirement)

qwen-asr depends on nagisa, which ships DyNet38 compiled with AVX. On AVX-less CPUs (Intel Celeron G-series, some embedded SoCs), importing nagisa crashes with SIGILL.

If that affects you, install the char-level stub:

qwen-aligner-toolkit install-nagisa-stub
# or
python -m qwen_aligner_toolkit.compat install-stub

This downgrades Japanese tokenization from morpheme-level to character-level (other languages are unaffected). For forced alignment the difference is mostly cosmetic; speaker boundaries may even be detected at finer granularity.

For Docker:

RUN pip install qwen-aligner-toolkit && \
    qwen-aligner-toolkit install-nagisa-stub

License

Apache 2.0. See 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

qwen_aligner_toolkit-0.1.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

qwen_aligner_toolkit-0.1.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file qwen_aligner_toolkit-0.1.1.tar.gz.

File metadata

  • Download URL: qwen_aligner_toolkit-0.1.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qwen_aligner_toolkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2dd45bc637432f62f33950ef1f645e313ee4e8358beec39bc9dd2e33352e3cdc
MD5 7218d5f6f1f07f7f78f2b69a7d2f7fc6
BLAKE2b-256 e53b2d21248aa1a33e5cff86d56bd21cd2fbb3599351c3dda79f3229a195a74e

See more details on using hashes here.

Provenance

The following attestation bundles were made for qwen_aligner_toolkit-0.1.1.tar.gz:

Publisher: publish.yml on Anes1032/qwen-aligner-toolkit

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

File details

Details for the file qwen_aligner_toolkit-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for qwen_aligner_toolkit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a052d5ee94011ced532eeeb6d3a3ad1412904fd215038b0aba9368d17a9fa09e
MD5 a666923a3750e241cf2546a919cd8142
BLAKE2b-256 30d763a58cb38719a8dcb76de7daac1d7ddc0821cb24b4c62eb4a396132e8c91

See more details on using hashes here.

Provenance

The following attestation bundles were made for qwen_aligner_toolkit-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Anes1032/qwen-aligner-toolkit

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