From faae851237e324e67f9e2059da5ba4d0146645e6 Mon Sep 17 00:00:00 2001 From: Jintao Huang Date: Sun, 10 May 2026 18:00:21 +0800 Subject: [PATCH] update docker --- .github/workflows/docker-image.yml | 4 ++-- docker/Dockerfile.ubuntu | 8 ++++---- docker/build_image.py | 21 ++++++++++++--------- docker/install.sh | 5 ----- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0da55ffc..f5c576da 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -27,9 +27,9 @@ on: description: 'Other params in --xxx xxx' required: false python_version: - description: 'Python version to use, default is 3.11.11' + description: 'Python version to use, default is 3.12.13' required: false - default: '3.11.11' + default: '3.12.13' run-name: Docker-${{ inputs.modelscope_branch }}-${{ inputs.image_type }}-${{ inputs.workflow_name }}-${{ inputs.python_version }}-by-@${{ github.actor }} diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index 5e24846f..dfa71acf 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -67,14 +67,14 @@ RUN bash /tmp/install.sh {version_args} && \ RUN if [ "$IMAGE_TYPE" = "gpu" ]; then \ - pip install --no-cache-dir math_verify "gradio<5.33" "deepspeed<0.18" ray -U && \ - pip install --no-cache-dir liger_kernel wandb swanlab nvitop pre-commit "transformers" "trl<0.25" "peft<0.18" huggingface-hub -U && \ + pip install --no-cache-dir math_verify "gradio<5.33" "deepspeed<0.19" ray -U && \ + pip install --no-cache-dir mcore-bridge -i https://pypi.org/simple/ -U && \ + pip install --no-cache-dir liger_kernel wandb swanlab nvitop pre-commit "transformers<5.9" "trl<1.0" "peft<0.20" huggingface-hub -U && \ pip install --no-cache-dir --no-build-isolation transformer_engine[pytorch]; \ cd /tmp && GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/NVIDIA/apex && \ cd apex && 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 --no-cache-dir "megatron-core==0.15.*"; \ - pip uninstall autoawq -y; \ + pip install --no-cache-dir "megatron-core==0.16.*" -U; \ elif [ "$IMAGE_TYPE" = "cpu" ]; then \ pip install --no-cache-dir huggingface-hub transformers peft diffusers -U; \ else \ diff --git a/docker/build_image.py b/docker/build_image.py index a80879b0..325b3dd9 100644 --- a/docker/build_image.py +++ b/docker/build_image.py @@ -339,6 +339,15 @@ class StableCPUImageBuilder(Builder): class StableGPUImageBuilder(Builder): """Dependencies will be stable versions""" + def init_args(self, args: Any) -> Any: + if not args.torch_version: + args.torch_version = '2.10.0' + args.torchaudio_version = '2.10.0' + args.torchvision_version = '0.25.0' + if not args.vllm_version: + args.vllm_version = '0.19.1' + return super().init_args(args) + def generate_dockerfile(self) -> str: meta_file = './docker/install.sh' with open('docker/Dockerfile.extra_install', 'r') as f: @@ -400,11 +409,6 @@ RUN pip install --no-cache-dir -U icecream soundfile pybind11 py-spy class LatestGPUImageBuilder(StableGPUImageBuilder): """Dependencies will be latest versions""" - def init_args(self, args: Any) -> Any: - if not args.vllm_version: - args.vllm_version = '0.16.0' - return super().init_args(args) - def generate_dockerfile(self) -> str: meta_file = './docker/install.sh' with open('docker/Dockerfile.extra_install', 'r') as f: @@ -417,8 +421,7 @@ RUN pip install --no-cache-dir -U icecream soundfile pybind11 py-spy version_args = ( f'{self.args.torch_version} {self.args.torchvision_version} {self.args.torchaudio_version} ' f'{self.args.vllm_version} {self.args.lmdeploy_version} {self.args.autogptq_version} ' - f'{self.args.optimum_version}' - f'{self.args.flashattn_version}') + f'{self.args.flashattn_version} {self.args.optimum_version}') with open('docker/Dockerfile.ubuntu', 'r') as f: content = f.read() content = content.replace('{base_image}', self.args.base_image) @@ -426,7 +429,7 @@ RUN pip install --no-cache-dir -U icecream soundfile pybind11 py-spy content = content.replace('{meta_file}', meta_file) content = content.replace('{version_args}', version_args) content = content.replace('{cur_time}', formatted_time) - content = content.replace('{install_ms_deps}', 'True') + content = content.replace('{install_ms_deps}', 'False') content = content.replace('{image_type}', 'gpu') content = content.replace('{torch_version}', self.args.torch_version) @@ -533,7 +536,7 @@ RUN pip install --no-cache-dir -U icecream soundfile pybind11 py-spy parser = argparse.ArgumentParser() parser.add_argument('--base_image', type=str, default=None) parser.add_argument('--image_type', type=str) -parser.add_argument('--python_version', type=str, default='3.11.11') +parser.add_argument('--python_version', type=str, default='3.12.13') parser.add_argument('--ubuntu_version', type=str, default='22.04') parser.add_argument('--torch_version', type=str, default=None) parser.add_argument('--torchvision_version', type=str, default=None) diff --git a/docker/install.sh b/docker/install.sh index e27e30db..fa5cf927 100644 --- a/docker/install.sh +++ b/docker/install.sh @@ -7,14 +7,11 @@ vllm_version=${4:-0.6.0} lmdeploy_version=${5:-0.6.1} autogptq_version=${6:-0.7.1} flashattn_version=${7:-2.7.1.post4} -optimum_version=${8:-2.0.0} pip uninstall -y torch torchvision torchaudio pip install --no-cache-dir torch==$torch_version torchvision==$torchvision_version torchaudio==$torchaudio_version -pip install --no-cache-dir torch==$torch_version torchvision==$torchvision_version torchaudio==$torchaudio_version - pip install --no-cache-dir tiktoken transformers_stream_generator bitsandbytes deepspeed torchmetrics decord optimum openai-whisper # pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.4cxx11abiTRUE-cp310-cp310-linux_x86_64.whl @@ -24,8 +21,6 @@ MAX_JOBS=16 pip install --no-cache-dir flash_attn==$flashattn_version --no-build pip install --no-cache-dir triton -U && pip cache purge -pip install --no-cache-dir optimum==$optimum_version - if [[ "$(printf '%s\n' "0.6.0" "$vllm_version" | sort -V | head -n1)" = "0.6.0" ]]; then # vllm_version is >= 0.6.0 pip install --no-cache-dir vllm==$vllm_version && pip cache purge