Adds push-based incremental streaming API with CLI flag and regression test#4
Open
Tunji17 wants to merge 1 commit intoantirez:mainfrom
Open
Adds push-based incremental streaming API with CLI flag and regression test#4Tunji17 wants to merge 1 commit intoantirez:mainfrom
Tunji17 wants to merge 1 commit intoantirez:mainfrom
Conversation
… and regression test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, anddelta-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