RVC-Boss / GPT-SoVITS

1 min voice data can also be used to train a good TTS model! (few shot voice cloning)
MIT License
34.23k stars 3.93k forks source link

modelscope和funasr的版本 #194

Closed ChrisGitHubIcon closed 8 months ago

ChrisGitHubIcon commented 8 months ago

这个版本的代码和哪个版本的modelscope和funasr适配?一直在start batch ASR环节各种报错,尝试了几次不同的版本,报错的花样也层出不穷。。。

Leon-Lulu commented 8 months ago

Same here, looks like "tables.model_classes" doesn't have a key named "FsmnVAD". Instead, there is a key named "FsmnVADStreaming".

Hardwell99 commented 8 months ago

我的版本 modelscope=1.10.0 funasr=0.8.7

cugb1004101218 commented 8 months ago

asr-cmd.py第25行改成即可: text = inference_pipeline(input="%s/%s"%(dir,name))[0]["text"]

ChrisGitHubIcon commented 8 months ago

in questions closed, I saw a similar question, will try those methods first, will update here later

ChrisGitHubIcon commented 8 months ago

我的版本 modelscope=1.10.0 funasr=0.8.7

我尝试这个版本报错是funasr-pipeline is not in the pipelines registry group auto-speech-recognition 要使用正确版本的modelscope library

cugb1004101218 commented 8 months ago

我的版本 modelscope=1.10.0 funasr=0.8.7

我尝试这个版本报错是funasr-pipeline is not in the pipelines registry group auto-speech-recognition 要使用正确版本的modelscope library

不用这个版本,你就用最新的就行,那一行改成我写的就行。

ChrisGitHubIcon commented 8 months ago

我的版本 modelscope=1.10.0 funasr=0.8.7

我尝试这个版本报错是funasr-pipeline is not in the pipelines registry group auto-speech-recognition 要使用正确版本的modelscope library

不用这个版本,你就用最新的就行,那一行改成我写的就行。

版本都升级到最新,modelscope 1.11.1,funasr 1.0.2 更改了input[0],报错__pickle invalid load key, 'v'

Leon-Lulu commented 8 months ago

我的版本 modelscope=1.10.0 funasr=0.8.7

我尝试这个版本报错是funasr-pipeline is not in the pipelines registry group auto-speech-recognition 要使用正确版本的modelscope library

不用这个版本,你就用最新的就行,那一行改成我写的就行。

Same, doesn't change the fact that "FsmnVAD" is not a key in "tables.model_classes"

runningto commented 8 months ago

被这玩意折磨了好几天

runningto commented 8 months ago

asr-cmd.py第25行改成即可: text = inference_pipeline(input="%s/%s"%(dir,name))[0]["text"]

仍然报错

LauraGPT commented 8 months ago

Solution 1.

modelscope-1.10.0, funasr-0.8.7/0.8.8

In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error!

Solution 2.

modelscope-1.11.1, funasr-1.0.3 (recommand)

In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git
git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git
git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
# the mode of `ct-transformer-large` is better, and support `English` and `Chinese`
# git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py):

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr, model_revision="v2.0.4",
    vad_model=path_vad, vad_model_revision="v2.0.4",
    punc_model=path_punc, punc_model_revision="v2.0.4",
)

and the audio_in -> input and [0]:

text = inference_pipeline(input="%s/%s"%(dir,name))[0]["text"]

Solution 3.

But I suggest to merge the pr and re-download the models by pipeline (automatically): https://github.com/RVC-Boss/GPT-SoVITS/pull/135

If it still runs with error, please raise a issue in : https://github.com/alibaba-damo-academy/FunASR We would fix it.

runningto commented 8 months ago

Thank you very much!i just download the model by git clone , but i can't find funasr-1.10.3. i use funasr-1.0.3 and modelscope-1.11.1, surprise mothor fucker ,Success! I've been tortured by this for several days, thank you again,love you 么么

