PaddleSpeech项目使用体验

新知榜官方账号

2023-09-28 17:03:05

PaddleSpeech项目使用体验

这段时间一直在研究飞浆平台,最近试了试PaddleSpeech项目,试着对文本语音做处理。整体的效果个人觉着不算特别优越,只能作为简单的学习使用。

项目地址:私信“333”分享给你,数据集及代码。

环境安装

首先我们看一下项目结构以及安装文档。需要Python3.7以上、C++环境、requirements安装等等,下面按照我的顺序说一下。

  1. conda安装Python3.9虚拟环境使用conda安装python3.9环境,命令如下。
  2. 安装VisualStudio2019安装地址:MicrosoftC++生成工具-VisualStudio注意安装的时候需要勾选C++桌面开发。
  3. 安装requirements.txt使用命令安装requiremets.txt,命令如下:pipinstall-rrequirements.txt-ihttps://pypi.douban.com/simple这里要注意一下,paddlespeech_ctcdecoders安装失败的话无所谓,可以略掉。
  4. 安装paddlepaddle和paddlespeech命令如下:pipinstallpaddlepaddle-ihttps://mirror.baidu.com/pypi/simplepipinstallpaddlespeech-ihttps://pypi.tuna.tsinghua.edu.cn/simple
  5. nltk_data下载按照项目安装文档内的说明。我的本地目录地址如下

语音合成

我下面分别验证一下tts、asr以及标点恢复功能。

tts语音合成使用命令如下:paddlespeechtts--input"南京现在很冷,下次再去夫子庙吧。"--outputC:\Users\xxx\Desktop\115.wav

执行结果如下:

[2022-01-0517:23:43,642][INFO][log.py][L57]-FileC:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4.zipmd5checking...[2022-01-0517:23:44,742][INFO][log.py][L57]-Usepretrainedmodelstoredin:C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4self.phones_dict:C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\phone_id_map.txt[2022-01-0517:23:44,743][INFO][log.py][L57]-C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4[2022-01-0517:23:44,744][INFO][log.py][L57]-C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\default.yaml[2022-01-0517:23:44,744][INFO][log.py][L57]-C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\snapshot_iter_76000.pdzself.phones_dict:C:\Users\huyi\.paddlespeech\models\fastspeech2_csmsc-zh\fastspeech2_nosil_baker_ckpt_0.4\phone_id_map.txt[2022-01-0517:23:44,745][INFO][log.py][L57]-FileC:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4.zipmd5checking...[2022-01-0517:23:44,782][INFO][log.py][L57]-Usepretrainedmodelstoredin:C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4[2022-01-0517:23:44,783][INFO][log.py][L57]-C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4[2022-01-0517:23:44,783][INFO][log.py][L57]-C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4\pwg_default.yaml[2022-01-0517:23:44,785][INFO][log.py][L57]-C:\Users\huyi\.paddlespeech\models\pwgan_csmsc-zh\pwg_baker_ckpt_0.4\pwg_snapshot_iter_400000.pdzvocab_size:268frontenddone!encoder_typeistransformerdecoder_typeistransformerC:\Users\huyi\.conda\envs\dh_partner\lib\site-packages\paddle\framework\io.py:415:DeprecationWarning:UsingorimportingtheABCsfrom'collections'insteadoffrom'collections.abc'isdeprecatedsincePython3.3,andin3.10itwillstopworkingifisinstance(obj,collections.Iterable)andnotisinstance(obj,(acousticmodeldone!vocdone!Buildingprefixdictfromthedefaultdictionary...[2022-01-0517:23:51][DEBUG][__init__.py:113]Buildingprefixdictfromthedefaultdictionary...LoadingmodelfromcacheC:\Users\huyi\AppData\Local\Temp\jieba.cache[2022-01-0517:23:51][DEBUG][__init__.py:132]LoadingmodelfromcacheC:\Users\huyi\AppData\Local\Temp\jieba.cacheLoadingmodelcost0.659seconds.[2022-01-0517:23:52][DEBUG][__init__.py:164]Loadingmodelcost0.659seconds.Prefixdicthasbeenbuiltsuccessfully.[2022-01-0517:23:52][DEBUG][__init__.py:166]Prefixdicthasbeenbuiltsuccessfully.C:\Users\huyi\.conda\envs\dh_partner\lib\site-packages\paddle\fluid\dygraph\math_op_patch.py:251:UserWarning:Thedtypeofleftandrightvariablesarenotthesame,leftdtypeispaddle.int64,butrightdtypeispaddle.int32,therightdtypewillconverttopaddle.int64warnings.warn([2022-01-0517:23:58,811][INFO][log.py][L57]-Wavefilehasbeengenerated:C:\Users\xxx\Desktop\115.wav

生成的音频如下:

语音识别

我就使用了tts生成的音频进行asr识别,看看效果,命令如下:paddlespeechasr--langzh--inputC:\Users\xxx\Desktop\115.wav

执行结果如下:

南京现在很冷下次再去夫子庙吧

可以看到最后打印的内容是没有标点的文字输出,还是比较准的。

标点恢复

就用这句话试试标点恢复的情况,命令如下:paddlespeechtext--taskpunc--input南京现在很冷下次再去夫子庙吧

执行结果如下:

南京现在很冷,下次再去夫子庙吧。

看起来语义上没什么问题。

总结

我在前言中说效果不是很好的主要原因是因为速率比较慢,相比于类似阿里云提供的tts、asr接口来说,效率比较低。也可能和需要校验模型是否存在这些无关紧要的功能有关。可以考虑研究代码,自己重新封装一些服务,效果应该好的多。

本页网址:https://www.xinzhibang.net/article_detail-14191.html

寻求报道,请 点击这里 微信扫码咨询

关键词

PaddleSpeech 语音识别 语音合成

分享至微信: 微信扫码阅读

相关工具

相关文章

相关快讯