Upgrade numpy to 2.x for 1.38 Docker images

- 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
This commit is contained in:
Yunnglin
2026-06-08 14:52:00 +08:00
parent d3effb7370
commit 7bb48a7d3d
4 changed files with 9 additions and 8 deletions

View File

@@ -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' && \

View File

@@ -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' && \

View File

@@ -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'),

View File

@@ -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)