Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问语音合成可以使用GPU进行推理吗,如果可以应该怎么操作呢? #2467

Closed
MingyuLau opened this issue Sep 27, 2022 · 9 comments
Assignees

Comments

@MingyuLau
Copy link

General Question

@yaleimeng
Copy link

在demo目录下,speech server和streaming_tts_server 项目 都有conf配置文件,找到模块对应的区域,
里面有参数 device: # set 'gpu:id' or 'cpu' ,默认是cpu;如果使用gpu,则指定类似 gpu:0

@yt605155624 yt605155624 self-assigned this Sep 28, 2022
@MingyuLau
Copy link
Author

MingyuLau commented Sep 28, 2022

@yaleimeng 你好,我记得我昨天问的那个问题好像也是你给我解答的,我在把文本数据集转化为语音数据集,昨天你推荐我用TTS的参考文档 我想在这个基础上改用GPU推理可以做到吗。另外这里提到的speech server和streaming_tts_server是做什么用的?有没有文档介绍如何用这两个做语音合成呢?

@yaleimeng
Copy link

yaleimeng commented Sep 28, 2022

你现在是有一组文本吗?
使用speech server把离线TTS在服务器跑起来,然后运行一个客户端不停地发送文本,保存语音就可以了。
其中TTS服务可以运行在GPU上。

@yt605155624
Copy link
Collaborator

yt605155624 commented Sep 28, 2022

speech_server 是这个: https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/demos/speech_server
流式 tts 服务是这个: https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/demos/streaming_tts_server
https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/demos/text_to_speech 默认使用 paddle.device() (和你安装的 paddle 版本有关),可以用 --device 设置 cpu 或者 gpu, 参考:

default=paddle.get_device(),

@MingyuLau
Copy link
Author

请问这个是只支持单gpu推理吗

@MingyuLau
Copy link
Author

我的数据集有点大,感觉转换起来好慢,请问有什么提高速度的方法吗,现在已经用了多线程和gpu

@MingyuLau
Copy link
Author

@yt605155624 我的paddle.get_device()输出是gpu:0,但是我用watch nvidia-smi的时候却发现gpu好像没在跑,这是为什么呢?
tts_executor = TTSExecutor() wav_file = tts_executor( text=text_ocr, output=outputpath, am='fastspeech2_vctk', voc='hifigan_ljspeech', lang='en', use_onnx=True, cpu_threads=52, device=paddle.get_device())

@MingyuLau
Copy link
Author

@yt605155624

@yt605155624
Copy link
Collaborator

  1. 请先 check 一下 gpu 版本的 paddle 是否安装成功吧
>>> import paddle
>>> paddle.utils.run_check()
  1. device 也可以强制设为 gpu 试试
  2. 声码器换成最快的 mb_melgan
  3. 都没有问题的话,如果速度还觉得慢,可以尝试使用 ONNXRuntime 推理,目前 ONNXRuntime 用的是 cpu,可以自己配下 GPU 推理(需要安装 onnxruntime-gpu) 试试,
    device: str='cpu',

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants