Browse Source

[to #45915958]feat: v1.0.2 docker file update, add deepspeed, apex, uncore

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10617428
master
mulin.lyh 2 years ago
parent
commit
eb37921ad6
4 changed files with 84 additions and 2 deletions
  1. +20
    -2
      docker/Dockerfile.ubuntu
  2. +5
    -0
      docker/scripts/install_apex.sh
  3. +12
    -0
      docker/scripts/install_unifold.sh
  4. +47
    -0
      docker/scripts/modelscope_env_init.sh

+ 20
- 2
docker/Dockerfile.ubuntu View File

@@ -71,14 +71,13 @@ RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /var/modelscope/cv.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \ pip install --no-cache-dir -r /var/modelscope/cv.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
pip install --no-cache-dir -r /var/modelscope/multi-modal.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \ pip install --no-cache-dir -r /var/modelscope/multi-modal.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
pip install --no-cache-dir -r /var/modelscope/nlp.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \ pip install --no-cache-dir -r /var/modelscope/nlp.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
pip install --no-cache-dir -r /var/modelscope/science.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
pip cache purge pip cache purge


# default shell bash # default shell bash
ENV SHELL=/bin/bash ENV SHELL=/bin/bash


# install special package # install special package
RUN pip install --no-cache-dir mmcls>=0.21.0 mmdet>=2.25.0 decord>=0.6.0 datasets==2.1.0 numpy==1.18.5 ipykernel fairseq fasttext https://modelscope.oss-cn-beijing.aliyuncs.com/releases/dependencies/xtcocotools-1.12-cp37-cp37m-linux_x86_64.whl

RUN if [ "$USE_GPU" = "True" ] ; then \ RUN if [ "$USE_GPU" = "True" ] ; then \
pip install --no-cache-dir dgl-cu113 dglgo -f https://data.dgl.ai/wheels/repo.html; \ pip install --no-cache-dir dgl-cu113 dglgo -f https://data.dgl.ai/wheels/repo.html; \
else \ else \
@@ -88,3 +87,22 @@ RUN if [ "$USE_GPU" = "True" ] ; then \
# install jupyter plugin # install jupyter plugin
RUN mkdir -p /root/.local/share/jupyter/labextensions/ && \ RUN mkdir -p /root/.local/share/jupyter/labextensions/ && \
cp -r /tmp/resources/jupyter_plugins/* /root/.local/share/jupyter/labextensions/ cp -r /tmp/resources/jupyter_plugins/* /root/.local/share/jupyter/labextensions/

COPY docker/scripts/modelscope_env_init.sh /usr/local/bin/ms_env_init.sh
RUN pip install --no-cache-dir https://modelscope.oss-cn-beijing.aliyuncs.com/releases/dependencies/xtcocotools-1.12-cp37-cp37m-linux_x86_64.whl --force

# for uniford
COPY docker/scripts/install_unifold.sh /tmp/install_unifold.sh
RUN if [ "$USE_GPU" = "True" ] ; then \
bash /tmp/install_unifold.sh; \
else \
echo 'cpu unsupport uniford'; \
fi

RUN pip install --no-cache-dir mmcls>=0.21.0 mmdet>=2.25.0 decord>=0.6.0 datasets==2.1.0 numpy==1.18.5 ipykernel fairseq fasttext deepspeed
COPY docker/scripts/install_apex.sh /tmp/install_apex.sh
RUN if [ "$USE_GPU" = "True" ] ; then \
bash /tmp/install_apex.sh; \
else \
echo 'cpu unsupport uniford'; \
fi

+ 5
- 0
docker/scripts/install_apex.sh View File

@@ -0,0 +1,5 @@
git clone https://github.com/NVIDIA/apex
cd apex
TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5;8.0;8.6" pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
cd ..
rm -rf apex

+ 12
- 0
docker/scripts/install_unifold.sh View File

@@ -0,0 +1,12 @@
apt-get update && apt-get install -y hmmer kalign curl cmake \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& git clone --branch v3.3.0 https://github.com/soedinglab/hh-suite.git /tmp/hh-suite \
&& mkdir /tmp/hh-suite/build \
&& pushd /tmp/hh-suite/build \
&& cmake -DCMAKE_INSTALL_PREFIX=/opt/hhsuite .. \
&& make -j 4 && make install \
&& ln -s /opt/hhsuite/bin/* /usr/bin \
&& popd \
&& rm -rf /tmp/hh-suite \
&& pip install --no-cache-dir unicore -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html \
&& pip install --no-cache-dir biopython ipdb

+ 47
- 0
docker/scripts/modelscope_env_init.sh View File

@@ -0,0 +1,47 @@
#!/bin/bash
set -e
set -o pipefail
# chieck git is install
git --version >/dev/null 2>&1 || { echo 'git not installed' ; exit 0; }

if [ -z "$MODELSCOPE_USERNAME" ] || [ -z "$MODELSCOPE_GITLAB_ACCESS_TOKEN" ]; then
:
else
git config --global credential.helper store
echo "http://${MODELSCOPE_USERNAME}:${MODELSCOPE_GITLAB_ACCESS_TOKEN}@www.modelscope.cn">~/.git-credentials
echo "https://${MODELSCOPE_USERNAME}:${MODELSCOPE_GITLAB_ACCESS_TOKEN}@www.modelscope.cn">>~/.git-credentials
chmod go-rwx ~/.git-credentials
fi
if [ -z "$MODELSCOPE_USERNAME" ] || [ -z "$MODELSCOPE_USEREMAIL" ]; then
:
else
git config --system user.name ${MODELSCOPE_USERNAME}
git config --system user.email ${MODELSCOPE_USEREMAIL}
fi
if [ -z "$MODELSCOPE_ENVIRONMENT" ]; then
:
else
git config --system --add http.http://www.modelscope.cn.extraHeader "Modelscope_Environment: $MODELSCOPE_ENVIRONMENT"
git config --system --add http.https://www.modelscope.cn.extraHeader "Modelscope_Environment: $MODELSCOPE_ENVIRONMENT"
fi

if [ -z "$MODELSCOPE_USERNAME" ]; then
:
else
git config --system --add http.http://www.modelscope.cn.extraHeader "Modelscope_User: $MODELSCOPE_USERNAME"
git config --system --add http.https://www.modelscope.cn.extraHeader "Modelscope_User: $MODELSCOPE_USERNAME"
fi

if [ -z "$MODELSCOPE_USERID" ]; then
:
else
git config --system --add http.http://www.modelscope.cn.extraHeader "Modelscope_Userid: $MODELSCOPE_USERID"
git config --system --add http.https://www.modelscope.cn.extraHeader "Modelscope_Userid: $MODELSCOPE_USERID"
fi

if [ -z "$MODELSCOPE_HAVANAID" ]; then
:
else
git config --system --add http.http://www.modelscope.cn.extraHeader "Modelscope_Havanaid: $MODELSCOPE_HAVANAID"
git config --system --add http.https://www.modelscope.cn.extraHeader "Modelscope_Havanaid: $MODELSCOPE_HAVANAID"
fi

Loading…
Cancel
Save