From 7bb48a7d3d61eebc610a2633d9ecff563ce84ec6 Mon Sep 17 00:00:00 2001 From: Yunnglin Date: Mon, 8 Jun 2026 14:52:00 +0800 Subject: [PATCH] Upgrade numpy to 2.x for 1.38 Docker images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace deprecated numpy aliases (np.math.ceil → math.ceil, np.Inf → np.inf) - Upgrade Docker constraints: numpy>=2.0, cython>=3.0, remove scipy upper bound --- docker/Dockerfile.ascend | 4 ++-- docker/Dockerfile.ubuntu | 4 ++-- .../cv/video_depth_estimation/models/model_checkpoint.py | 2 +- .../soonet_video_temporal_grounding_pipeline.py | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docker/Dockerfile.ascend b/docker/Dockerfile.ascend index 911ee3f9..f80dbdd2 100644 --- a/docker/Dockerfile.ascend +++ b/docker/Dockerfile.ascend @@ -86,13 +86,13 @@ RUN pip uninstall ms-swift modelscope -y && pip install --no-cache-dir pip==23.* if [ "$INSTALL_MS_DEPS" = "True" ]; then \ pip install --no-cache-dir omegaconf==2.0.6 && \ pip install 'editdistance==0.8.1' && \ - pip install --no-cache-dir 'cython<=0.29.36' versioneer 'numpy<2.0' && \ + pip install --no-cache-dir 'cython>=3.0' versioneer 'numpy>=2.0' && \ pip install --no-cache-dir -r /var/modelscope/framework.txt && \ 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/tests.txt && \ 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 --no-cache-dir 'scipy<1.13.0' && \ + pip install --no-cache-dir 'scipy' && \ pip install --no-cache-dir funtextprocessing typeguard==2.13.3 scikit-learn && \ pip install --no-cache-dir 'decord>=0.6.0' mpi4py paint_ldm ipykernel fasttext && \ pip install --no-cache-dir 'blobfile>=1.0.5' && \ diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index 7be6731c..d61d428e 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -25,13 +25,13 @@ RUN pip uninstall ms-swift modelscope -y && pip --no-cache-dir install pip==23.* 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' && \ + pip install --no-cache-dir 'cython>=3.0' versioneer 'numpy>=2.0' && \ pip install --no-cache-dir -r /var/modelscope/framework.txt && \ 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/tests.txt && \ 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 --no-cache-dir 'scipy<1.13.0' && \ + pip install --no-cache-dir 'scipy' && \ 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 'decord>=0.6.0' mpi4py paint_ldm ipykernel fasttext -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \ pip install --no-cache-dir 'blobfile>=1.0.5' && \ diff --git a/modelscope/models/cv/video_depth_estimation/models/model_checkpoint.py b/modelscope/models/cv/video_depth_estimation/models/model_checkpoint.py index 761990ff..b577ca60 100644 --- a/modelscope/models/cv/video_depth_estimation/models/model_checkpoint.py +++ b/modelscope/models/cv/video_depth_estimation/models/model_checkpoint.py @@ -40,7 +40,7 @@ class ModelCheckpoint: self.kth_best_model = '' self.best = 0 # Monitoring modes - torch_inf = torch.tensor(np.Inf) + torch_inf = torch.tensor(np.inf) mode_dict = { 'min': (torch_inf, 'min'), 'max': (-torch_inf, 'max'), diff --git a/modelscope/pipelines/multi_modal/soonet_video_temporal_grounding_pipeline.py b/modelscope/pipelines/multi_modal/soonet_video_temporal_grounding_pipeline.py index 0251e745..ff71c000 100644 --- a/modelscope/pipelines/multi_modal/soonet_video_temporal_grounding_pipeline.py +++ b/modelscope/pipelines/multi_modal/soonet_video_temporal_grounding_pipeline.py @@ -1,5 +1,6 @@ # Copyright 2022-2023 The Alibaba Fundamental Vision Team Authors. All rights reserved. +import math import os from typing import Any, Dict @@ -144,12 +145,12 @@ class SOONetVideoTemporalGroundingPipeline(Pipeline): start_ts, end_ts, scale_boundaries = list(), list(), [0] ori_video_length = len(imgs) pad_video_length = int( - np.math.ceil(ori_video_length / self.max_anchor_length) + math.ceil(ori_video_length / self.max_anchor_length) * self.max_anchor_length) for i in range(self.config.nscales): anchor_length = self.config.snippet_length * (2**i) pad_feat_length = pad_video_length // anchor_length - nfeats = np.math.ceil(ori_video_length / anchor_length) + nfeats = math.ceil(ori_video_length / anchor_length) s_times = np.arange(0, nfeats).astype(np.float32) * ( anchor_length // self.fps) e_times = np.arange(1, nfeats + 1).astype(np.float32) * ( @@ -180,7 +181,7 @@ class SOONetVideoTemporalGroundingPipeline(Pipeline): # ori_video_length, feat_dim = video_feats.shape pad_video_length = int( - np.math.ceil(ori_video_length / self.max_anchor_length) + math.ceil(ori_video_length / self.max_anchor_length) * self.max_anchor_length) pad_video_feats = torch.zeros((pad_video_length, feat_dim), dtype=float)