modelscope-funasr这个是啥问题呀?不小心把modelscope下面的模型删了就变成这个样子2024-04-09 18:52:18,079 - modelscope - INFO - initialize model from /mnt/zgl/envs/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch
2024-04-09 18:52:18,081 - modelscope - WARNING - No preprocessor field found in cfg.
2024-04-09 18:52:18,081 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
2024-04-09 18:52:18,081 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '/mnt/zgl/envs/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch'}. trying to build by task and model information.
2024-04-09 18:52:18,081 - modelscope - WARNING - No preprocessor key ('generic-asr', 'auto-speech-recognition') found in PREPROCESSOR_MAP, skip building preprocessor.
根据您提供的日志信息和问题描述,modelscope-funasr
的问题可能与以下情况有关:您在操作过程中不小心删除了 modelscope
下的某些模型文件或配置文件,导致系统无法正确加载预处理器(preprocessor)相关的配置。以下是详细分析和解决方法:
日志中的关键警告信息:
WARNING - No preprocessor field found in cfg.
WARNING - No val key and type key found in preprocessor domain of configuration.json file.
val
和 type
字段,这些字段通常用于定义预处理器的行为。WARNING - Cannot find available config to build preprocessor at mode inference.
WARNING - No preprocessor key ('generic-asr', 'auto-speech-recognition') found in PREPROCESSOR_MAP.
可能的原因:
modelscope
目录下的某些模型文件或配置文件,导致系统无法加载完整的模型结构。configuration.json
)被修改或损坏,导致预处理器相关字段缺失。modelscope
下的模型文件,请重新下载对应的模型文件。ModelScope-FunASR
的代码仓库,并确保模型文件完整:
git clone https://github.com/alibaba-damo-academy/FunASR.git
cd FunASR
pip install -r requirements.txt
pip install funasr[clip]
configuration.json
:模型的配置文件。pytorch_model.bin
或其他权重文件:模型的核心参数。preprocessor_config.json
:预处理器的配置文件。configuration.json
文件,确保其包含以下字段:
{
"model_dir": "/path/to/model",
"preprocessor": {
"val": "value",
"type": "type_value"
}
}
preprocessor
字段缺失,请参考官方文档补充完整配置。在代码中重新初始化模型时,确保路径指向正确的模型目录。例如:
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
model_dir = "/mnt/zgl/envs/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
inference_pipeline = pipeline(task=Tasks.auto_speech_recognition, model=model_dir)
pip list | grep torch
pip list | grep funasr
pip install --upgrade torch torchvision funasr
通过以上步骤,您应该能够解决 modelscope-funasr
的问题并恢复正常运行。如果仍有疑问,请提供更多上下文信息以便进一步分析。