------------------ 原始邮件 ------------------ 发件人: "RVC-Boss/GPT-SoVITS" @.>; 发送时间: 2024年1月25日(星期四) 晚上9:18 @.>; @.**@.>; 主题: Re: [RVC-Boss/GPT-SoVITS] modelscope和funasr的版本 (Issue #194)

Solution:

modelscope-1.10.0, funasr-0.8.7/0.8.8 In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error!

modelscope-1.11.1, funasr-1.10.3 (recommand) In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git # the mode of ct-transformer-large is better, and support English and Chinese # git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py): inference_pipeline = pipeline( task=Tasks.auto_speech_recognition, model=path_asr, model_revision="v2.0.4", vad_model=path_vad, vad_model_revision="v2.0.4", punc_model=path_punc, punc_model_revision="v2.0.4", )

and the audio_in -> input: text = inference_pipeline(input="%s/%s"%(dir,name))["text"]

But I suggest to merge the pr and re-download the models by pipeline (automatically): #135

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

LauraGPT commented 8 months ago

Thank you very much!i just download the model by git clone , but i can't find funasr-1.10.3. i use funasr-1.0.3 and modelscope-1.11.1, surprise mothor fucker ,Success! I've been tortured by this for several days, thank you again,love you 么么 ------------------ 原始邮件 ------------------ 发件人: "RVC-Boss/GPT-SoVITS" @.>; 发送时间: 2024年1月25日(星期四) 晚上9:18 @.>; @.**@.>; 主题: Re: [RVC-Boss/GPT-SoVITS] modelscope和funasr的版本 (Issue #194) Solution: modelscope-1.10.0, funasr-0.8.7/0.8.8 In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error! modelscope-1.11.1, funasr-1.10.3 (recommand) In the case, you should download the models by git clone: git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git # the mode of ct-transformer-large is better, and support English and Chinese # git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py): inference_pipeline = pipeline( task=Tasks.auto_speech_recognition, model=path_asr, model_revision="v2.0.4", vad_model=path_vad, vad_model_revision="v2.0.4", punc_model=path_punc, punc_model_revision="v2.0.4", ) and the audio_in -> input: text = inference_pipeline(input="%s/%s"%(dir,name))["text"] But I suggest to merge the pr and re-download the models by pipeline (automatically): #135 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

You could install funasr-1.0.3 by pypi: https://pypi.org/project/funasr/

pip install -U modelscope==1.11.1 funasr==1.0.3 -i https://pypi.org/simple
ChrisGitHubIcon commented 8 months ago

Solution 1.

modelscope-1.10.0, funasr-0.8.7/0.8.8

In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error!

Solution 2.

modelscope-1.11.1, funasr-1.10.3 (recommand)

In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git
git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git
git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
# the mode of `ct-transformer-large` is better, and support `English` and `Chinese`
# git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py):

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr, model_revision="v2.0.4",
    vad_model=path_vad, vad_model_revision="v2.0.4",
    punc_model=path_punc, punc_model_revision="v2.0.4",
)

and the audio_in -> input:

text = inference_pipeline(input="%s/%s"%(dir,name))["text"]

Solution 3.

But I suggest to merge the pr and re-download the models by pipeline (automatically): #135

If it still runs with error, please raise a issue in : https://github.com/alibaba-damo-academy/FunASR We would fix it.

Thanks a lot for such detailed reply. Tried 2nd resolution, still have error as __pickle invalid load key 'v'

all my damo models are deployed by git only will try resolution1 and let pipeline download itself and see

LauraGPT commented 8 months ago

Solution 1. modelscope-1.10.0, funasr-0.8.7/0.8.8 In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error! Solution 2. modelscope-1.11.1, funasr-1.0.3 (recommand) In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git
git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git
git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
# the mode of `ct-transformer-large` is better, and support `English` and `Chinese`
# git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py):

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr, model_revision="v2.0.4",
    vad_model=path_vad, vad_model_revision="v2.0.4",
    punc_model=path_punc, punc_model_revision="v2.0.4",
)

and the audio_in -> input:

text = inference_pipeline(input="%s/%s"%(dir,name))["text"]

