FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

使用 nuitka 编译的程序打包运行时出错: AssertionError: ContextualParaformer is not registered

Open kanslor opened this issue 1 year ago • 0 comments

Notice: In order to resolve issues more efficiently, please raise issue following the template. (注意:为了更加高效率解决您遇到的问题,请按照模板提问,补充细节)

❓ Questions and Help

代码在python环节中运行没有问题,我使用nuitka 打包了包含有funasr的程序,编译完成后,我自行导入了部分缺失的组件,在运行编译完成的程序时出现以下错误提示。请问我是缺失了什么必要的组件吗?

Traceback (most recent call last):
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/utils/registry.py", line 210, in build_from_cfg
    return obj_cls._instantiate(**args)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/models/base/base_model.py", line 67, in _instantiate
    return cls(**kwargs)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/models/audio/funasr/model.py", line 55, in __init__
    self.model = AutoModel(model=model_dir, **kwargs)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/funasr/auto/auto_model.py", line 124, in __init__
    model, kwargs = self.build_model(**kwargs)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/funasr/auto/auto_model.py", line 218, in build_model
    assert model_class is not None, f'{kwargs["model"]} is not registered'
AssertionError: ContextualParaformer is not registered

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/utils/registry.py", line 212, in build_from_cfg
    return obj_cls(**args)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/pipelines/audio/funasr_pipeline.py", line 62, in __init__
    super().__init__(model=model, **kwargs)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/pipelines/base.py", line 100, in __init__
    self.model = self.initiate_single_model(model, **kwargs)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/pipelines/base.py", line 53, in initiate_single_model
    return Model.from_pretrained(
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/models/base/base_model.py", line 183, in from_pretrained
    model = build_model(model_cfg, task_name=task_name)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/models/builder.py", line 35, in build_model
    model = build_from_cfg(
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/utils/registry.py", line 215, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
AssertionError: GenericFunASR: ContextualParaformer is not registered

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/voice_tts_service.py", line 49, in <module>
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/pipelines/builder.py", line 170, in pipeline
    return build_pipeline(cfg, task_name=task)
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/pipelines/builder.py", line 65, in build_pipeline
    return build_from_cfg(
  File "/home/isoface/chatgpt/gpt_bot/voice_tts_service/voice_tts_service.dist/modelscope/utils/registry.py", line 215, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
AssertionError: FunASRPipeline: GenericFunASR: ContextualParaformer is not registered

Before asking:

  1. search the issues.
  2. search the docs.

What is your question?

Code

from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=RECOGNITION_MODEL,
    vad_model= VAD_MODEL,
    vad_model_revision = VAD_MODEL_REVISION,
    punc_model = PUNC_MODEL
)
...

What have you tried?

What's your environment?

  • OS (Debian 12):

  • Python Packages:

    funasr==1.0.30
    matplotlib==3.7.2
    modelscope==1.15.0
    Nuitka==2.3.10
    opencc-python-reimplemented==0.1.7
    pydub==0.25.1
    pytorch_wavelets==1.3.0
    tensorboardX==2.6.2.2
    torch==2.2.2
    torchaudio==2.2.2
    
  • How you installed funasr (pip):

  • Python version: 3.8.19

kanslor avatar Jul 01 '24 09:07 kanslor