Skip to content

Building Running with Docker

Tatiana Likhomanenko edited this page Jan 15, 2020 · 10 revisions

wav2letter++ and its dependencies can also be built with the provided Dockerfile. Both CUDA and CPU backends are supported with Docker

Using pre-built Docker images

To use wav2letter++ with Docker:

  • Install Docker and, if using the CUDA backend, nvidia-docker

  • Run the docker image with CUDA/CPU backend in a new container:

    # with CUDA backend (for CUDA 9.2)
    sudo docker run --runtime=nvidia --rm -itd --ipc=host --name w2l wav2letter/wav2letter:cuda-latest
    # with CUDA backend (for CUDA 10)
    sudo docker run --runtime=nvidia --rm -itd --ipc=host --name w2l wav2letter/wav2letter:cuda-10-latest 
    # or with CPU backend
    sudo docker run --rm -itd --ipc=host --name w2l wav2letter/wav2letter:cpu-latest
    # go into bash in the container
    sudo docker exec -it w2l bash
  • One can also mount any necessary directories into a container, for example:

    sudo docker run --runtime=nvidia --rm -itd --ipc=host \
        --volume original/path/on/your/machine:mounted/path/in/the/container 
        --name w2l wav2letter/wav2letter:cuda-latest
  • To run tests inside a container

    cd /root/wav2letter/build && make test
  • Update flashlight and wav2letter inside a container to have current master

    • for CUDA backend
      cd /root/flashilight && git pull
      cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DFLASHLIGHT_BACKEND=CUDA && \
      make -j8 && make install 
      export MKLROOT=/opt/intel/mkl && export KENLM_ROOT_DIR=/root/kenlm && \
      cd /root && git clone --recursive https://github.com/facebookresearch/wav2letter.git wav2letter_master && \
      cd /root/wav2letter_master && mkdir -p build && \
      cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DW2L_LIBRARIES_USE_CUDA=ON -DW2L_BUILD_INFERENCE=ON && \
      make -j8 && \
    • for CPU backend
      cd /root/flashilight && git pull
      cmake .. -DCMAKE_BUILD_TYPE=Release -DFLASHLIGHT_BACKEND=CPU && \
      make -j8 && make install
      export KENLM_ROOT_DIR=/root/kenlm && \
      cd /root && git clone --recursive https://github.com/facebookresearch/wav2letter.git wav2letter_master && \
      cd /root/wav2letter_master && mkdir -p build && \
      cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DW2L_LIBRARIES_USE_CUDA=OFF -DW2L_BUILD_INFERENCE=ON && \
      make -j8 

Build images by yourself

To build Docker image from the source (using --no-cache will provide the latest version of flashlight inside the image if you have built the image previously for earlier versions of wav2letter) run the following commands:

git clone --recursive https://github.com/facebookresearch/wav2letter.git
cd wav2letter
# for CUDA backend
sudo docker build --no-cache -f ./Dockerfile-CUDA -t wav2letter .
# for CPU backend
sudo docker build --no-cache -f ./Dockerfile-CPU -t wav2letter .

Docker images on the Docker hub

https://hub.docker.com/r/wav2letter/wav2letter/tags

Training/decoding inside container

For logging during training/testing/decoding inside a container, use the --logtostderr=1 --minloglevel=0 flag.