Solution 3. But I suggest to merge the pr and re-download the models by pipeline (automatically): #135 If it still runs with error, please raise a issue in : https://github.com/alibaba-damo-academy/FunASR We would fix it.

Thanks a lot for such detailed reply. Tried 2nd resolution, still have error as __pickle invalid load key 'v'

all my damo models are deployed by git only will try resolution1 and let pipeline download itself and see

It may because the models you git clone is old version. If you re-download them by git clone, it will works. And sorry, I have made a mistake, right version is funasr-1.0.3, not the funasr-1.10.3

ChrisGitHubIcon commented 8 months ago

Solution 1. modelscope-1.10.0, funasr-0.8.7/0.8.8 In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error! Solution 2. modelscope-1.11.1, funasr-1.0.3 (recommand) In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git
git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git
git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
# the mode of `ct-transformer-large` is better, and support `English` and `Chinese`
# git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py):

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr, model_revision="v2.0.4",
    vad_model=path_vad, vad_model_revision="v2.0.4",
    punc_model=path_punc, punc_model_revision="v2.0.4",
)

and the audio_in -> input:

text = inference_pipeline(input="%s/%s"%(dir,name))["text"]

Solution 3. But I suggest to merge the pr and re-download the models by pipeline (automatically): #135 If it still runs with error, please raise a issue in : https://github.com/alibaba-damo-academy/FunASR We would fix it.

Thanks a lot for such detailed reply. Tried 2nd resolution, still have error as __pickle invalid load key 'v' all my damo models are deployed by git only will try resolution1 and let pipeline download itself and see

It may because the models you git clone is old version. If you re-download them by git clone, it will works. And sorry, I have made a mistake, right version is funasr-1.0.3, not the funasr-1.10.3

Thanks for re-clarification. I tried resolution2 again for re-git clone from your address for latest models. But unfortunately the pickle error invalid load key 'v' kept coming again and again no matter I modify the cmd-asr.py or not I can not figure out the what exactly pickle error is. It just comes up after TOKENIZER_CLASSES/SentencepiecesTokenizer, and seems some problems with site-packages/modelscope/utils/registry.py I am using linux server to build this service and operate from local machine WIN. Sliced audio resource is put in server GPT-SoVITS/output/slicer_opt. Is it possible this problem is about resource route format? Light me up please.

LauraGPT commented 8 months ago

Solution 1. modelscope-1.10.0, funasr-0.8.7/0.8.8 In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error! Solution 2. modelscope-1.11.1, funasr-1.0.3 (recommand) In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git
git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git
git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
# the mode of `ct-transformer-large` is better, and support `English` and `Chinese`
# git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py):

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr, model_revision="v2.0.4",
    vad_model=path_vad, vad_model_revision="v2.0.4",
    punc_model=path_punc, punc_model_revision="v2.0.4",
)

and the audio_in -> input:

text = inference_pipeline(input="%s/%s"%(dir,name))["text"]

Solution 3. But I suggest to merge the pr and re-download the models by pipeline (automatically): #135 If it still runs with error, please raise a issue in : https://github.com/alibaba-damo-academy/FunASR We would fix it.

Thanks a lot for such detailed reply. Tried 2nd resolution, still have error as __pickle invalid load key 'v' all my damo models are deployed by git only will try resolution1 and let pipeline download itself and see

It may because the models you git clone is old version. If you re-download them by git clone, it will works. And sorry, I have made a mistake, right version is funasr-1.0.3, not the funasr-1.10.3

Thanks for re-clarification. I tried resolution2 again for re-git clone from your address for latest models. But unfortunately the pickle error invalid load key 'v' kept coming again and again no matter I modify the cmd-asr.py or not I can not figure out the what exactly pickle error is. It just comes up after TOKENIZER_CLASSES/SentencepiecesTokenizer, and seems some problems with site-packages/modelscope/utils/registry.py I am using linux server to build this service and operate from local machine WIN. Sliced audio resource is put in server GPT-SoVITS/output/slicer_opt. Is it possible this problem is about resource route format? Light me up please.

