-
Notifications
You must be signed in to change notification settings - Fork 1k
Building Python bindings
We require python
>= 3.6 with the following packages installed:
Anaconda makes this easy. There are plenty of tutorials on how to set this up.
Aside from the above, the dependencies for Python bindings are a strict subset of the dependencies for the main wav2letter++ build. So if you already have the dependencies to build wav2letter++, you're all set to build python bindings as well.
The following dependencies are required to build python bindings:
Please refer to the previous sections for details on how to install the above dependencies.
The following dependencies are not required to build python bindings:
- flashlight
- libsndfile
- gflags
- glog
Once the dependencies are satisfied, simply run from wav2letter root:
cd bindings/python
pip install -e .
Note that if you encounter errors, you'll probably have to rm -rf build
before retrying the install.
The following environment variables can be used to control various options:
-
USE_CUDA=0
removes the CUDA dependency, but you won't be able to use ASG criterion with CUDA tensors. -
USE_KENLM=0
removes the KenLM dependency, but you won't be able to use the decoder unless you write C++ pybind11 bindings for your own LM. -
USE_MKL=1
will use Intel MKL for featurization but this may cause dynamic loading conflicts. - If you do not have
torch
, you'll only have a raw pointer interface to ASG criterion instead ofclass ASGLoss(torch.nn.Module)
.
- For CUDA backend inside docker container run commands
pip install torch==1.2.0 packaging==19.1
export KENLM_ROOT_DIR=/root/kenlm && \
cd /root/wav2letter/bindings/python && pip install -e .
- For CPU backend inside docker container run commands
pip install torch==1.2.0 packaging==19.1
export USE_CUDA=0 && export KENLM_ROOT_DIR=/root/kenlm && \
cd /root/wav2letter/bindings/python && pip install -e .