diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index b1e9e7e2..160e2604 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -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/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/science.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \ pip cache purge # default shell bash ENV SHELL=/bin/bash # 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 \ pip install --no-cache-dir dgl-cu113 dglgo -f https://data.dgl.ai/wheels/repo.html; \ else \ @@ -88,3 +87,22 @@ RUN if [ "$USE_GPU" = "True" ] ; then \ # install jupyter plugin RUN mkdir -p /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 diff --git a/docker/scripts/install_apex.sh b/docker/scripts/install_apex.sh new file mode 100644 index 00000000..5a734243 --- /dev/null +++ b/docker/scripts/install_apex.sh @@ -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 diff --git a/docker/scripts/install_unifold.sh b/docker/scripts/install_unifold.sh new file mode 100644 index 00000000..0e9f3682 --- /dev/null +++ b/docker/scripts/install_unifold.sh @@ -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 diff --git a/docker/scripts/modelscope_env_init.sh b/docker/scripts/modelscope_env_init.sh new file mode 100755 index 00000000..3f701d7c --- /dev/null +++ b/docker/scripts/modelscope_env_init.sh @@ -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