Skip to main content

qwen3-asr-mnn

Qwen3-ASR (0.6B / 1.7B) speech recognition on pure CPU via MNN — no PyTorch, no transformers, no GPU required at runtime.

  • Fast: avg RTF ≈ 0.06 (0.6B) / 0.15 (1.7B) on Apple Silicon — 2.3×–2.6× faster than the HF PyTorch fp32 baseline
  • Accurate: token-identical to the HF fp32 reference on standard samples (CER 0.0000 for 0.6B); remaining 1.7B differences match the official HF bf16 inference
  • Zero-config CLI: models are downloaded automatically from HuggingFace on first use
  • Lightweight: runtime deps are only numpy, soundfile, soxr, huggingface_hub

Models: https://huggingface.co/yunfengwang/Qwen3-ASR-MNN (fp16 weights, exported with MNN llmexport)

Install

pip install qwen3-asr-mnn
# or run directly without installing:
uvx qwen3-asr-mnn audio.wav

Prebuilt native extension: macOS arm64, CPython 3.10–3.13. Other platforms can build from source with native/build_native.sh (requires a local MNN tree).

CLI

qwen3-asr-mnn speech.wav                    # 0.6B (default), auto-download model
qwen3-asr-mnn speech.wav --model 1.7b       # higher accuracy
qwen3-asr-mnn speech.wav --json             # full result (ids, rtf, timing)
qwen3-asr-mnn https://example.com/a.wav     # URL input

Any common sample rate / channel layout is accepted (auto-resampled to 16 kHz mono).

Python API

The engine is loaded once and reused — no repeated initialization cost:

from qwen3_asr_mnn import Qwen3ASR

asr = Qwen3ASR(model="0.6b")        # downloads MNN model on first construction

text = asr.transcribe("a.wav")      # fast, engine already warm
text = asr.transcribe("b.wav")

# details: language, token ids, RTF, encoder/prefill/decode timings
r = asr.transcribe_result("a.wav")
print(r["text"], r["language"], f"RTF={r['rtf']:.3f}")

# numpy waveform input (e.g. streaming)
import numpy as np
wav = np.zeros(16000, dtype=np.float32)
print(asr.transcribe(wav, sample_rate=16000))

# precomputed log-mel [128, T] input
from qwen3_asr_mnn import extract_mel_from
mel, valid = extract_mel_from("a.wav")
print(asr.transcribe_mel(mel, valid)["text"])

Qwen3ASR parameters: model ('0.6b'/'1.7b'), model_dir (local dir or HF repo id; defaults to auto-download), threads (default 8), precision ('low' fp16 math — default, token-identical to 'normal' fp32 math but ~2× faster), max_new_tokens.

How it works

audio ──▶ log-mel (numpy STFT, HF-aligned) ──▶ audio_encoder.mnn (windowed, 104-frame static graph)
      ──▶ prompt splice (text embeddings + audio embeddings) ──▶ llm.mnn (KV-cache, fp16, greedy)
      ──▶ text

The audio encoder uses 8×13=104-frame attention windows with frame-level key masking, mathematically equivalent to HF's packed cu_seqlens attention (max error 0 vs HF in fp32). The LLM decoder is exported with MNN llmexport --quant_bit 16 and driven by the MNN Transformer::Llm C++ engine.

License

Apache-2.0

Release files for qwen3-asr-mnn 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qwen3-asr-mnn 0.1.0
File Size Uploaded
qwen3_asr_mnn-0.1.0.tar.gz 7.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for qwen3-asr-mnn 0.1.0
File Interpreter ABI Platform
qwen3_asr_mnn-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 MB

Release files / qwen3_asr_mnn-0.1.0.tar.gz

Download URL qwen3_asr_mnn-0.1.0.tar.gz
Size 7.3 MB
Tags Source
SHA-256 checksum
How to use checksums
7e52e42af30ce81f801c78074e1b315d1f20adaf5e631c4e8ac0eac8857f0176
BLAKE2b-256 checksum
How to use checksums
e8d442f6b9601596ee82174ce4487dd6af8787978b5a54f5ced074c1b3f61834
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / qwen3_asr_mnn-0.1.0-py3-none-any.whl

Download URL qwen3_asr_mnn-0.1.0-py3-none-any.whl
Size 7.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fe1adc977e8d2e0a73f214a7d6b09eb79292806191a169cad7d69b7c6949bded
BLAKE2b-256 checksum
How to use checksums
1ce79e4069310ef4cef86be7904d6d53603a9567b22ad834d18f4a45ac6707d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page