|
1 | | -#Change to your base image, such as pytorch1.11+py38 |
2 | | -#https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel_21-02.html#rel_21-02 |
3 | | -FROM nvcr.io/nvidia/pytorch:21.06-py3 |
4 | | -#You can set available pypi sources |
5 | | -RUN /bin/bash -c "pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple" |
6 | | - |
7 | | -ENV STAGE_DIR=/tmp |
8 | | -RUN mkdir -p ${STAGE_DIR} |
9 | | -#Ubuntu |
10 | | -RUN apt-get update && apt-get install -y openssh-server && apt-get install -y git |
11 | | -ARG SSH_PORT=6001 |
12 | | -#Client Liveness & Uncomment Port 22 for SSH Daemon |
13 | | -RUN echo "ClientAliveInterval 30" >> /etc/ssh/sshd_config |
14 | | -RUN mkdir -p /var/run/sshd && cp /etc/ssh/sshd_config ${STAGE_DIR}/sshd_config && \ |
15 | | - sed "0,/^#Port 22/s//Port 22/" ${STAGE_DIR}/sshd_config > /etc/ssh/sshd_config |
16 | | -RUN cat /etc/ssh/sshd_config > ${STAGE_DIR}/sshd_config && \ |
17 | | - sed "0,/^Port 22/s//Port ${SSH_PORT}/" ${STAGE_DIR}/sshd_config > /etc/ssh/sshd_config && \ |
18 | | - sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config |
19 | | -EXPOSE ${SSH_PORT} |
20 | | - |
21 | | -#Set SSH KEY |
22 | | -RUN mkdir /root/.ssh |
23 | | -RUN printf "#StrictHostKeyChecking no\n#UserKnownHostsFile /dev/null" >> /etc/ssh/ssh_config && \ |
24 | | - ssh-keygen -t rsa -f /root/.ssh/id_rsa -N "" && cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys && \ |
25 | | - chmod og-wx /root/.ssh/authorized_keys |
26 | | - |
27 | | -RUN echo $'Host 127.0.0.1 \n\ |
28 | | - Hostname 127.0.0.1 \n\ |
29 | | - Port 6001 \n\ |
30 | | - StrictHostKeyChecking no \n\ |
31 | | - User root' > /root/.ssh/config |
32 | | -RUN echo $'Host localhost \n\ |
33 | | - Hostname localhost \n\ |
34 | | - Port 6001 \n\ |
35 | | - StrictHostKeyChecking no \n\ |
36 | | - User root' >> /root/.ssh/config |
37 | | - |
38 | | -RUN echo "service ssh start" >> /root/.bashrc |
39 | | - |
40 | | -#Main deps |
41 | | -RUN pip install tensorboard |
42 | | -RUN pip install sentencepiece |
43 | | -RUN pip install boto3 |
44 | | -RUN pip install jieba |
45 | | -RUN pip install ftfy |
46 | | -RUN pip install deepspeed==0.7.7 |
47 | | -RUN pip install bmtrain |
48 | | - |
49 | | -RUN pip install flagai |
50 | | -#For development usage, you can change as follows |
51 | | -#RUN git clone https://github.com/FlagAI-Open/FlagAI.git && cd FlagAI && python setup.py install |
| 1 | +FROM nvcr.io/nvidia/cuda:11.7.0-devel-ubuntu20.04 |
| 2 | + |
| 3 | +LABEL zhanglu0704 |
| 4 | + |
| 5 | +ENV TZ=Asia/Shanghai |
| 6 | + |
| 7 | +VOLUME /etc/localtime |
| 8 | + |
| 9 | +ENV WORK_DID=/workspace |
| 10 | + |
| 11 | +WORKDIR ${WORK_DID} |
| 12 | + |
| 13 | +RUN apt update && \ |
| 14 | + apt install -y g++ gcc cmake curl wget vim unzip git openssh-server net-tools python3-packaging && \ |
| 15 | + apt install -y python3.9 python3.9-dev python3-pip && \ |
| 16 | + apt clean -y && \ |
| 17 | + rm -rf /var/cache/apt/archives |
| 18 | + |
| 19 | +RUN rm /usr/bin/python3 && \ |
| 20 | + ln -s /usr/bin/python3.9 /usr/bin/python3 && \ |
| 21 | + ln -s /usr/bin/python3 /usr/bin/python && \ |
| 22 | + python -m pip install --upgrade pip |
| 23 | + |
| 24 | +RUN pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 \ |
| 25 | + --extra-index-url https://download.pytorch.org/whl/cu117 |
| 26 | + |
| 27 | +COPY requirements.txt ${WORK_DID}/ |
| 28 | + |
| 29 | +RUN python -m pip install -r ${WORK_DID}/requirements.txt |
| 30 | + |
| 31 | +RUN git clone https://github.com/NVIDIA/apex && \ |
| 32 | + cd apex && \ |
| 33 | + # git checkout -f 23.05 && \ |
| 34 | + # pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" . && \ |
| 35 | + pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" . && \ |
| 36 | + cd ../ && rm -rf apex |
| 37 | + |
| 38 | +RUN git clone https://github.com/OpenBMB/BMTrain && \ |
| 39 | + cd BMTrain && \ |
| 40 | + git checkout -f 0.2.2 && \ |
| 41 | + # python setup.py install --prefix=/usr/local/ |
| 42 | + pip install -v . && \ |
| 43 | + cd ../ && rm -rf BMTrain |
| 44 | + |
| 45 | +RUN git clone https://github.com/FlagAI-Open/FlagAI.git && \ |
| 46 | + cd FlagAI && \ |
| 47 | + pip install -v . && \ |
| 48 | + cd ../ && rm -rf FlagAI |
| 49 | + |
| 50 | +RUN echo "ClientAliveInterval 30" >> /etc/ssh/sshd_config && \ |
| 51 | + sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config && \ |
| 52 | + echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \ |
| 53 | + echo "UserKnownHostsFile /dev/null" >> /etc/ssh/ssh_config |
| 54 | + |
| 55 | +RUN ssh-keygen -t rsa -f /root/.ssh/id_rsa -N "" && \ |
| 56 | + cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys && \ |
| 57 | + chmod og-wx /root/.ssh/authorized_keys |
52 | 58 |
|
53 | 59 | CMD service ssh start && tail -f /dev/null |
| 60 | + |
| 61 | +# sudo docker build -f Dockerfile --shm-size='120g' -t flagai:dev-ubuntu20-cuda11.7-py39 . |
0 commit comments