Wav2letter: docker container

Created on 12 Jan 2018  路  10Comments  路  Source: flashlight/wav2letter

it would be really useful to at least provide a dockerfile or a docker-compose.yaml so that CPU inference can be evaluated without a long install (specially for non-Lua users)

wav2letter-lua

Most helpful comment

Thanks for the Dockerfile!

In my case it turned out that the unzip package wasn't installed and the docker build was failing because it couldn't install some of the required lua packages. Here's what worked for me, I've added the unzip to the dependencies and added the lua packages that the build was complaining were needed but not available.

FROM nvidia/cuda

# Install dependencies.
RUN apt-get update && apt-get install -y cmake curl git-core libboost-all-dev libbz2-dev libfftw3-dev liblzma-dev libsndfile1-dev lua5.3 lua5.3-dev wget zlib1g-dev unzip

# Install luajit.
WORKDIR /usr/src
RUN git clone https://github.com/torch/luajit-rocks.git
WORKDIR luajit-rocks
RUN mkdir build
WORKDIR build
RUN cmake .. -DWITH_LUAJIT21=OFF
RUN make -j 4
RUN make install

# Install KenLM
WORKDIR /usr/src
RUN git clone https://github.com/kpu/kenlm.git
WORKDIR kenlm
RUN mkdir build
WORKDIR build
RUN cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
RUN make -j 4
RUN make install
RUN cp -a lib/* /usr/lib

# Install torch packages.
RUN luarocks install torch
RUN luarocks install cutorch
RUN luarocks install cudnn
RUN luarocks install cunn
RUN git clone https://github.com/soumith/cudnn.torch.git -b R7
WORKDIR cudnn.torch
RUN luarocks make cudnn-scm-1.rockspec
WORKDIR /usr/src

# Fetch the wav2letter source.
WORKDIR /var/lib
RUN git clone https://github.com/facebookresearch/wav2letter.git

# Install additional dependencies
RUN luarocks install threads
RUN luarocks install optim
RUN luarocks install luafilesystem
RUN luarocks install md5
RUN luarocks install tds

RUN luarocks install torchnet
RUN luarocks install sys
RUN luarocks install vector

RUN luarocks install torchnet-sequential
RUN luarocks install xlua
RUN luarocks install sndfile

# Build wav2letter packages.
WORKDIR wav2letter
RUN cd gtn && luarocks make rocks/gtn-scm-1.rockspec && cd ..
RUN cd speech && luarocks make rocks/speech-scm-1.rockspec && cd ..
RUN cd torchnet-optim && luarocks make rocks/torchnet-optim-scm-1.rockspec && cd ..
RUN cd wav2letter && luarocks make rocks/wav2letter-scm-1.rockspec && cd ..
RUN cd beamer && KENLM_INC=/usr/src/kenlm luarocks make rocks/beamer-scm-1.rockspec && cd ..

Haven't had a chance to see if everything actually works yet though.

All 10 comments

We are working on it and will upload it soon.

thanks

Re-upping this. It would be great to have a Dockerfile.

I'm sorry, but the docker container was de-prioritized and is not coming in the near future. But we would be happy to accept any pull requests for a docker file.

I have a Dockerfile which uses nvidia-docker but NVidia's base image is giving me some issues. Once I have some time to finish debugging I will make a pull request. Cheers!

On a different note, I'm not a legal person so I omit the Intel MKL libs since I don't want any legal troubles. Maybe someone can tell me if it's safe to include them in the Dockerfile.

Here's what I have so far:

FROM nvidia/cuda

# Install dependencies.
RUN apt-get update && apt-get install -y cmake curl git-core libboost-all-dev libbz2-dev libfftw3-dev liblzma-dev libsndfile1-dev lua5.3 lua5.3-dev wget zlib1g-dev

# Install luajit.
WORKDIR /usr/src
RUN git clone https://github.com/torch/luajit-rocks.git
WORKDIR luajit-rocks
RUN mkdir build
WORKDIR build
RUN cmake .. -DWITH_LUAJIT21=OFF
RUN make -j 4
RUN make install

# Install KenLM
WORKDIR /usr/src
RUN git clone https://github.com/kpu/kenlm.git
WORKDIR kenlm
RUN mkdir build
WORKDIR build
RUN cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
RUN make -j 4
RUN make install
RUN cp -a lib/* /usr/lib

# Install torch packages.
RUN luarocks install torch
RUN luarocks install cutorch
RUN luarocks install cudnn
RUN luarocks install cunn
RUN git clone https://github.com/soumith/cudnn.torch.git -b R7
WORKDIR cudnn.torch
RUN luarocks make cudnn-scm-1.rockspec
WORKDIR /usr/src

# Fetch the wav2letter source.
WORKDIR /var/lib
RUN git clone https://github.com/facebookresearch/wav2letter.git

# Build wav2letter packages.
WORKDIR wav2letter
RUN cd gtn && luarocks make rocks/gtn-scm-1.rockspec && cd ..
RUN cd speech && luarocks make rocks/speech-scm-1.rockspec && cd ..
RUN cd torchnet-optim && luarocks make rocks/torchnet-optim-scm-1.rockspec && cd ..
RUN cd wav2letter && luarocks make rocks/wav2letter-scm-1.rockspec && cd ..
RUN cd beamer && KENLM_INC=/usr/src/kenlm luarocks make rocks/beamer-scm-1.rockspec && cd ..

It needs debugging but hopefully it's a good starting point if anyone needs a container before I have the spare time to get to it. Cheers!

Thanks for the Dockerfile!

In my case it turned out that the unzip package wasn't installed and the docker build was failing because it couldn't install some of the required lua packages. Here's what worked for me, I've added the unzip to the dependencies and added the lua packages that the build was complaining were needed but not available.

FROM nvidia/cuda

# Install dependencies.
RUN apt-get update && apt-get install -y cmake curl git-core libboost-all-dev libbz2-dev libfftw3-dev liblzma-dev libsndfile1-dev lua5.3 lua5.3-dev wget zlib1g-dev unzip

# Install luajit.
WORKDIR /usr/src
RUN git clone https://github.com/torch/luajit-rocks.git
WORKDIR luajit-rocks
RUN mkdir build
WORKDIR build
RUN cmake .. -DWITH_LUAJIT21=OFF
RUN make -j 4
RUN make install

# Install KenLM
WORKDIR /usr/src
RUN git clone https://github.com/kpu/kenlm.git
WORKDIR kenlm
RUN mkdir build
WORKDIR build
RUN cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
RUN make -j 4
RUN make install
RUN cp -a lib/* /usr/lib

# Install torch packages.
RUN luarocks install torch
RUN luarocks install cutorch
RUN luarocks install cudnn
RUN luarocks install cunn
RUN git clone https://github.com/soumith/cudnn.torch.git -b R7
WORKDIR cudnn.torch
RUN luarocks make cudnn-scm-1.rockspec
WORKDIR /usr/src

# Fetch the wav2letter source.
WORKDIR /var/lib
RUN git clone https://github.com/facebookresearch/wav2letter.git

# Install additional dependencies
RUN luarocks install threads
RUN luarocks install optim
RUN luarocks install luafilesystem
RUN luarocks install md5
RUN luarocks install tds

RUN luarocks install torchnet
RUN luarocks install sys
RUN luarocks install vector

RUN luarocks install torchnet-sequential
RUN luarocks install xlua
RUN luarocks install sndfile

# Build wav2letter packages.
WORKDIR wav2letter
RUN cd gtn && luarocks make rocks/gtn-scm-1.rockspec && cd ..
RUN cd speech && luarocks make rocks/speech-scm-1.rockspec && cd ..
RUN cd torchnet-optim && luarocks make rocks/torchnet-optim-scm-1.rockspec && cd ..
RUN cd wav2letter && luarocks make rocks/wav2letter-scm-1.rockspec && cd ..
RUN cd beamer && KENLM_INC=/usr/src/kenlm luarocks make rocks/beamer-scm-1.rockspec && cd ..

Haven't had a chance to see if everything actually works yet though.

Thanks guys for providing the docker file. Can you tell me what you have in there that's working and not working? I just need to make predictions on CPU. I can also use GPU and build rest API if required. Btw, does it require CUDA 9.2? will 9.0 work?
And come on developers! Build a docker file should be top priority, especially considering you are not using Python. Unless you don't want anybody to use it. I do appreciate your work, but you are not making this easy.

Closing as we do not support the lua version of wav2letter anymore - note that a docker file is available for the C++ version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

megharangaswamy picture megharangaswamy  路  5Comments

hajix picture hajix  路  4Comments

mlexplore1122 picture mlexplore1122  路  3Comments

nutriver picture nutriver  路  3Comments

smolendawid picture smolendawid  路  3Comments