-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.nvidia-jupyter
124 lines (104 loc) · 3.91 KB
/
Dockerfile.nvidia-jupyter
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Magenta Dockerfile for Anaconda with TensorFlow stack
# Copyright (C) 2020 Chelsea E. Manning
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
FROM xychelsea/tensorflow:v0.1.2-gpu-jupyter
LABEL description="Magenta GPU Container w/ Jupyter Notebooks"
# $ docker build -t xychelsea/magenta:latest-gpu-jupyter -f Dockerfile.nvidia-jupyter .
# $ docker run --gpus all --rm -it -d -p 8888:8888 xychelsea/magenta:latest-gpu-jupyter
# $ docker push xychelsea/magenta:latest-gpu-jupyter
ENV ANACONDA_ENV=magenta
ENV MAGENTA_PATH=/usr/local/magenta
ENV MAGENTA_HOME=${HOME}/magenta
ENV MAGENTA_MODELS=${MAGENTA_PATH}/magenta/models/
ENV MAGENTA_WORKSPACE=${MAGENTA_PATH}/workspace
# Start as root
USER root
# Update packages
RUN apt-get update --fix-missing \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade
# Install dependencies
RUN apt-get -y install \
build-essential \
fluid-soundfont-gm \
git \
libasound2-dev \
libfluidsynth1 \
libjack-dev \
portaudio19-dev
# Create Magenta directory
RUN mkdir -p ${MAGENTA_PATH} \
&& fix-permissions ${MAGENTA_PATH}
# Switch to user "anaconda"
USER ${ANACONDA_UID}
WORKDIR ${HOME}
# Update Anaconda
RUN conda update -c defaults conda
# Install Magenta
RUN conda create -n magenta \
&& conda install -c conda-forge -n magenta \
absl-py \
cloudpickle \
dm-sonnet \
imageio \
librosa \
matplotlib \
mir_eval \
numba \
numpy \
pillow \
pip \
pygtrie \
scikit-image \
scipy \
six \
sk-video \
sox \
tensorflow-datasets \
tensorflow-probability \
tf-slim \
wheel \
&& rm -rvf ${ANACONDA_PATH}/share/jupyter/lab/staging
RUN git clone git://github.com/magenta/magenta.git ${MAGENTA_PATH}
COPY ./scripts/setup-nvidia.py ${MAGENTA_PATH}/setup.py
RUN pip install magenta -e ${MAGENTA_PATH}
# Switch back to root
USER root
# Install pre-trained models
ADD http://download.magenta.tensorflow.org/models/lookback_rnn.mag ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/attention_rnn.mag ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/basic_rnn.mag ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/drum_kit_rnn.mag ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/polyphony_rnn.mag ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/rl_rnn.mag ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/rl_tuner_note_rnn.ckpt ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/multistyle-pastiche-generator-monet.ckpt ${MAGENTA_MODELS}
ADD http://download.magenta.tensorflow.org/models/multistyle-pastiche-generator-varied.ckpt ${MAGENTA_MODELS}
RUN mkdir -p ${MAGENTA_WORKSPACE} \
&& fix-permissions ${MAGENTA_WORKSPACE} \
&& fix-permissions ${MAGENTA_MODELS} \
&& ln -s ${MAGENTA_PATH}/magenta ${HOME}/magenta \
&& ln -s ${MAGENTA_WORKSPACE} ${HOME}/workspace
# Clean Anaconda
RUN conda clean -afy
# Clean packages and caches
RUN apt-get --purge -y autoremove git \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* \
&& rm -rvf /home/${ANACONDA_PATH}/.cache/yarn \
&& fix-permissions ${HOME} \
&& fix-permissions ${ANACONDA_PATH}
# Re-activate user "anaconda"
USER $ANACONDA_UID
WORKDIR $HOME