-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Qwen3-ASR engine with timestamp support and unit tests #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
phonk2682
wants to merge
4
commits into
main
Choose a base branch
from
feature/add_qwen3_asr_engine
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c3fa583
feat: add Qwen3-ASR engine with timestamp support and unit tests
phonk2682 8eb0a5e
update streaming feature for qwen3-asr
phonk2682 d59f7f8
feat: Implement CosyVoice3 TTS engine and add a manual test script fo…
phonk2682 5581b59
fix test error
phonk2682 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| """Qwen3-ASR STT Engine""" | ||
|
|
||
| from app.engines.stt.qwen3asr.config import Qwen3ASRConfig | ||
| from app.engines.stt.qwen3asr.engine import Qwen3ASREngine | ||
|
|
||
| __all__ = ["Qwen3ASRConfig", "Qwen3ASREngine"] |
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||||||||||||||||||||||||||||||||
| """Configuration for Qwen3-ASR STT Engine""" | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| from pydantic import Field, field_validator | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| from app.models.engine import EngineConfig | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| class Qwen3ASRConfig(EngineConfig): | ||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||
| Configuration for Qwen3-ASR STT engine (vLLM backend) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Extends EngineConfig with Qwen3-ASR specific parameters. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Attributes: | ||||||||||||||||||||||||||||||||||||||
| model_name: HuggingFace model ID (Qwen/Qwen3-ASR-1.7B or Qwen/Qwen3-ASR-0.6B) | ||||||||||||||||||||||||||||||||||||||
| dtype: Torch dtype for model loading (bfloat16 recommended) | ||||||||||||||||||||||||||||||||||||||
| gpu_memory_utilization: Fraction of GPU memory to use for vLLM | ||||||||||||||||||||||||||||||||||||||
| max_inference_batch_size: Maximum batch size for inference | ||||||||||||||||||||||||||||||||||||||
| max_new_tokens: Maximum tokens to generate (increase for long audio) | ||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @field_validator("model_name") | ||||||||||||||||||||||||||||||||||||||
| @classmethod | ||||||||||||||||||||||||||||||||||||||
| def validate_model(cls, v: str) -> str: | ||||||||||||||||||||||||||||||||||||||
| """Validate Qwen3-ASR model name""" | ||||||||||||||||||||||||||||||||||||||
| valid = [ | ||||||||||||||||||||||||||||||||||||||
| "Qwen/Qwen3-ASR-1.7B", | ||||||||||||||||||||||||||||||||||||||
| "Qwen/Qwen3-ASR-0.6B", | ||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||
| # Allow local paths | ||||||||||||||||||||||||||||||||||||||
| if v in valid or v.startswith("/") or v.startswith("./"): | ||||||||||||||||||||||||||||||||||||||
| return v | ||||||||||||||||||||||||||||||||||||||
| raise ValueError(f"Qwen3-ASR model must be one of {valid} or a local path") | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # vLLM backend specific fields | ||||||||||||||||||||||||||||||||||||||
| gpu_memory_utilization: float = Field( | ||||||||||||||||||||||||||||||||||||||
| default=0.7, | ||||||||||||||||||||||||||||||||||||||
| ge=0.1, | ||||||||||||||||||||||||||||||||||||||
| le=0.95, | ||||||||||||||||||||||||||||||||||||||
| description="Fraction of GPU memory to use for vLLM", | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
| max_inference_batch_size: int = Field( | ||||||||||||||||||||||||||||||||||||||
| default=32, | ||||||||||||||||||||||||||||||||||||||
| gt=0, | ||||||||||||||||||||||||||||||||||||||
| description="Maximum batch size for inference. -1 for unlimited.", | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
+46
|
||||||||||||||||||||||||||||||||||||||
| gt=0, | |
| description="Maximum batch size for inference. -1 for unlimited.", | |
| ) | |
| ge=-1, | |
| description="Maximum batch size for inference. -1 for unlimited.", | |
| ) | |
| @field_validator("max_inference_batch_size") | |
| @classmethod | |
| def validate_max_inference_batch_size(cls, v: int) -> int: | |
| """ | |
| Ensure max_inference_batch_size is either -1 (for unlimited) or a positive integer. | |
| """ | |
| if v == -1 or v > 0: | |
| return v | |
| raise ValueError( | |
| "max_inference_batch_size must be -1 (for unlimited) or a positive integer" | |
| ) |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The config docstring lists a
dtypeattribute, butQwen3ASRConfigdoesn't define it. Please update the docstring to match the actual fields (or add the field if it’s intended to be supported).