From fe8bfa921996bf4bb23a28902f1015b6d088145e Mon Sep 17 00:00:00 2001 From: "mulin.lyh" Date: Wed, 29 Nov 2023 17:40:09 +0800 Subject: [PATCH] when build force install funasr pai-eacv etc Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/14812168 * when build force install funasr pai-eacv etc --- .dev_scripts/build_image.sh | 12 +++++++++--- docker/Dockerfile.ubuntu | 4 ---- modelscope/utils/pre_compile.py | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.dev_scripts/build_image.sh b/.dev_scripts/build_image.sh index bb8c7e3d..abe7a1d9 100644 --- a/.dev_scripts/build_image.sh +++ b/.dev_scripts/build_image.sh @@ -163,8 +163,9 @@ echo -e "Building image with:\npython$python_version\npytorch$torch_version\nten docker_file_content=`cat docker/Dockerfile.ubuntu` if [ "$is_ci_test" != "True" ]; then echo "Building ModelScope lib, will install ModelScope lib to image" - docker_file_content="${docker_file_content} \nRUN pip install --no-cache-dir -U adaseq pai-easycv ms_swift funasr 'transformers<4.35.0'" - docker_file_content="${docker_file_content} \nRUN export COMMIT_ID=$CIS_ENV_COMMIT_ID && cd /tmp && GIT_LFS_SKIP_SMUDGE=1 git clone -b $CIS_ENV_BRANCH --single-branch $REPO_URL && cd MaaS-lib && python setup.py install && cd / && rm -fr /tmp/MaaS-lib" + docker_file_content="${docker_file_content} \nRUN export COMMIT_ID=$CIS_ENV_COMMIT_ID && pip install --no-cache-dir -U adaseq pai-easycv ms_swift funasr 'transformers<4.35.0'" + docker_file_content="${docker_file_content} \nRUN pip uninstall modelscope -y && export COMMIT_ID=$CIS_ENV_COMMIT_ID && cd /tmp && GIT_LFS_SKIP_SMUDGE=1 git clone -b $CIS_ENV_BRANCH --single-branch $REPO_URL && cd MaaS-lib && pip install . && cd / && rm -fr /tmp/MaaS-lib" + MMCV_WITH_OPS=1 MAX_JOBS=32 pip install --no-cache-dir 'mmcv-full<=1.7.0' && pip cache purge; \ fi echo "$is_dsw" if [ "$is_dsw" == "False" ]; then @@ -173,12 +174,17 @@ else echo "Building dsw image will need set ModelScope lib cache location." docker_file_content="${docker_file_content} \nENV MODELSCOPE_CACHE=/mnt/workspace/.cache/modelscope" # pre compile extension - docker_file_content="${docker_file_content} \nRUN python -c 'from modelscope.utils.pre_compile import pre_compile_all;pre_compile_all()'" + docker_file_content="${docker_file_content} \nRUN export TORCH_CUDA_ARCH_LIST='6.0;6.1;7.0;7.5;8.0;8.9;9.0;8.6+PTX' && python -c 'from modelscope.utils.pre_compile import pre_compile_all;pre_compile_all()'" fi if [ "$is_ci_test" == "True" ]; then echo "Building CI image, uninstall modelscope" docker_file_content="${docker_file_content} \nRUN pip uninstall modelscope -y" fi +docker_file_content="${docker_file_content} \n RUN cp /tmp/resources/conda.aliyun ~/.condarc && \ + pip config set global.index-url https://mirrors.aliyun.com/pypi/simple && \ + pip config set install.trusted-host mirrors.aliyun.com && \ + cp /tmp/resources/ubuntu2204.aliyun /etc/apt/sources.list " + printf "$docker_file_content" > Dockerfile while true diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index 55965f83..93308e25 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -56,7 +56,3 @@ RUN pip install --no-cache-dir --upgrade pip && \ COPY examples /modelscope/examples ENV SETUPTOOLS_USE_DISTUTILS=stdlib ENV VLLM_USE_MODELSCOPE=True -RUN cp /tmp/resources/conda.aliyun ~/.condarc && \ - pip config set global.index-url https://mirrors.aliyun.com/pypi/simple && \ - pip config set install.trusted-host mirrors.aliyun.com && \ - cp /tmp/resources/ubuntu2204.aliyun /etc/apt/sources.list diff --git a/modelscope/utils/pre_compile.py b/modelscope/utils/pre_compile.py index 2d9d3b0d..6415f677 100644 --- a/modelscope/utils/pre_compile.py +++ b/modelscope/utils/pre_compile.py @@ -18,10 +18,10 @@ def pre_compile_megatron_util(): def pre_compile_all(): if torch.cuda.is_available(): # extension require cuda. - pre_compile_megatron_util() # pre compile pai-easycv from easycv.thirdparty.deformable_attention.functions import ms_deform_attn_func # extension for all platform. + pre_compile_megatron_util() if __name__ == '__main__':