Skip to content

feat: add Qwen3-ASR model support (#8118)#9034

Open
xut806 wants to merge 2 commits intomodelscope:mainfrom
xut806:feat/qwen3-asr-support
Open

feat: add Qwen3-ASR model support (#8118)#9034
xut806 wants to merge 2 commits intomodelscope:mainfrom
xut806:feat/qwen3-asr-support

Conversation

@xut806
Copy link
Copy Markdown

@xut806 xut806 commented Apr 7, 2026

Add support for Qwen/Qwen3-ASR-1.7B and Qwen/Qwen3-ASR-0.6B. Requires qwen-asr package.

Closes #8118
Closes #8054

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Changes (5 files)

  • swift/model/constant.py

    • Add MLLMModelType.qwen3_asr
  • swift/model/model_arch.py

    • Add MLLMModelArch.qwen3_asr
    • Register architecture (language_model, audio_tower, proj1/proj2 aligner)
  • swift/model/models/qwen.py

    • Add Qwen3ASRLoader (uses AutoModel + use_submodel_func for thinker)
    • Register Qwen3-ASR models
  • swift/template/constant.py

    • Add MLLMTemplateType.qwen3_asr
  • swift/template/templates/qwen.py

    • Add Qwen3ASRTemplate with audio feature extraction and pad token expansion

Verification

  • Verified model registration loads correctly
  • Verified SFT training with Qwen/Qwen3-ASR-0.6B and Qwen/Qwen3-ASR-1.7B using LoRA
  • Verified audio feature extraction and pad token expansion produces correct sequence lengths matching the official qwen_asr implementation

Experiment results

N/A. Registration and template changes only, no model weight modifications.

Add support for Qwen/Qwen3-ASR-1.7B and Qwen/Qwen3-ASR-0.6B.
Requires qwen-asr package.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the Qwen3-ASR model by adding model registration, architecture definitions, and a dedicated template for audio processing. A review comment suggests removing a redundant dependency check in the model loader, as the requirement is already handled by the model registration metadata.

Comment on lines +1472 to +1474
if qwen_asr is None:
raise ImportError('qwen-asr package required. Install with: pip install qwen-asr')
return super().get_config(model_dir)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The get_config method raises an ImportError if qwen-asr is not installed. However, this check is redundant because the register_model call already specifies requires=['qwen-asr'], which should handle the dependency check during model registration. It is better to rely on the requires mechanism to enforce dependencies.

))

try:
import qwen_asr # noqa: F401
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加载放在 get_config 中好了 lazy import

@Jintao-Huang
Copy link
Copy Markdown
Collaborator

please run

pip install pre-commit
pre-commit run --all-files

- Move qwen_asr import into get_config (lazy import)
- Remove redundant module-level import and dependency check
- Fix formatting per pre-commit (yapf)
@xut806
Copy link
Copy Markdown
Author

xut806 commented Apr 8, 2026

Done. Moved the import into get_config as lazy import and ran pre-commit run --all-files (all checks pass). Thanks for the review.

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.

支持Qwen3-ASR系列 是否有计划支持Qwen3-ASR

2 participants