OK, I will test it on WIN

LauraGPT commented 8 months ago

Solution 1. modelscope-1.10.0, funasr-0.8.7/0.8.8 In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error! Solution 2. modelscope-1.11.1, funasr-1.0.3 (recommand) In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git
git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git
git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
# the mode of `ct-transformer-large` is better, and support `English` and `Chinese`
# git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py):

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr, model_revision="v2.0.4",
    vad_model=path_vad, vad_model_revision="v2.0.4",
    punc_model=path_punc, punc_model_revision="v2.0.4",
)

and the audio_in -> input:

text = inference_pipeline(input="%s/%s"%(dir,name))["text"]

Solution 3. But I suggest to merge the pr and re-download the models by pipeline (automatically): #135 If it still runs with error, please raise a issue in : https://github.com/alibaba-damo-academy/FunASR We would fix it.

Thanks a lot for such detailed reply. Tried 2nd resolution, still have error as __pickle invalid load key 'v' all my damo models are deployed by git only will try resolution1 and let pipeline download itself and see

It may because the models you git clone is old version. If you re-download them by git clone, it will works. And sorry, I have made a mistake, right version is funasr-1.0.3, not the funasr-1.10.3

Thanks for re-clarification. I tried resolution2 again for re-git clone from your address for latest models. But unfortunately the pickle error invalid load key 'v' kept coming again and again no matter I modify the cmd-asr.py or not I can not figure out the what exactly pickle error is. It just comes up after TOKENIZER_CLASSES/SentencepiecesTokenizer, and seems some problems with site-packages/modelscope/utils/registry.py I am using linux server to build this service and operate from local machine WIN. Sliced audio resource is put in server GPT-SoVITS/output/slicer_opt. Is it possible this problem is about resource route format? Light me up please.

OK, I will test it on WIN

Solution 2. I have tested it without errors in WIN. Models are downloaded by git clone. The version: modelscope-1.11.1, funasr-1.0.3. I suggest to check the model path (place in tools\damo_asr\models\). The full code is:

# -*- coding:utf-8 -*-

from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
import sys,os,traceback
# dir=sys.argv[1]
# opt_name=dir.split("\\")[-1].split("/")[-1]
dir="tools\damo_asr\models\speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch\example"
opt_name=os.path.basename(dir)

path_asr='tools/damo_asr/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch'
path_vad='tools/damo_asr/models/speech_fsmn_vad_zh-cn-16k-common-pytorch'
path_punc='tools/damo_asr/models/punc_ct-transformer_zh-cn-common-vocab272727-pytorch'
path_asr=path_asr if os.path.exists(path_asr)else "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
path_vad=path_vad if os.path.exists(path_vad)else "damo/speech_fsmn_vad_zh-cn-16k-common-pytorch"
path_punc=path_punc if os.path.exists(path_punc)else "damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch"
inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr,
    vad_model=path_vad,
    punc_model=path_punc,
)

opt=[]
for name in os.listdir(dir):
    try:
        text = inference_pipeline(input="%s/%s"%(dir,name))[0]["text"]
        opt.append("%s/%s|%s|ZH|%s"%(dir,name,opt_name,text))
    except:
        print(traceback.format_exc())

opt_dir="output/asr_opt"
os.makedirs(opt_dir,exist_ok=True)
with open("%s/%s.list"%(opt_dir,opt_name),"w",encoding="utf-8")as f:f.write("\n".join(opt))
ChrisGitHubIcon commented 8 months ago

Solution 1. modelscope-1.10.0, funasr-0.8.7/0.8.8 In the case, you should download models by default (the pipeline would download the models automatically). If you download the models by git clone, you would run with error! Solution 2. modelscope-1.11.1, funasr-1.0.3 (recommand) In the case, you should download the models by git clone:

git clone https://www.modelscope.cn/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch.git
git clone https://www.modelscope.cn/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch.git
git clone https://www.modelscope.cn/iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch.git
# the mode of `ct-transformer-large` is better, and support `English` and `Chinese`
# git clone https://www.modelscope.cn/iic/punc_ct-transformer_cn-en-common-vocab471067-large.git

