How antirez/qwen-asr works
Qwen3-ASR Pure C is a local speech-to-text inference engine with CPU, optional CUDA, and optional ROCm execution. The primary workflow is audio input through normalization and log-mel features, audio encoding, language-model decoding, and token-to-text output. The API also coordinates offline segmentation and streaming with rollback, while the CLI exposes language and prompt controls. The README documents GPU acceleration and monitoring features beyond the sampled excerpts; their internal wiring is not fully visible, so uncertain backend links are marked optional.
Main entry points: qwen_asr.c Inference orchestration · qwen_asr_kernels.c Math kernels · qwen_asr_audio.c Audio input and resampling · qwen_asr_encoder.c Audio encoder
Components 16
CLI and API
- CLI
main.c - Inference orchestration
qwen_asr.c
Audio preparation
- Audio input and resampling
qwen_asr_audio.c - Log-mel features
qwen_asr_audio.c
Model inference
- Audio encoder
qwen_asr_encoder.c - Autoregressive decoder
qwen_asr_decoder.c - BPE tokenizer
qwen_asr_tokenizer.c
Runtime support
- Safetensors weights
qwen_asr_safetensors.c - Math kernels
qwen_asr_kernels.c - CPU SIMD kernels
qwen_asr_kernels_avx.c - NEON kernels
qwen_asr_kernels_neon.c - Generic kernels
qwen_asr_kernels_generic.c - CUDA backend
qwen_asr_cuda.cu - ROCm backend
qwen_asr_rocm.hip
Other components
- User / audio source
- Transcript / stdout
Connections 18
- User / audio source → CLI: provides audio
README.md - CLI → Inference orchestration: starts inference
README.md - Inference orchestration → Audio input and resampling: loads audio
qwen_asr.c - Audio input and resampling → Log-mel features: computes features
qwen_asr_audio.c - Inference orchestration → Audio encoder: runs encoder
qwen_asr.c - Inference orchestration → Autoregressive decoder: runs decode
qwen_asr.c - Inference orchestration → BPE tokenizer: uses tokens
qwen_asr.c - Audio encoder → Safetensors weights: loads parameters
qwen_asr_encoder.c - Autoregressive decoder → Safetensors weights: loads parameters
qwen_asr_decoder.c - Audio encoder → Math kernels: uses math ops
qwen_asr_encoder.c - Autoregressive decoder → Math kernels: uses math ops
qwen_asr_decoder.c - Audio input and resampling → Math kernels: uses math ops
qwen_asr_audio.c - Math kernels → CPU SIMD kernels: dispatches SIMD
- Math kernels → NEON kernels: dispatches NEON
- Math kernels → Generic kernels: dispatches fallback
- Inference orchestration → CUDA backend: optional acceleration
README.md - Inference orchestration → ROCm backend: optional acceleration
README.md - Inference orchestration → Transcript / stdout: emits text
README.md