FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

无法加载Qwen/Qwen-Audio

Open dadapaopaotangabc opened this issue 7 months ago • 1 comments

macbook pro m4,Python 3.11 ,funasr 1.2.6

from funasr import AutoModel

model = AutoModel(model="Qwen/Qwen2-Audio-7B")

audio_in = "/Users/hello/voice/output_000.mp3" prompt = "<|startoftranscription|><|en|><|transcribe|><|en|><|notimestamps|><|wo_itn|>"

res = model.generate(input=audio_in, prompt=prompt) print(res)

提示AssertionError: Qwen-Audio is not registered,

我通过这个代码查看funasr 1.2.6版本中貌似没注册这个模型, from funasr.register import tables tables.print() 输出 model_classes 中的确没有Qwen Audio

如果需要手工注册下,如何注册?

dadapaopaotangabc avatar Apr 14 '25 05:04 dadapaopaotangabc

遇到相同的问题,Windows10 Python3.9 Funasr 1.2.6 (D:\asr\fun_asr) D:\asr>funasr ++model=Qwen-Audio ++vad_model="fsmn-vad" ++punc_model="ct-punc" ++input=input.wav funasr version: 1.2.6. Check update of funasr, and it would cost few times. You may disable it by set disable_update=True in AutoModel You are using the latest version of funasr-1.2.6 [2025-04-24 16:23:10,629][root][INFO] - download models from model hub: ms Downloading Model from https://www.modelscope.cn to directory: C:\Users\AI.cache\modelscope\hub\models\Qwen\Qwen-Audio 2025-04-24 16:23:11,394 - modelscope - WARNING - Using branch: master as version is unstable, use with caution Error executing job with overrides: ['++model=Qwen-Audio', '++vad_model=fsmn-vad', '++punc_model=ct-punc', '++input=input.wav'] Traceback (most recent call last): File "D:\asr\fun_asr\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\asr\fun_asr\lib\runpy.py", line 87, in run_code exec(code, run_globals) File "D:\asr\fun_asr\Scripts\funasr.exe_main.py", line 7, in File "D:\asr\fun_asr\lib\site-packages\hydra\main.py", line 94, in decorated_main _run_hydra( File "D:\asr\fun_asr\lib\site-packages\hydra_internal\utils.py", line 394, in _run_hydra _run_app( File "D:\asr\fun_asr\lib\site-packages\hydra_internal\utils.py", line 457, in _run_app run_and_report( File "D:\asr\fun_asr\lib\site-packages\hydra_internal\utils.py", line 223, in run_and_report raise ex File "D:\asr\fun_asr\lib\site-packages\hydra_internal\utils.py", line 220, in run_and_report return func() File "D:\asr\fun_asr\lib\site-packages\hydra_internal\utils.py", line 458, in lambda: hydra.run( File "D:\asr\fun_asr\lib\site-packages\hydra_internal\hydra.py", line 132, in run _ = ret.return_value File "D:\asr\fun_asr\lib\site-packages\hydra\core\utils.py", line 260, in return_value raise self._return_value File "D:\asr\fun_asr\lib\site-packages\hydra\core\utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) File "D:\asr\fun_asr\lib\site-packages\funasr\bin\inference.py", line 24, in main_hydra model = AutoModel(**kwargs) File "D:\asr\fun_asr\lib\site-packages\funasr\auto\auto_model.py", line 125, in init model, kwargs = self.build_model(**kwargs) File "D:\asr\fun_asr\lib\site-packages\funasr\auto\auto_model.py", line 261, in build_model assert model_class is not None, f'{kwargs["model"]} is not registered' AssertionError: Qwen-Audio is not registered

vmosone007 avatar Apr 24 '25 08:04 vmosone007

可以看一下他们源码里面的这一段。

Image 要import所有module,把相关的模型注册到table中,初始化的时候从table中取。如果import失败了就没注册上,就会找不到。他们的main分支上很大一片模型都没有注册上。代码挺水的。。。。。。。。 Image

这些文件压根就没在 项目中,还在那里import。无了个大语

nopipifish avatar Apr 29 '25 10:04 nopipifish

1.2.6版本,同样问题,根据楼上的建议,打开了funasr/init.py里的打印,发现有 Failed to import funasr.models.qwen_audio.model: No module named 'whisper'这样一行。进入到funasr.models.qwen_audio.model中,有一行import whisper,看起来是想导入models下的whisper模块,但是由于路径问题导入失败。这行改成from .. import whisper后运行起来了,但由于硬件不足,有其他报错,故暂未有最终结果验证。

gaylong9 avatar Jun 03 '25 03:06 gaylong9

1.2.6版本,同样问题,根据楼上的建议,打开了funasr/init.py里的打印,发现有 Failed to import funasr.models.qwen_audio.model: No module named 'whisper'这样一行。进入到funasr.models.qwen_audio.model中,有一行import whisper,看起来是想导入models下的whisper模块,但是由于路径问题导入失败。这行改成from .. import whisper后运行起来了,但由于硬件不足,有其他报错,故暂未有最终结果验证。

可行

gaylong9 avatar Jun 03 '25 09:06 gaylong9