or pipeline (modify the code in https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/damo_asr/cmd-asr.py):

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr, model_revision="v2.0.4",
    vad_model=path_vad, vad_model_revision="v2.0.4",
    punc_model=path_punc, punc_model_revision="v2.0.4",
)

and the audio_in -> input:

text = inference_pipeline(input="%s/%s"%(dir,name))["text"]

Solution 3. But I suggest to merge the pr and re-download the models by pipeline (automatically): #135 If it still runs with error, please raise a issue in : https://github.com/alibaba-damo-academy/FunASR We would fix it.

Thanks a lot for such detailed reply. Tried 2nd resolution, still have error as __pickle invalid load key 'v' all my damo models are deployed by git only will try resolution1 and let pipeline download itself and see

It may because the models you git clone is old version. If you re-download them by git clone, it will works. And sorry, I have made a mistake, right version is funasr-1.0.3, not the funasr-1.10.3

Thanks for re-clarification. I tried resolution2 again for re-git clone from your address for latest models. But unfortunately the pickle error invalid load key 'v' kept coming again and again no matter I modify the cmd-asr.py or not I can not figure out the what exactly pickle error is. It just comes up after TOKENIZER_CLASSES/SentencepiecesTokenizer, and seems some problems with site-packages/modelscope/utils/registry.py I am using linux server to build this service and operate from local machine WIN. Sliced audio resource is put in server GPT-SoVITS/output/slicer_opt. Is it possible this problem is about resource route format? Light me up please.

OK, I will test it on WIN

Solution 2. I have tested it without errors in WIN. Models are downloaded by git clone. The version: modelscope-1.11.1, funasr-1.0.3. I suggest to check the model path (place in tools\damo_asr\models\). The full code is:

# -*- coding:utf-8 -*-

from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
import sys,os,traceback
# dir=sys.argv[1]
# opt_name=dir.split("\\")[-1].split("/")[-1]
dir="tools\damo_asr\models\speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch\example"
opt_name=os.path.basename(dir)

path_asr='tools/damo_asr/models/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch'
path_vad='tools/damo_asr/models/speech_fsmn_vad_zh-cn-16k-common-pytorch'
path_punc='tools/damo_asr/models/punc_ct-transformer_zh-cn-common-vocab272727-pytorch'
path_asr=path_asr if os.path.exists(path_asr)else "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
path_vad=path_vad if os.path.exists(path_vad)else "damo/speech_fsmn_vad_zh-cn-16k-common-pytorch"
path_punc=path_punc if os.path.exists(path_punc)else "damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch"
inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model=path_asr,
    vad_model=path_vad,
    punc_model=path_punc,
)

opt=[]
for name in os.listdir(dir):
    try:
        text = inference_pipeline(input="%s/%s"%(dir,name))[0]["text"]
        opt.append("%s/%s|%s|ZH|%s"%(dir,name,opt_name,text))
    except:
        print(traceback.format_exc())

opt_dir="output/asr_opt"
os.makedirs(opt_dir,exist_ok=True)
with open("%s/%s.list"%(opt_dir,opt_name),"w",encoding="utf-8")as f:f.write("\n".join(opt))

Thanks a lot. This __pickle invalid key 'v' is still killing me after I tried many resolutions. All models are put properly at correct route. The resource I mean is the sliced audio resouce, I put on server 'output/slicer_opt', I feel this route is not properly imported to cmd-asr.py because even if I put a wrong route the error report is same as __pickle invalid key 'v'. I am thinking my audio sliced resource file name may have problem, will try to do something and see. If still not work, I will make cmd-asr.py myself and debug by step. I don't see others have similar question. This is only with me?

ChrisGitHubIcon commented 8 months ago

Finally... For my instance there are 2 problems shall shoot.

  1. The route format shall be absolute route at server for sliced audio resource, so does save route of .list;
  2. funasr and modelscope version shall be properly paired up. And make model_revision="v2.0.4" for models.