PaddlePaddle / PaddleSpeech

Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award.
https://paddlespeech.readthedocs.io
Apache License 2.0
10.92k stars 1.83k forks source link

声纹识别能制定加载离线模型路径吗 #3579

Open lonngxiang opened 10 months ago

lonngxiang commented 10 months ago

声纹识别能制定加载离线模型路径吗

lonngxiang commented 10 months ago

能指定下载的离线模型吗

from paddlespeech.cli.vector import VectorExecutor
import paddle 
vector_executor = VectorExecutor()
audio_emb = vector_executor(
    model='ecapatdnn_voxceleb12',
    sample_rate=16000,
    config=None,  # Set `config` and `ckpt_path` to None to use pretrained model.
    ckpt_path=None,
    audio_file=r'C:*36145389.wav',
    device=paddle.get_device())
print('Audio embedding Result: \n{}'.format(audio_emb))
chenzhen2018 commented 5 months ago

配置说明,源码里有:

https://github.com/PaddlePaddle/PaddleSpeech/blob/969f33999fd6116a69831d098c1ab6f1e125129a/paddlespeech/cli/vector/infer.py#L317

即使用ckpt_pathconfig两个参数配置 比如下载的模型文件,如下: image

可以根据需要将模型文件移动到指定路径下,如/nfs/models/,代码如下:


注意:`ckpt_path`必须为`***/xxx/model",因为源码中会有进一步的处理
```python
os.path.abspath(ckpt_path + ".pdparams")