Skip to content

Adds push-based incremental streaming API with CLI flag and regression test#4

Open
Tunji17 wants to merge 1 commit intoantirez:mainfrom
Tunji17:main
Open

Adds push-based incremental streaming API with CLI flag and regression test#4
Tunji17 wants to merge 1 commit intoantirez:mainfrom
Tunji17:main

Conversation

@Tunji17
Copy link
Copy Markdown

@Tunji17 Tunji17 commented Feb 16, 2026

The existing streaming entry points (qwen_transcribe_stream and qwen_transcribe_stream_live) are blocking calls, the caller hands over audio (or a stdin thread) and waits until transcription finishes. This makes integration difficult for any application that manages its own event loop, audio capture pipeline, or needs to interleave ASR with other work.

The only way to get incremental tokens is through a callback fired deep inside a function the caller cannot return from. This PR adds new APIs to give control to the caller. The caller owns the loop, push audio when it arrives, pull decoded tokens, and finish.

Changes

  • qwen_asr.h / qwen_asr.c: Six new public functions (qwen_stream_init, feed, get, finish, free, set_interval) backed by an opaque qwen_stream_t struct, a circular token queue, and a stream_process_chunk() core that mirrors the existing stream_impl() loop body with the same encoder cache, sliding-window eviction, prefill reuse, prefix rollback, and
    delta-based commit logic.
  • main.c: --stream-push CLI flag that exercises the full init→feed→get→finish→free lifecycle on a WAV file.
  • asr_regression.py: stream-push-check comparing --stream-push output against the reference transcript, runnable standalone (--stream-push-check-only) or as part of the default suite.

Test

./asr_regression.py --stream-push-check-only --binary ./qwen_asr --model-dir qwen3-asr-1.7b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant