FunAudioLLM / SenseVoice

Multilingual Voice Understanding Model
https://funaudiollm.github.io/
Other
3.53k stars 318 forks source link

能否解释一下案例当中的 remote_code 是如何用的 #73

Closed aboutmydreams closed 3 months ago

aboutmydreams commented 4 months ago

❓ 能否解释一下案例当中的 remote_code 是如何用的

What is your question?

Code

from funasr import AutoModel
from funasr.utils.postprocess_utils import rich_transcription_postprocess

model_dir = "iic/SenseVoiceSmall"

model = AutoModel(
    model=model_dir,
    trust_remote_code=True,
    # remote_code="./model.py", <-- this line
    vad_model="fsmn-vad",
    vad_kwargs={"max_single_segment_time": 30000},
    device="cuda:0",
)

# en
res = model.generate(
    input=f"{model.model_path}/example/zh.mp3",
    cache={},
    language="auto",  # "zn", "en", "yue", "ja", "ko", "nospeech"
    use_itn=True,
    batch_size_s=60,
    merge_vad=True,  #
    merge_length_s=15,
)
text = rich_transcription_postprocess(res[0]["text"])
print(text)
print(model.model_path)

每次都会输出

Loading remote code failed: model, No module named 'model'

What have you tried?

What's your environment?

LauraGPT commented 4 months ago

Please ref to readme.md

aboutmydreams commented 3 months ago

Please ref to readme.md

I've certainly read it, but I still think this part is missing from the readme, and that it would appear by default in the example

LauraGPT commented 3 months ago

Please ref to readme.md

I've certainly read it, but I still think this part is missing from the readme, and that it would appear by default in the example

Ref to code: https://github.com/modelscope/FunASR/blob/main/funasr/download/download_model_from_hub.py#L87