FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

怎么才能调用本地下载好的模型,而不是通过 hf 或者 ms 联网搜索?

Open piwawa opened this issue 1 year ago • 4 comments

image

我已经通过 hf 参数自动下载过一次模型了,但是每次运行以下代码还会联网 download 一次,能不能直接指定文件路径不调用下载?

这样传入参数每次都报错!

        self.model = AutoModel(
            model = ”/home/111/.cache/huggingface/hub/models--FunAudioLLM--SenseVoiceSmall“,
            # vad_model = vad_model,
            # vad_kwargs=vad_kwargs,
            device = device,
            disable_update = disable_update
        )
[111@zernithos]$ python asr.py
funasr version: 1.1.6.
Traceback (most recent call last):
  File "asr.py", line 29, in <module>
    asr = Fun_ASR()
  File "asr.py", line 6, in __init__
    self.model = AutoModel(
  File "/home/111/miniconda3/envs/hw5/lib/python3.10/site-packages/funasr/auto/auto_model.py", line 124, in __init__
    model, kwargs = self.build_model(**kwargs)
  File "/home/111/miniconda3/envs/hw5/lib/python3.10/site-packages/funasr/auto/auto_model.py", line 218, in build_model
    assert model_class is not None, f'{kwargs["model"]} is not registered'
AssertionError: /home/111/.cache/huggingface/hub/models--FunAudioLLM--SenseVoiceSmall is not registered

piwawa avatar Dec 31 '24 11:12 piwawa

同问,无论怎么写都报错not registered,我寻思没用什么新模型就不需要“注册”吧

gasdyueer avatar Feb 16 '25 11:02 gasdyueer

模型路径要直接到最里面的文件夹

37llll avatar Mar 14 '25 02:03 37llll

路径要写到那一串数字为止(config.yaml所在的文件夹)

imxtx avatar Apr 14 '25 05:04 imxtx

路径要写到那一串数字为止(config.yaml所在的文件夹)

大大此法是正解! e.g.

    speech_model = AutoModel(
        model= "/storage/models_huggingface/hub/models--FunAudioLLM--SenseVoiceSmall/snapshots/3eb3b4eeffc2f2dde6051b853983753db33e35c3",
        vad_model= "/storage/models_huggingface/hub/models--funasr--fsmn-vad/snapshots/931934ce7cbdde9388932e64efa25b52ccdb14c0",
        vad_kwargs={"max_single_segment_time": 30000, "hub": "hf"},
        device=device,
        disable_pbar=True,
        disable_log=True,
        disable_update=True,
        hub="hf",
    )

joytsay avatar Aug 29 '25 07:08 joytsay