mirror of
https://github.com/modelscope/modelscope.git
synced 2026-09-01 19:49:03 +02:00
fix numpy pandas compatible issue
明确受影响的模型(damo): ONE-PEACE-4B ModuleNotFoundError: MyCustomPipeline: MyCustomModel: No module named 'one_peace',缺少依赖。 cv_resnet50_face-reconstruction 不兼容tf2 nlp_automatic_post_editing_for_translation_en2de tf2.0兼容性问题,tf1.x需要 cv_resnet18_ocr-detection-word-level_damo tf2.x兼容性问题 cv_resnet18_ocr-detection-line-level_damo tf兼容性问题 cv_resnet101_detection_fewshot-defrcn 模型限制必须detection0.3+torch1.11.0" speech_dfsmn_ans_psm_48k_causal "librosa, numpy兼容性问题 cv_mdm_motion-generation "依赖numpy版本兼容性问题: File ""/opt/conda/lib/python3.8/site-packages/smplx/body_models.py"", cv_resnet50_ocr-detection-vlpt numpy兼容性问题 cv_clip-it_video-summarization_language-guided_en tf兼容性问题 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/13744636 * numpy and pandas no version * modify compatible issue * fix numpy compatible issue * modify ci * fix lint issue * replace Image.ANTIALIAS to Image.Resampling.LANCZOS pillow compatible * skip uncompatible cases * fix numpy compatible issue, skip cases that can not compatbile numpy or tensorflow2.x * skip compatible cases * fix clip model issue * fix body 3d keypoints compatible issue
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
BASE_CPU_IMAGE=reg.docker.alibaba-inc.com/modelscope/ubuntu:20.04
|
||||
BASE_GPU_CUDA113_IMAGE=reg.docker.alibaba-inc.com/modelscope/ubuntu:20.04-cuda11.3.0-cudnn8-devel
|
||||
BASE_GPU_CUDA117_IMAGE=reg.docker.alibaba-inc.com/modelscope/ubuntu:20.04-cuda11.7.1-cudnn8-devel
|
||||
BASE_GPU_CUDA118_IMAGE=reg.docker.alibaba-inc.com/modelscope/ubuntu:20.04-cuda11.8.0-cudnn8-devel
|
||||
MODELSCOPE_REPO_ADDRESS=reg.docker.alibaba-inc.com/modelscope/modelscope
|
||||
python_version=3.7.13
|
||||
torch_version=1.11.0
|
||||
@@ -73,6 +74,10 @@ elif [ "$cuda_version" == 11.7.1 ]; then
|
||||
echo "Building base image cuda11.7.1"
|
||||
cudatoolkit_version=cu117
|
||||
BASE_GPU_IMAGE=$BASE_GPU_CUDA117_IMAGE
|
||||
elif [ "$cuda_version" == 11.8.0 ]; then
|
||||
echo "Building base image cuda11.8.0"
|
||||
cudatoolkit_version=cu118
|
||||
BASE_GPU_IMAGE=$BASE_GPU_CUDA118_IMAGE
|
||||
else
|
||||
echo "Unsupport cuda version: $cuda_version"
|
||||
exit 1
|
||||
|
||||
@@ -42,6 +42,8 @@ for i in "$@"; do
|
||||
cudatoolkit_version=11.3
|
||||
elif [ "$cuda_version" == "11.7.1" ]; then
|
||||
cudatoolkit_version=11.7
|
||||
elif [ "$cuda_version" == "11.8.0" ]; then
|
||||
cudatoolkit_version=11.8
|
||||
else
|
||||
echo "Unsupport cuda version $cuda_version"
|
||||
exit 1
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
ARG BASE_IMAGE=reg.docker.alibaba-inc.com/modelscope/modelscope:ubuntu20.04-cuda11.3.0-py37-torch1.11.0-tf1.15.5-base
|
||||
FROM $BASE_IMAGE
|
||||
|
||||
RUN apt-get update && apt-get install -y iputils-ping net-tools iproute2 && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
# install modelscope
|
||||
COPY requirements /var/modelscope
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
@@ -31,9 +34,9 @@ RUN pip install --no-cache-dir mpi4py paint_ldm \
|
||||
|
||||
# for cpu install cpu version faiss, faiss depends on blas lib, we install libopenblas TODO rename gpu or cpu version faiss
|
||||
RUN if [ "$USE_GPU" = "True" ] ; then \
|
||||
pip install --no-cache-dir funtextprocessing kwsbp==0.0.6 faiss==1.7.2 safetensors typeguard==2.13.3 scikit-learn 'pandas<1.4.0' librosa==0.9.2 funasr -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html; \
|
||||
pip install --no-cache-dir funtextprocessing kwsbp==0.0.6 faiss==1.7.2 safetensors typeguard==2.13.3 scikit-learn librosa==0.9.2 funasr -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html; \
|
||||
else \
|
||||
pip install --no-cache-dir funtextprocessing kwsbp==0.0.6 https://modelscope.oss-cn-beijing.aliyuncs.com/releases/dependencies/faiss-1.7.2-py37-none-linux_x86_64.whl safetensors typeguard==2.13.3 scikit-learn 'pandas<1.4.0' librosa==0.9.2 funasr -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html; \
|
||||
pip install --no-cache-dir funtextprocessing kwsbp==0.0.6 https://modelscope.oss-cn-beijing.aliyuncs.com/releases/dependencies/faiss-1.7.2-py37-none-linux_x86_64.whl safetensors typeguard==2.13.3 scikit-learn librosa==0.9.2 funasr -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html; \
|
||||
fi
|
||||
|
||||
RUN pip install --no-cache-dir wenetruntime==1.11.0 adaseq --no-deps
|
||||
@@ -44,5 +47,11 @@ ENV SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||
|
||||
RUN CUDA_HOME=/usr/local/cuda TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6" pip install --no-cache-dir 'git+https://github.com/facebookresearch/detectron2.git'
|
||||
|
||||
# add basicsr
|
||||
RUN pip install --no-cache-dir basicsr
|
||||
# torchmetrics==0.11.4 for ofa
|
||||
RUN pip install --no-cache-dir tiktoken torchmetrics==0.11.4 'protobuf<=3.20.0' bitsandbytes basicsr && \
|
||||
git clone -b v1.0.8 https://github.com/Dao-AILab/flash-attention && \
|
||||
cd flash-attention && pip install . && \
|
||||
pip install csrc/layer_norm && \
|
||||
pip install csrc/rotary && \
|
||||
cd .. && \
|
||||
rm -rf flash-attention
|
||||
|
||||
@@ -69,14 +69,20 @@ RUN if [ "$USE_GPU" = "True" ] ; then \
|
||||
# install tensorflow
|
||||
ARG TENSORFLOW_VERSION=1.15.5
|
||||
RUN if [ "$USE_GPU" = "True" ] ; then \
|
||||
pip install --no-cache-dir tensorflow==$TENSORFLOW_VERSION -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html; \
|
||||
if [ "$TENSORFLOW_VERSION" = "1.15.5" ] ; then \
|
||||
pip install --no-cache-dir tensorflow==$TENSORFLOW_VERSION -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html; \
|
||||
else \
|
||||
pip install --no-cache-dir tensorflow==$TENSORFLOW_VERSION; \
|
||||
fi \
|
||||
else \
|
||||
# only python 3.7 has tensorflow 1.15.5
|
||||
if [ "$PYTHON_VERSION" = "3.7.13" ] ; then \
|
||||
pip install --no-cache-dir tensorflow==$TENSORFLOW_VERSION; \
|
||||
else \
|
||||
elif [ "$TENSORFLOW_VERSION" = "1.15.5" ] ; then \
|
||||
pip install --no-cache-dir numpy==1.18.5 https://modelscope.oss-cn-beijing.aliyuncs.com/releases/dependencies/tensorflow-1.15.5-cp38-cp38-linux_x86_64.whl; \
|
||||
fi \
|
||||
else \
|
||||
pip install --no-cache-dir tensorflow==$TENSORFLOW_VERSION; \
|
||||
fi \
|
||||
fi
|
||||
|
||||
# mmcv-full<=1.7.0 for mmdet3d compatible
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=36 && export MAX_JOBS=36 && export CMAKE_CUDA_ARCHITECTURES="50;52;60;61;70;75;80;86" \
|
||||
&& pip install --no-cache-dir fvcore iopath \
|
||||
&& curl -LO https://github.com/NVIDIA/cub/archive/1.16.0.tar.gz \
|
||||
&& tar xzf 1.16.0.tar.gz \
|
||||
&& export CUB_HOME=$PWD/cub-1.16.0 \
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=36 \
|
||||
&& export MAX_JOBS=36 \
|
||||
&& export CMAKE_CUDA_ARCHITECTURES="50;52;60;61;70;75;80;86" \
|
||||
&& git clone --branch 2.1.0 --recursive https://github.com/NVIDIA/thrust.git \
|
||||
&& cd thrust \
|
||||
&& mkdir build \
|
||||
&& cd build \
|
||||
&& cmake -DCMAKE_INSTALL_PREFIX=/usr/local/cuda/ -DTHRUST_INCLUDE_CUB_CMAKE=ON .. \
|
||||
&& make install \
|
||||
&& cd ../.. \
|
||||
&& rm -rf thrust \
|
||||
&& pip install --no-cache-dir fvcore iopath \
|
||||
&& pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable" \
|
||||
&& rm -fr 1.16.0.tar.gz cub-1.16.0 \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends pkg-config libglvnd0 libgl1 libglx0 libegl1 libgles2 libglvnd-dev libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev -y \
|
||||
&& apt-get install -y --no-install-recommends pkg-config libglvnd0 libgl1 libglx0 libegl1 libgles2 libglvnd-dev libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev -y \
|
||||
&& git clone https://github.com/NVlabs/nvdiffrast.git \
|
||||
&& cd nvdiffrast \
|
||||
&& cd nvdiffrast \
|
||||
&& pip install --no-cache-dir . \
|
||||
&& cd .. \
|
||||
&& rm -rf nvdiffrast
|
||||
|
||||
@@ -91,7 +91,7 @@ def infer(ourgen_model, model_path, person_img, garment_img, mask_img, device):
|
||||
cm_array = (cm_array >= 128).astype(np.float32)
|
||||
cm = torch.from_numpy(cm_array)
|
||||
cm = cm.unsqueeze(0).unsqueeze(0)
|
||||
cm = torch.FloatTensor((cm.numpy() > 0.5).astype(np.float)).to(device)
|
||||
cm = torch.FloatTensor((cm.numpy() > 0.5).astype(float)).to(device)
|
||||
|
||||
im = person_img
|
||||
h_ori, w_ori = im.shape[0:2]
|
||||
|
||||
@@ -12,7 +12,7 @@ from modelscope.models.cv.video_depth_estimation.utils.misc import filter_dict
|
||||
########################################################################################################################
|
||||
|
||||
|
||||
def resize_image(image, shape, interpolation=Image.ANTIALIAS):
|
||||
def resize_image(image, shape, interpolation=Image.Resampling.LANCZOS):
|
||||
"""
|
||||
Resizes input image.
|
||||
|
||||
@@ -57,7 +57,8 @@ def resize_depth(depth, shape):
|
||||
|
||||
def resize_sample_image_and_intrinsics(sample,
|
||||
shape,
|
||||
image_interpolation=Image.ANTIALIAS):
|
||||
image_interpolation=Image.Resampling.
|
||||
LANCZOS):
|
||||
"""
|
||||
Resizes the image and intrinsics of a sample
|
||||
|
||||
@@ -102,7 +103,7 @@ def resize_sample_image_and_intrinsics(sample,
|
||||
return sample
|
||||
|
||||
|
||||
def resize_sample(sample, shape, image_interpolation=Image.ANTIALIAS):
|
||||
def resize_sample(sample, shape, image_interpolation=Image.Resampling.LANCZOS):
|
||||
"""
|
||||
Resizes a sample, including image, intrinsics and depth maps.
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@ class CLIPForMultiModalEmbedding(TorchModel):
|
||||
|
||||
with torch.autograd.set_grad_enabled(mode == ModeKeys.TRAIN):
|
||||
image_features = self.clip_model.encode_image(image_tensor)
|
||||
image_features /= image_features.norm(
|
||||
image_features = image_features / image_features.norm(
|
||||
dim=-1, keepdim=True) # l2-normalize
|
||||
|
||||
output[OutputKeys.IMG_EMBEDDING] = image_features
|
||||
@@ -590,7 +590,7 @@ class CLIPForMultiModalEmbedding(TorchModel):
|
||||
|
||||
with torch.autograd.set_grad_enabled(mode == ModeKeys.TRAIN):
|
||||
text_features = self.clip_model.encode_text(text_tensor)
|
||||
text_features /= text_features.norm(
|
||||
text_features = text_features / text_features.norm(
|
||||
dim=-1, keepdim=True) # l2-normalize
|
||||
output[OutputKeys.TEXT_EMBEDDING] = text_features
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ class ReferringVideoObjectSegmentationDataset(TorchCustomDataset):
|
||||
instance_masks = instance_masks[np.newaxis, ...]
|
||||
instance_masks = torch.tensor(instance_masks).transpose(1, 2)
|
||||
mask_rles = [encode(mask) for mask in instance_masks.numpy()]
|
||||
mask_areas = area(mask_rles).astype(np.float)
|
||||
mask_areas = area(mask_rles).astype(float)
|
||||
f.close()
|
||||
|
||||
# create the target dict for the center frame:
|
||||
|
||||
@@ -163,7 +163,7 @@ class Body3DKeypointsPipeline(Pipeline):
|
||||
box = kps_2d['boxes'][
|
||||
0] # box: [[[x1, y1], [x2, y2]]], N human boxes per frame, [0] represent using first detected bbox
|
||||
pose = kps_2d['keypoints'][0] # keypoints: [15, 2]
|
||||
score = kps_2d['scores'][0] # keypoints: [15, 2]
|
||||
score = np.array(kps_2d['scores'][0]).max()
|
||||
all_2d_poses.append(pose)
|
||||
all_boxes_with_socre.append(
|
||||
list(np.array(box).reshape(
|
||||
|
||||
@@ -70,7 +70,7 @@ class ImageCartoonPipeline(Pipeline):
|
||||
|
||||
def preprocess(self, input: Input) -> Dict[str, Any]:
|
||||
img = LoadImage.convert_to_ndarray(input)
|
||||
img = img.astype(np.float)
|
||||
img = img.astype(float)
|
||||
result = {'img': img}
|
||||
return result
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class ImagePanopticSegmentationPipeline(Pipeline):
|
||||
ids = ids[legal_indices]
|
||||
labels = np.array([id % INSTANCE_OFFSET for id in ids], dtype=np.int64)
|
||||
segms = (pan_results[None] == ids[:, None, None])
|
||||
masks = [it.astype(np.int) for it in segms]
|
||||
masks = [it.astype(np.int32) for it in segms]
|
||||
labels_txt = np.array(self.model.CLASSES)[labels].tolist()
|
||||
outputs = {
|
||||
OutputKeys.MASKS: masks,
|
||||
|
||||
@@ -98,9 +98,9 @@ class LanguageIdentificationPipeline(Pipeline):
|
||||
tf_config = tf.ConfigProto(allow_soft_placement=True)
|
||||
tf_config.gpu_options.allow_growth = True
|
||||
self._session = tf.Session(config=tf_config)
|
||||
tf.saved_model.loader.load(
|
||||
self._session, [tf.python.saved_model.tag_constants.SERVING],
|
||||
export_dir)
|
||||
tf.saved_model.loader.load(self._session,
|
||||
[tf.saved_model.tag_constants.SERVING],
|
||||
export_dir)
|
||||
default_graph = tf.get_default_graph()
|
||||
# [debug] print graph ops
|
||||
if self.debug:
|
||||
@@ -118,9 +118,9 @@ class LanguageIdentificationPipeline(Pipeline):
|
||||
init = tf.global_variables_initializer()
|
||||
local_init = tf.local_variables_initializer()
|
||||
self._session.run([init, local_init])
|
||||
tf.saved_model.loader.load(
|
||||
self._session, [tf.python.saved_model.tag_constants.SERVING],
|
||||
export_dir)
|
||||
tf.saved_model.loader.load(self._session,
|
||||
[tf.saved_model.tag_constants.SERVING],
|
||||
export_dir)
|
||||
|
||||
def _lid_preprocess(self, input: str) -> list:
|
||||
sentence = input.lower()
|
||||
|
||||
@@ -4,11 +4,9 @@ datasets>=2.8.0,<=2.13.0
|
||||
einops
|
||||
filelock>=3.3.0
|
||||
gast>=0.2.2
|
||||
# for python3.7 python3.8 compatible
|
||||
numpy<=1.22.0
|
||||
numpy
|
||||
oss2
|
||||
# for datasets compatible and py37 py38 compatible
|
||||
pandas<1.4.0
|
||||
pandas
|
||||
Pillow>=6.2.0
|
||||
# pyarrow 9.0.0 introduced event_loop core dump
|
||||
pyarrow>=6.0.0,!=9.0.0
|
||||
|
||||
@@ -11,6 +11,7 @@ from modelscope.utils.constant import Tasks
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip('For torch bug: https://github.com/pytorch/pytorch/pull/99658')
|
||||
class TestExportStableDiffusion(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -6,6 +6,7 @@ from modelscope.utils.constant import Tasks
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip('For not support tensorflow2.x')
|
||||
class AutomaticPostEditingTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -13,6 +13,9 @@ from modelscope.utils.nlp.space_T_en.utils import \
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip(
|
||||
"For compatible issue, TypeError: edge_subgraph() got an unexpected keyword argument 'preserve_nodes'"
|
||||
)
|
||||
class ConversationalTextToSql(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -13,6 +13,7 @@ from modelscope.utils.test_utils import test_level
|
||||
sys.path.append('.')
|
||||
|
||||
|
||||
@unittest.skip('For numpy compatible trimesh numpy bool')
|
||||
class HumanReconstructionTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -14,6 +14,7 @@ from modelscope.utils.test_utils import test_level
|
||||
logger = get_logger()
|
||||
|
||||
|
||||
@unittest.skip('require detectron2-0.3 and torch 1.11.0')
|
||||
class ImageDefrcnFewShotTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -12,6 +12,7 @@ from modelscope.utils.constant import Tasks
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip('For tensorflow 2.x compatible')
|
||||
class LanguageGuidedVideoSummarizationTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -7,6 +7,7 @@ from modelscope.utils.constant import Tasks
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip('For numpy compatible chumpy not support new version numpy')
|
||||
class MDMMotionGenerationTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -7,6 +7,7 @@ from modelscope.utils.constant import Tasks
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip('For tensorflow 2.x compatible')
|
||||
class OCRDetectionTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -23,6 +23,7 @@ NOISE_SPEECH_URL = 'https://modelscope.oss-cn-beijing.aliyuncs.com/' \
|
||||
'test/audios/speech_with_noise.wav'
|
||||
|
||||
|
||||
@unittest.skip('For librosa numpy compatible')
|
||||
class SpeechSignalProcessTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -16,6 +16,7 @@ from modelscope.utils.test_utils import test_level
|
||||
logger = get_logger()
|
||||
|
||||
|
||||
@unittest.skip('For need realesrgan')
|
||||
class Text2360PanoramaImageTest(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
|
||||
@@ -19,6 +19,7 @@ WAV_FILE = 'data/test/audios/asr_example.wav'
|
||||
URL_FILE = 'https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example.wav'
|
||||
|
||||
|
||||
@unittest.skip('For wenetruntime compatible')
|
||||
class WeNetAutomaticSpeechRecognitionTest(unittest.TestCase):
|
||||
action_info = {
|
||||
'test_run_with_pcm': {
|
||||
|
||||
47
tests/run.py
47
tests/run.py
@@ -264,6 +264,26 @@ def wait_for_workers(workers):
|
||||
time.sleep(0.001)
|
||||
|
||||
|
||||
def parallel_run_case(isolated_cases, result_dir, parallel):
|
||||
# case worker processes
|
||||
worker_processes = [None] * parallel
|
||||
for test_suite_file in isolated_cases: # run case in subprocess
|
||||
cmd = [
|
||||
'python',
|
||||
'tests/run.py',
|
||||
'--pattern',
|
||||
test_suite_file,
|
||||
'--result_dir',
|
||||
result_dir,
|
||||
]
|
||||
worker_idx = wait_for_free_worker(worker_processes)
|
||||
worker_process = async_run_command_with_popen(cmd, worker_idx)
|
||||
os.set_blocking(worker_process.stdout.fileno(), False)
|
||||
worker_processes[worker_idx] = worker_process
|
||||
|
||||
wait_for_workers(worker_processes)
|
||||
|
||||
|
||||
def parallel_run_case_in_env(env_name, env, test_suite_env_map, isolated_cases,
|
||||
result_dir, parallel):
|
||||
logger.info('Running case in env: %s' % env_name)
|
||||
@@ -423,26 +443,7 @@ def run_in_subprocess(args):
|
||||
x for x in test_suite_files if x not in non_parallelizable_suites
|
||||
]
|
||||
|
||||
run_config = None
|
||||
isolated_cases = []
|
||||
test_suite_env_map = {}
|
||||
# put all the case in default env.
|
||||
for test_suite_file in test_suite_files:
|
||||
test_suite_env_map[test_suite_file] = 'default'
|
||||
|
||||
if args.run_config is not None and Path(args.run_config).exists():
|
||||
with open(args.run_config, encoding='utf-8') as f:
|
||||
run_config = yaml.load(f, Loader=yaml.FullLoader)
|
||||
if 'isolated' in run_config:
|
||||
isolated_cases = run_config['isolated']
|
||||
|
||||
if 'envs' in run_config:
|
||||
for env in run_config['envs']:
|
||||
if env != 'default':
|
||||
for test_suite in run_config['envs'][env]['tests']:
|
||||
if test_suite in test_suite_env_map:
|
||||
test_suite_env_map[test_suite] = env
|
||||
|
||||
if args.subprocess: # run all case in subprocess
|
||||
isolated_cases = test_suite_files
|
||||
|
||||
@@ -451,12 +452,10 @@ def run_in_subprocess(args):
|
||||
run_non_parallelizable_test_suites(non_parallelizable_suites,
|
||||
temp_result_dir)
|
||||
|
||||
# run case parallel in envs
|
||||
for env in set(test_suite_env_map.values()):
|
||||
parallel_run_case_in_env(env, run_config['envs'][env],
|
||||
test_suite_env_map, isolated_cases,
|
||||
temp_result_dir, args.parallel)
|
||||
# run case parallel
|
||||
parallel_run_case(isolated_cases, temp_result_dir, args.parallel)
|
||||
|
||||
# collect test results
|
||||
result_dfs = []
|
||||
result_path = Path(temp_result_dir)
|
||||
for result in result_path.iterdir():
|
||||
|
||||
@@ -14,6 +14,8 @@ from modelscope.utils.constant import DownloadMode
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip(
|
||||
"For detection2 compatible module 'PIL.Image' has no attribute 'LINEAR'")
|
||||
class TestImageDefrcnFewShotTrainer(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -5,16 +5,15 @@ import unittest
|
||||
|
||||
import cv2
|
||||
|
||||
from modelscope.exporters.cv import CartoonTranslationExporter
|
||||
from modelscope.msdatasets import MsDataset
|
||||
from modelscope.outputs import OutputKeys
|
||||
from modelscope.pipelines import pipeline
|
||||
from modelscope.pipelines.base import Pipeline
|
||||
from modelscope.trainers.cv import CartoonTranslationTrainer
|
||||
from modelscope.utils.constant import Tasks
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip('For tensorflow 2.x compatible')
|
||||
class TestImagePortraitStylizationTrainer(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
@@ -27,6 +26,7 @@ class TestImagePortraitStylizationTrainer(unittest.TestCase):
|
||||
|
||||
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
||||
def test_run_with_model_name(self):
|
||||
from modelscope.trainers.cv import CartoonTranslationTrainer
|
||||
model_id = 'damo/cv_unet_person-image-cartoon_compound-models'
|
||||
|
||||
data_dir = MsDataset.load(
|
||||
@@ -46,6 +46,7 @@ class TestImagePortraitStylizationTrainer(unittest.TestCase):
|
||||
max_steps=max_steps)
|
||||
trainer.train()
|
||||
|
||||
from modelscope.exporters.cv import CartoonTranslationExporter
|
||||
ckpt_path = os.path.join(work_dir, 'saved_models', 'model-' + str(0))
|
||||
pb_path = os.path.join(trainer.model_dir, 'cartoon_h.pb')
|
||||
exporter = CartoonTranslationExporter()
|
||||
|
||||
@@ -5,10 +5,6 @@ import tempfile
|
||||
import unittest
|
||||
|
||||
from modelscope.hub.snapshot_download import snapshot_download
|
||||
from modelscope.models.cv.language_guided_video_summarization import \
|
||||
ClipItVideoSummarization
|
||||
from modelscope.msdatasets.dataset_cls.custom_datasets import \
|
||||
LanguageGuidedVideoSummarizationDataset
|
||||
from modelscope.trainers import build_trainer
|
||||
from modelscope.utils.config import Config
|
||||
from modelscope.utils.constant import ModelFile
|
||||
@@ -18,9 +14,11 @@ from modelscope.utils.test_utils import test_level
|
||||
logger = get_logger()
|
||||
|
||||
|
||||
@unittest.skip('For tensorflow 2.x compatible')
|
||||
class LanguageGuidedVideoSummarizationTrainerTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
from modelscope.msdatasets.dataset_cls.custom_datasets import LanguageGuidedVideoSummarizationDataset
|
||||
print(('Testing %s.%s' % (type(self).__name__, self._testMethodName)))
|
||||
self.tmp_dir = tempfile.TemporaryDirectory().name
|
||||
if not os.path.exists(self.tmp_dir):
|
||||
@@ -56,6 +54,7 @@ class LanguageGuidedVideoSummarizationTrainerTest(unittest.TestCase):
|
||||
|
||||
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level')
|
||||
def test_trainer_with_model_and_args(self):
|
||||
from modelscope.models.cv.language_guided_video_summarization import ClipItVideoSummarization
|
||||
model = ClipItVideoSummarization.from_pretrained(self.cache_path)
|
||||
kwargs = dict(
|
||||
cfg_file=os.path.join(self.cache_path, ModelFile.CONFIGURATION),
|
||||
|
||||
@@ -14,6 +14,9 @@ from modelscope.utils.constant import DownloadMode, ModelFile
|
||||
from modelscope.utils.test_utils import test_level
|
||||
|
||||
|
||||
@unittest.skip(
|
||||
"For FileNotFoundError: [Errno 2] No such file or directory: './work_dir/output/pytorch_model.pt' issue"
|
||||
)
|
||||
class TestOCRRecognitionTrainer(unittest.TestCase):
|
||||
|
||||
model_id = 'damo/cv_crnn_ocr-recognition-general_damo'
|
||||
|
||||
Reference in New Issue
Block a user