feat: add Qwen3-ASR model support (#8118)#9034
feat: add Qwen3-ASR model support (#8118)#9034xut806 wants to merge 2 commits intomodelscope:mainfrom
Conversation
Add support for Qwen/Qwen3-ASR-1.7B and Qwen/Qwen3-ASR-0.6B. Requires qwen-asr package.
There was a problem hiding this comment.
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.
swift/model/models/qwen.py
Outdated
| if qwen_asr is None: | ||
| raise ImportError('qwen-asr package required. Install with: pip install qwen-asr') | ||
| return super().get_config(model_dir) |
There was a problem hiding this comment.
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.
swift/model/models/qwen.py
Outdated
| )) | ||
|
|
||
| try: | ||
| import qwen_asr # noqa: F401 |
There was a problem hiding this comment.
加载放在 get_config 中好了 lazy import
|
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)
|
Done. Moved the import into |
Add support for
Qwen/Qwen3-ASR-1.7BandQwen/Qwen3-ASR-0.6B. Requiresqwen-asrpackage.Closes #8118
Closes #8054
PR type
PR information
Changes (5 files)
swift/model/constant.pyMLLMModelType.qwen3_asrswift/model/model_arch.pyMLLMModelArch.qwen3_asrswift/model/models/qwen.pyQwen3ASRLoader(usesAutoModel+use_submodel_funcfor thinker)swift/template/constant.pyMLLMTemplateType.qwen3_asrswift/template/templates/qwen.pyQwen3ASRTemplatewith audio feature extraction and pad token expansionVerification
qwen_asrimplementationExperiment results
N/A. Registration and template changes only, no model weight modifications.