-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
99 lines (78 loc) · 3.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# https://github.com/manuelruder/fast-artistic-videos
# https://github.com/lmb-freiburg/flownet2
FROM positlabs/flownet2
# use bash
SHELL ["/bin/bash", "-c"]
# define volume for i/o
VOLUME ["/io"]
# install torch, locked at commit hash
RUN apt-get update; apt-get install -y \
unzip \
git-core \
cmake \
curl \
sudo \
libreadline-dev \
libwebkitgtk-3.0-0 wget
RUN git clone https://github.com/torch/distro.git /torch --recursive; \
cd /torch && git checkout 0219027e6c4644a0ba5c5bf137c989a0a8c9e01b \
./install-deps; \
./install.sh; \
source ~/.bashrc;
# install lua modules
RUN /torch/install/bin/luarocks install zlib; \
/torch/install/bin/luarocks install torch; \
/torch/install/bin/luarocks install nn; \
/torch/install/bin/luarocks install image; \
/torch/install/bin/luarocks install lua-cjson;
# install CUDA v7
RUN curl http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb -o cuda-repo-ubuntu1404_7.5-18_amd64.deb; \
sudo dpkg -i --force-all cuda-repo-ubuntu1404_7.5-18_amd64.deb; \
sudo apt-get update; \
sudo apt-get install -y cuda-7.5;
# install CUDA lua modules
RUN /torch/install/bin/luarocks install findCUDA; \
/torch/install/bin/luarocks install cutorch; \
/torch/install/bin/luarocks install cunn;
# install ffmpeg (required by FAV)
RUN apt-get install -y software-properties-common && \
add-apt-repository ppa:mc3man/trusty-media && \
apt-get update && \
apt-get -y dist-upgrade && \
apt-get install -y ffmpeg
# install node
RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -; \
apt-get install -y nodejs;
# clone fast-artistic-videos
RUN mkdir /fast-artistic-videos && \
git clone https://github.com/positlabs/fast-artistic-videos.git /fast-artistic-videos
# git clone -b dev https://github.com/positlabs/fast-artistic-videos.git /fast-artistic-videos
# grab paths from build args
ARG FAV_MODELS_ROOT
ENV FAV_MODELS_ROOT=${FAV_MODELS_ROOT}
# download pretrained models
RUN chmod +x /fast-artistic-videos/models/download_models.sh; \
cd /fast-artistic-videos; \
/fast-artistic-videos/models/download_models.sh ${FAV_MODELS_ROOT}
# install stnbhwd (GPU accelerated warping)
RUN cd /fast-artistic-videos/stnbdhw/; \
/torch/install/bin/luarocks make stnbdhw-scm-1.rockspec;
# use cuDNN to accelerate convolutions and reduce memory footprint.
RUN /torch/install/bin/luarocks install cudnn;
RUN curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" && \
python get-pip.py && \
pip install --upgrade protobuf --ignore-installed six && \
rm get-pip.py
# for some reason, torch needs to update even though we just installed it
# this fixes borked outputs, as described in https://github.com/manuelruder/fast-artistic-videos/issues/7
RUN cd /torch && ./update.sh;
# add caffe to pythonpath
ENV PYTHONPATH=/flownet2/flownet2/python/
RUN chmod +x /fast-artistic-videos/stylizeVideo_flownet.sh
# set up cli stuff
WORKDIR /app
COPY ./ /app
# flownet runner modified to recycle the caffe net. WAY faster.
COPY run-flownet-many.py /flownet2/flownet2/scripts/run-flownet-many.py
ENTRYPOINT [ "/app/fav" ]
# CMD tail -f /dev/null