-
Notifications
You must be signed in to change notification settings - Fork 18
/
gpu.Dockerfile
266 lines (209 loc) · 8.09 KB
/
gpu.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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# local 빌드시
FROM tensorflow/tensorflow:2.13.0-gpu-jupyter
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 AS nvidia
# CUDA
ENV CUDA_MAJOR_VERSION=11
ENV CUDA_MINOR_VERSION=8
ENV CUDA_VERSION=$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/bin:${PATH}
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
ENV LD_LIBRARY_PATH_NO_STUBS="/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/opt/conda/lib"
ENV LD_LIBRARY_PATH="/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib64/stubs:/opt/conda/lib"
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
ENV NVIDIA_REQUIRE_CUDA="cuda>=$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION"
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 카카오 ubuntu archive mirror server 추가. 다운로드 속도 향상
RUN sed -i '[email protected]@mirror.kakao.com@g' /etc/apt/sources.list && \
apt-get update && apt-get install alien -y
# openjdk java vm 설치
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
build-essential \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
g++ \
gcc \
openjdk-8-jdk \
python3-dev \
python3-pip \
curl \
bzip2 \
ca-certificates \
libglib2.0-0 \
libxext6 \
libsm6 \
libxrender1 \
libssl-dev \
libzmq3-dev \
vim \
git \
cmake
RUN apt-get update
ARG CONDA_DIR=/opt/conda
ENV CUDA_PATH=/usr/local/cuda
# add to path
ENV PATH $CONDA_DIR/bin:$PATH
# Install miniconda
RUN echo "export PATH=$CONDA_DIR/bin:"'$PATH' > /etc/profile.d/conda.sh && \
curl -sL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p $CONDA_DIR && \
rm ~/miniconda.sh
# Conda 가상환경 생성
RUN conda config --set always_yes yes --set changeps1 no && \
conda create -y -q -n py39 python=3.9
ENV PATH /opt/conda/envs/py39/bin:$PATH
ENV CONDA_DEFAULT_ENV py39
ENV CONDA_PREFIX /opt/conda/envs/py39
ENV PATH=/usr/local/bin:${PATH}
RUN apt-get update
# Install OpenCL & libboost
RUN apt-get install -y ocl-icd-libopencl1 clinfo libboost-all-dev && \
mkdir -p /etc/OpenCL/vendors && \
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
# 패키지 설치
RUN pip install setuptools && \
pip install mkl && \
pip install pymysql && \
pip install numpy && \
pip install scipy && \
pip install pandas && \
pip install matplotlib && \
pip install seaborn && \
pip install hyperopt && \
pip install optuna && \
pip install missingno && \
pip install mlxtend && \
pip install catboost && \
pip install kaggle && \
pip install folium && \
pip install librosa && \
pip install nbconvert && \
pip install Pillow && \
pip install tqdm && \
pip install tensorflow-datasets && \
pip install gensim && \
pip install nltk && \
pip install wordcloud && \
pip install statsmodels
RUN apt-get update
RUN apt-get install -y graphviz && \
apt-get install -y graphviz-dev && \
pip install pygraphviz
RUN apt-get update
RUN pip install graphviz && \
pip install cupy-cuda11x
RUN pip install -U cython && \
pip install -U cysignals && \
pip install pyfasttext && \
pip install fasttext && \
pip install accelerate && \
pip install sentencepiece && \
pip install -U bitsandbytes && \
pip install -U git+https://github.com/huggingface/transformers.git && \
pip install -U git+https://github.com/huggingface/peft.git && \
pip install -U git+https://github.com/huggingface/accelerate.git && \
pip install -U datasets
RUN pip install pystan==2.19.1.1 && \
pip install prophet && \
pip install torchsummary
RUN pip install wandb tensorboard albumentations pydicom opencv-python scikit-image pyarrow kornia \
catalyst captum
RUN pip install fastai && \
pip install fvcore
RUN pip install openai && \
pip install langchain && \
pip install duckduckgo-search && \
pip install tiktoken && \
pip install chromadb && \
pip install pinecone-client && \
pip install python-dotenv
RUN pip install pypdf && \
pip install unstructured && \
pip install pdf2image && \
pip install pdfminer && \
pip install pypdfium2 && \
pip install pdfminer.six && \
pip install pymupdf && \
pip install pdfplumber && \
pip install amazon-textract-caller
RUN pip install cudf-cu11 dask-cudf-cu11 cuml-cu11 --extra-index-url=https://pypi.nvidia.com
RUN pip install -U "ipython[all]"
RUN git clone https://github.com/slundberg/shap.git && cd shap && \
python setup.py install
RUN pip install jupyter jupyterlab notebook jupyterthemes ipywidgets
ENV PATH=/usr/local/bin:${PATH}
# 나눔고딕 폰트 설치
# matplotlib에 Nanum 폰트 추가
RUN apt-get update && apt-get install fonts-nanum*
RUN cp /usr/share/fonts/truetype/nanum/Nanum* /opt/conda/envs/py39/lib/python3.9/site-packages/matplotlib/mpl-data/fonts/ttf/ && \
fc-cache -fv && \
rm -rf ~/.cache/matplotlib/*
# Mecab 설치
RUN apt-get update
RUN apt-get install g++ openjdk-8-jdk
RUN pip install konlpy JPype1-py3
RUN bash -c "bash <(curl -s https://raw.githubusercontent.com/konlpy/konlpy/master/scripts/mecab.sh)"; exit 0
# mecab-python의 버전 오류로 인해 아래 패키지를 설치하면 코랩에서 Mecab을 사용가능
RUN pip install mecab-python3
# XGBoost (GPU 설치)
RUN pip install xgboost && \
pip install lightgbm
#RUN conda install -c nvidia -y
# Install OpenCL & libboost (required by LightGBM GPU version)
# RUN apt-get install -y ocl-icd-libopencl1 clinfo libboost-all-dev && \
# mkdir -p /etc/OpenCL/vendors && \
# echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
# RUN conda install -c conda-forge py-xgboost-gpu -y
# lightgbm (GPU 설치)
#RUN pip uninstall -y lightgbm && \
# cd /usr/local/src && mkdir lightgbm && cd lightgbm && \
# git clone --recursive --branch stable --depth 1 https://github.com/microsoft/LightGBM && \
# cd LightGBM && mkdir build && cd build && \
# cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ .. && \
# make -j$(nproc) OPENCL_HEADERS=/usr/local/cuda-11.2/targets/x86_64-linux/include LIBOPENCL=/usr/local/cuda-11.2/targets/x86_64-linux/lib && \
# cd /usr/local/src/lightgbm/LightGBM/python-package && python setup.py install --precompile
# RUN git clone --recursive https://github.com/microsoft/LightGBM && \
# cd LightGBM && \
# mkdir build && \
# cd build && \
# cmake -DUSE_GPU=1 .. && \
# make -j$(nproc) && \
# cd ..
# soynlp, KR-WordRank, soyspacing, customized_konlpy 설치
RUN pip install soynlp && \
pip install krwordrank && \
pip install soyspacing && \
pip install customized_konlpy
# PyTorch 2.0 설치
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
RUN pip install torchtext==0.15.1
# PyTorch 2.0 compile 모드 지원을 위한 설치
RUN pip install torchtriton --extra-index-url "https://download.pytorch.org/whl/nightly/cu118"
# TensorFlow 2.13.0 설치
RUN pip install tensorflow==2.13.0
# Remove the CUDA stubs.
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH_NO_STUBS"
# locale 설정
# RUN apt-get update && apt-get install -y locales tzdata && \
# locale-gen ko_KR.UTF-8 && locale -a && \
# ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
RUN apt-get autoremove -y && apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
conda clean -a -y
RUN apt-get update
# LANG 환경변수 설정
ENV LANG ko_KR.UTF-8
# Jupyter Notebook config 파일 생성
# RUN jupyter notebook --generate-config
# config 파일 복사 (jupyter_notebook_config.py 파일 참고)
# COPY jupyter_notebook_config.py /root/.jupyter/jupyter_notebook_config.py
# 설치 완료 후 테스트용 ipynb
COPY ./01-GPU-TEST/GPU-Test.ipynb /home/jupyter/GPU-Test.ipynb
# 기본
EXPOSE 8888
# jupyter notebook 의 password를 지정하지 않으면 보안상 취약하므로 지정하는 것을 권장
# CMD jupyter notebook --allow-root