The project's README from github.com/PaddlePaddle/PaddleSpeech. As one markdown file: README.md.
(简体中文|English)
PaddleSpeech is an open-source toolkit on PaddlePaddle platform for a variety of critical tasks in speech and audio, with the state-of-art and influential models.
PaddleSpeech won the NAACL2022 Best Demo Award, please check out our paper on Arxiv.
| Input Audio | Recognition Result |
|---|---|
|
|
I knocked at the door on the ancient side of the building. |
|
|
我认为跑步最重要的就是给我带来了身体健康。 |
For more synthesized audios, please refer to PaddleSpeech Text-to-Speech samples.
| Input Text | Output Text |
|---|---|
| 今天的天气真不错啊你下午有空吗我想约你一起去吃饭 | 今天的天气真不错啊!你下午有空吗?我想约你一起去吃饭。 |
Via the easy-to-use, efficient, flexible and scalable implementation, our vision is to empower both industrial application and academic research, including training, inference & testing modules, and deployment process. To be more specific, this toolkit features at:
PaddleSpeech Streaming Server is available for Streaming ASR with Punctuation Restoration and Token Timestamp and Text-to-Speech.PaddleSpeech Server is available for Audio Classification, Automatic Speech Recognition and Text-to-Speech, Speaker Verification and Punctuation Restoration.PaddleSpeech CLI is available for Speaker Verification.PaddleSpeech CLI is available for Audio Classification, Automatic Speech Recognition, Speech Translation (English to Chinese) and Text-to-Speech.
We strongly recommend our users to install PaddleSpeech in Linux with python>=3.8.
PaddleSpeech depends on paddlepaddle. For installation, please refer to the official website of paddlepaddle and choose according to your own machine. Here is an example of the cpu version.
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
You can also specify the version of paddlepaddle or install the develop version.
# install 2.4.1 version. Note, 2.4.1 is just an example, please follow the minimum dependency of paddlepaddle for your selection
pip install paddlepaddle==2.4.1 -i https://mirror.baidu.com/pypi/simple
# install develop version
pip install paddlepaddle==0.0.0 -f https://www.paddlepaddle.org.cn/whl/linux/cpu-mkl/develop.html
There are two quick installation methods for PaddleSpeech, one is pip installation, and the other is source code compilation (recommended).
pip install pytest-runner
pip install paddlespeech
git clone https://github.com/PaddlePaddle/PaddleSpeech.git
cd PaddleSpeech
pip install pytest-runner
pip install .
# If you need to install in editable mode, you need to use --use-pep517. The command is as follows:
# pip install -e . --use-pep517
For more installation problems, such as conda environment, librosa-dependent, gcc problems, kaldi installation, etc., you can refer to this installation document. If you encounter problems during installation, you can leave a message on #2150 and find related problems
Developers can have a try of our models with PaddleSpeech Command Line or Python. Change --input to test your own audio/text and support 16k wav format audio.
You can also quickly experience it in AI Studio 👉🏻 PaddleSpeech API Demo
Test audio sample download
wget -c https://paddlespeech.cdn.bcebos.com/PaddleAudio/zh.wav
wget -c https://paddlespeech.cdn.bcebos.com/PaddleAudio/en.wav
command line experience
paddlespeech asr --lang zh --input zh.wav
Python API experience
>>> from paddlespeech.cli.asr.infer import ASRExecutor
>>> asr = ASRExecutor()
>>> result = asr(audio_file="zh.wav")
>>> print(result)
我认为跑步最重要的就是给我带来了身体健康
Output 24k sample rate wav format audio
command line experience
paddlespeech tts --input "你好,欢迎使用百度飞桨深度学习框架!" --output output.wav
Python API experience
>>> from paddlespeech.cli.tts.infer import TTSExecutor
>>> tts = TTSExecutor()
>>> tts(text="今天天气十分不错。", output="output.wav")
Sound classification model based on 527 categories of AudioSet dataset
command line experience
paddlespeech cls --input zh.wav
Python API experience
>>> from paddlespeech.cli.cls.infer import CLSExecutor
>>> cls = CLSExecutor()
>>> result = cls(audio_file="zh.wav")
>>> print(result)
Speech 0.9027186632156372
command line experience
paddlespeech vector --task spk --input zh.wav
Python API experience
>>> from paddlespeech.cli.vector import VectorExecutor
>>> vec = VectorExecutor()
>>> result = vec(audio_file="zh.wav")
>>> print(result) # 187维向量
[ -0.19083306 9.474295 -14.122263 -2.0916545 0.04848729
4.9295826 1.4780062 0.3733844 10.695862 3.2697146
-4.48199 -0.6617882 -9.170393 -11.1568775 -1.2358263 ...]
command line experience
paddlespeech text --task punc --input 今天的天气真不错啊你下午有空吗我想约你一起去吃饭
Python API experience
>>> from paddlespeech.cli.text.infer import TextExecutor
>>> text_punc = TextExecutor()
>>> result = text_punc(text="今天的天气真不错啊你下午有空吗我想约你一起去吃饭")
今天的天气真不错啊!你下午有空吗?我想约你一起去吃饭。
Use pre-compiled kaldi related tools, only support experience in Ubuntu system
command line experience
paddlespeech st --input en.wav
Python API experience
>>> from paddlespeech.cli.st.infer import STExecutor
>>> st = STExecutor()
>>> result = st(audio_file="en.wav")
['我 在 这栋 建筑 的 古老 门上 敲门 。']
Developers can have a try of our speech server with PaddleSpeech Server Command Line.
You can try it quickly in AI Studio (recommend): SpeechServer
Start server
paddlespeech_server start --config_file ./demos/speech_server/conf/application.yaml
Access Speech Recognition Services
paddlespeech_client asr --server_ip 127.0.0.1 --port 8090 --input input_16k.wav
**Access Text to Sp