mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-15 15:57:42 +01:00
106 lines
6.4 KiB
Docker
106 lines
6.4 KiB
Docker
FROM {base_image}
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
ENV TZ=Asia/Shanghai
|
|
ENV arch=x86_64
|
|
|
|
COPY docker/scripts/modelscope_env_init.sh /usr/local/bin/ms_env_init.sh
|
|
RUN apt-get update && \
|
|
apt-get install -y libsox-dev unzip libaio-dev zip iputils-ping telnet sudo git net-tools && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
{extra_content}
|
|
|
|
COPY {meta_file} /tmp/install.sh
|
|
|
|
ARG INSTALL_MS_DEPS={install_ms_deps}
|
|
|
|
ARG IMAGE_TYPE={image_type}
|
|
|
|
# install dependencies
|
|
COPY requirements /var/modelscope
|
|
|
|
RUN pip uninstall ms-swift modelscope -y && pip --no-cache-dir install pip==23.* -U && \
|
|
if [ "$INSTALL_MS_DEPS" = "True" ]; then \
|
|
pip --no-cache-dir install omegaconf==2.0.6 && \
|
|
pip install 'editdistance==0.8.1' && \
|
|
pip install --no-cache-dir 'cython<=0.29.36' versioneer 'numpy<2.0' -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
|
|
pip install --no-cache-dir -r /var/modelscope/framework.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
|
|
pip install --no-cache-dir -r /var/modelscope/audio.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/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 install --no-cache-dir -r /var/modelscope/tests.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
|
|
pip install --no-cache-dir -r /var/modelscope/server.txt && \
|
|
pip install --no-cache-dir https://modelscope.oss-cn-beijing.aliyuncs.com/packages/imageio_ffmpeg-0.4.9-py3-none-any.whl --no-dependencies --force && \
|
|
pip install adaseq pai-easycv && \
|
|
pip install --no-cache-dir 'scipy<1.13.0' && \
|
|
pip install --no-cache-dir funtextprocessing typeguard==2.13.3 scikit-learn -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
|
|
pip install --no-cache-dir text2sql_lgesql==1.3.0 git+https://github.com/jin-s13/xtcocoapi.git@v1.14 git+https://github.com/gatagat/lap.git@v0.4.0 -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html --force --no-deps && \
|
|
pip install --no-cache-dir mmcls>=0.21.0 mmdet>=2.25.0 decord>=0.6.0 mpi4py paint_ldm ipykernel fasttext -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
|
|
pip uninstall ddpm_guided_diffusion -y && \
|
|
pip install --no-cache-dir 'blobfile>=1.0.5' && \
|
|
pip install 'ddpm_guided_diffusion' -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html --no-index && \
|
|
pip uninstall shotdetect_scenedetect_lgss -y && \
|
|
pip install 'shotdetect_scenedetect_lgss' -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html --no-index && \
|
|
pip uninstall MinDAEC -y && \
|
|
pip install https://modelscope.oss-cn-beijing.aliyuncs.com/releases/dependencies/MinDAEC-0.0.2-py3-none-any.whl && \
|
|
pip cache purge; \
|
|
else \
|
|
pip install --no-cache-dir -r /var/modelscope/framework.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
|
|
pip cache purge; \
|
|
fi
|
|
|
|
ARG CUR_TIME={cur_time}
|
|
RUN echo $CUR_TIME
|
|
|
|
RUN bash /tmp/install.sh {version_args} && \
|
|
curl -fsSL https://ollama.com/install.sh | sh && \
|
|
pip install --no-cache-dir -U funasr scikit-learn && \
|
|
pip install --no-cache-dir -U qwen_vl_utils qwen_omni_utils librosa timm transformers accelerate peft trl safetensors && \
|
|
cd /tmp && GIT_LFS_SKIP_SMUDGE=1 git clone -b {swift_branch} --single-branch https://github.com/modelscope/ms-swift.git && \
|
|
cd ms-swift && pip install .[llm] && \
|
|
pip install .[eval] && pip install evalscope -U --no-dependencies && pip install ms-agent -U --no-dependencies && \
|
|
cd / && rm -fr /tmp/ms-swift && pip cache purge; \
|
|
cd /tmp && GIT_LFS_SKIP_SMUDGE=1 git clone -b {modelscope_branch} --single-branch https://github.com/modelscope/modelscope.git && \
|
|
cd modelscope && pip install . -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
|
|
cd / && rm -fr /tmp/modelscope && pip cache purge; \
|
|
pip install --no-cache-dir torch=={torch_version} torchvision=={torchvision_version} torchaudio=={torchaudio_version} {index_url} && \
|
|
pip install --no-cache-dir transformers diffusers timm>=0.9.0 && pip cache purge; \
|
|
pip install --no-cache-dir omegaconf==2.3.0 && pip cache purge; \
|
|
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
|
|
|
|
|
|
RUN if [ "$IMAGE_TYPE" = "swift" ]; then \
|
|
pip install "sglang[all]<0.5" "math_verify==0.5.2" "gradio<5.33" -U && \
|
|
pip install liger_kernel wandb swanlab nvitop pre-commit "transformers<4.57" "trl<0.21" huggingface-hub -U && \
|
|
SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])") && echo $SITE_PACKAGES && \
|
|
CUDNN_PATH=$SITE_PACKAGES/nvidia/cudnn CPLUS_INCLUDE_PATH=$SITE_PACKAGES/nvidia/cudnn/include \
|
|
pip install --no-build-isolation transformer_engine[pytorch]; \
|
|
cd /tmp && GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/NVIDIA/apex && \
|
|
cd apex && git checkout e13873debc4699d39c6861074b9a3b2a02327f92 && 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" ./ && \
|
|
cd / && rm -fr /tmp/apex && pip cache purge; \
|
|
pip install git+https://github.com/NVIDIA/Megatron-LM.git@core_r0.13.0; \
|
|
elif [ "$IMAGE_TYPE" = "llm" ]; then \
|
|
pip install --no-cache-dir huggingface-hub transformers peft diffusers -U; \
|
|
pip uninstall autoawq -y; \
|
|
else \
|
|
pip install "transformers<4.56" "tokenizers<0.22" "trl<0.23" "diffusers<0.35" --no-dependencies; \
|
|
fi
|
|
|
|
# install nvm and set node version to 18
|
|
ENV NVM_DIR=/root/.nvm
|
|
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
|
|
. $NVM_DIR/nvm.sh && \
|
|
nvm install 22 && \
|
|
nvm use 22
|
|
|
|
ENV VLLM_USE_MODELSCOPE=True
|
|
ENV LMDEPLOY_USE_MODELSCOPE=True
|
|
ENV MODELSCOPE_CACHE=/mnt/workspace/.cache/modelscope/hub
|
|
SHELL ["/bin/bash", "-c"]
|