6.8 KiB
Installation
There are 3 ways to use PaddleSpeech
. According to the degree of difficulty, the 3 ways can be divided into Easy, Medium and Hard. You can choose one of the 3 ways to install PaddleSpeech
.
Way | Function |
---|---|
Easy | (1) Use command line functions of PaddleSpeech. (2) Experience PaddleSpeech on Aistudio. |
Medium | Support major function,such as using theready-made examples and using PaddleSpeech to train your own model. |
Hard | Support full function of Paddlespeech,including training n-gram language model. And you are more able be a developer! |
Prerequisites
- Python >= 3.7
- PaddlePaddle latest version (please refer to the Installation Guide)
- Hip: For Linux and Mac, do not use command
sh
instead of commandbash
Easy: Get the Basic Function (Support Linux, Mac and Windows)
- If you are newer to
PaddleSpeech
and want to experience it easily without your own machine. We recommend you to use AI Studio to experience it. There is a step-by-step tutorial forPaddleSpeech
and you can use the basic function ofPaddleSpeech
with a free machine.
Install Conda
Conda is a management system of the environment. You can go to minicoda to install the conda.
And then Install conda dependencies for paddlespeech
:
conda install -y -c conda-forge sox libsndfile swig bzip2
Install C++ environment
Windows
Since some required pypi packages need C++ environment, you need to install the visual studio firstly.
Mac
brew install gcc
Linux
# centos
sudo yum install gcc gcc-c++
# ubuntu
sudo apt install build-essential
# Others
conda install -y -c gcc_linux-64=8.4.0 gxx_linux-64=8.4.0
Install PaddleSpeech
You can use the following command:
pip install paddlepaddle paddlespeech
- You can use the command line function of Paddlespeech. For more information, you can see the cli.
Medium: Get the Major Function (Support Linux)
If you want to get the major function of paddlespeech
. There are 3 steps you need to do.
Install Conda
Conda is a management system of the environment. You can go to minicoda to select a version (py>=3.7) and install it by yourself or you can use the following command:
# download the miniconda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
# install the miniconda
bash Miniconda3-latest-Linux-x86_64.sh -b
# conda init
$HOME/miniconda3/bin/conda init
# activate the conda
bash
Then you can create an conda virtual environment using the following command:
conda create -y -p tools/venv python=3.7
Activate the conda virtual environment:
conda activate tools/venv
Install conda dependencies for paddlespeech
:
conda install -y -c conda-forge sox libsndfile swig bzip2
Do not forget to install gcc
and gxx
on your system.
If you use linux, you can choose to use the scripts below to install them.
# centos
sudo yum install gcc gcc-c++
# ubuntu
sudo apt install build-essential
# Others
conda install -y -c gcc_linux-64=8.4.0 gxx_linux-64=8.4.0
(Hip: Do not use the last script if you want to install by Hard way):
Install PaddlePaddle
For example, for CUDA 10.2, CuDNN7.5 install paddle 2.2.0:
python3 -m pip install paddlepaddle-gpu==2.2.0
Install PaddleSpeech
If you want to use theready-made
examples in paddlespeech
, you need to clone this repository and install paddlespeech
by the following commands:
https://github.com/PaddlePaddle/PaddleSpeech.git
cd PaddleSpeech
pip install .
Hard: Get the Full Function on Your Machine
Prerequisites
- choice 1: working with
Ubuntu
Docker Container. - choice 2: working on
Ubuntu
withroot
privilege.
To avoid the trouble of environment setup, running in Docker container is highly recommended. Otherwise, if you work on Ubuntu
with root
privilege, you can skip the next step.
Choice 1: Running in Docker Container (Recommand)
Docker is an open-source tool to build, ship, and run distributed applications in an isolated environment. A Docker image for this project has been provided in hub.docker.com with all the dependencies installed. This Docker image requires the support of NVIDIA GPU, so please make sure its availability and the nvidia-docker has been installed.
Take several steps to launch the Docker image:
- Download the Docker image
For example, pull paddle 2.2.0 image:
nvidia-docker pull registry.baidubce.com/paddlepaddle/paddle:2.2.0-gpu-cuda10.2-cudnn7
- Clone this repository
git clone https://github.com/PaddlePaddle/PaddleSpeech.git
- Run the Docker image
sudo nvidia-docker run --net=host --ipc=host --rm -it -v $(pwd)/PaddleSpeech:/PaddleSpeech registry.baidubce.com/paddlepaddle/paddle:2.2.0-gpu-cuda10.2-cudnn7 /bin/bash
Now you can execute training, inference and hyper-parameters tuning in Docker container.
Choice 2: Running in Ubuntu with Root Privilege
- Install
build-essential
by apt
sudo apt install build-essential
- Clone this repository
git clone https://github.com/PaddlePaddle/PaddleSpeech.git
- Install paddle 2.2.0:
python3 -m pip install paddlepaddle-gpu==2.2.0
Install the Conda
# download and install the miniconda
pushd tools
bash extras/install_miniconda.sh
popd
# use the "bash" command to make the conda environment works
bash
# create an conda virtual environment
conda create -y -p tools/venv python=3.7
# Activate the conda virtual environment:
conda activate tools/venv
# Install the conda packags
conda install -y -c conda-forge sox libsndfile swig bzip2 libflac bc
Install PaddlePaddle
For example, for CUDA 10.2, CuDNN7.5 install paddle 2.2.0:
python3 -m pip install paddlepaddle-gpu==2.2.0
Get the Function for Developing PaddleSpeech
pip install -e .[develop]
Install the Kaldi (Optional)
pushd tools
bash extras/install_openblas.sh
bash extras/install_kaldi.sh
popd
Setup for Other Platform
- Make sure these libraries or tools in dependencies installed. More information please see:
setup.py
andtools/Makefile
. - The version of
swig
should >= 3.0 - we will simplify the install process in the future.