Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix]: fix numba numpy version not compatiable in circileci #1611

Merged
merged 5 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ workflows:
mapping: |
.circle/.* lint_only false
cmake/.* lint_only false
configs/.* lint_only false
configs/.* lint_only true
RunningLeon marked this conversation as resolved.
Show resolved Hide resolved
csrc/.* lint_only false
demo/csrc/.* lint_only false
docker/.* lint_only false
docker/.* lint_only true
docs/.* lint_only true
mmdeploy/.* lint_only false
requirements/.* lint_only false
tests/.* lint_only false
third_party/.* lint_only false
tools/.* lint_only false
setup.py lint_only false
base-revision: dev-1.x
# this is the path of the configuration we should trigger once
# path filtering and pipeline parameter value updates are
Expand Down
4 changes: 2 additions & 2 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ commands:
python -m mim install -r requirements/codebases.txt
python -m pip install -r requirements/tests.txt
python -m pip install -r requirements/runtime.txt
python -m pip install -U numpy clip
python -m pip install -U numpy clip numba
cd ..
perform_model_converter_ut:
steps:
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
docker exec mmdeploy mim install -r mmdeploy/requirements/codebases.txt
docker exec mmdeploy pip install -r mmdeploy/requirements/tests.txt
docker exec mmdeploy pip install -r mmdeploy/requirements/runtime.txt
docker exec mmdeploy pip install -U numpy clip
docker exec mmdeploy pip install -U numpy clip numba
- run:
name: Perform Model Converter unittests
command: |
Expand Down
80 changes: 20 additions & 60 deletions tests/test_codebase/test_mmcls/data/model.py
Original file line number Diff line number Diff line change
@@ -1,62 +1,25 @@
# Copyright (c) OpenMMLab. All rights reserved.
# model settings
model = dict(
type='ImageClassifier',
backbone=dict(
type='ResNet',
depth=50,
depth=18,
num_stages=4,
out_indices=(3, ),
style='pytorch'),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2048,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
topk=(1, 5),
))

# dataset settings
dataset_type = 'ImageNet'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Resize', size=(256, -1)),
dict(type='CenterCrop', crop_size=224),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img'])
]
data = dict(
samples_per_gpu=32,
workers_per_gpu=2,
test=dict(
type=dataset_type,
data_prefix='tests/test_codebase/test_mmcls/data/imgs',
ann_file='ann.txt',
pipeline=test_pipeline))
evaluation = dict(interval=1, metric='accuracy')

model = dict(
type='ImageClassifier',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(3, ),
style='pytorch'),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2048,
in_channels=512,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
topk=(1, 5)))
dataset_type = 'ImageNet'
data_preprocessor = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
num_classes=1000,
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='RandomResizedCrop', scale=224),
Expand All @@ -70,8 +33,8 @@
dict(type='PackClsInputs')
]
train_dataloader = dict(
batch_size=32,
num_workers=5,
batch_size=2,
num_workers=1,
dataset=dict(
type='ImageNet',
data_root='tests/test_codebase/test_mmcls/data/imgs',
Expand All @@ -83,11 +46,10 @@
dict(type='RandomFlip', prob=0.5, direction='horizontal'),
dict(type='PackClsInputs')
]),
sampler=dict(type='DefaultSampler', shuffle=True),
persistent_workers=True)
sampler=dict(type='DefaultSampler', shuffle=True))
val_dataloader = dict(
batch_size=32,
num_workers=5,
batch_size=2,
num_workers=1,
dataset=dict(
type='ImageNet',
data_root='tests/test_codebase/test_mmcls/data/imgs',
Expand All @@ -99,12 +61,11 @@
dict(type='CenterCrop', crop_size=224),
dict(type='PackClsInputs')
]),
sampler=dict(type='DefaultSampler', shuffle=False),
persistent_workers=True)
sampler=dict(type='DefaultSampler', shuffle=False))
val_evaluator = dict(type='Accuracy', topk=(1, 5))
test_dataloader = dict(
batch_size=32,
num_workers=5,
batch_size=2,
num_workers=1,
dataset=dict(
type='ImageNet',
data_root='tests/test_codebase/test_mmcls/data/imgs',
Expand All @@ -116,16 +77,16 @@
dict(type='CenterCrop', crop_size=224),
dict(type='PackClsInputs')
]),
sampler=dict(type='DefaultSampler', shuffle=False),
persistent_workers=True)
sampler=dict(type='DefaultSampler', shuffle=False))
test_evaluator = dict(type='Accuracy', topk=(1, 5))
optim_wrapper = dict(
optimizer=dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001))
param_scheduler = dict(
type='MultiStepLR', by_epoch=True, milestones=[30, 60, 90], gamma=0.1)
train_cfg = dict(by_epoch=True, max_epochs=100)
val_cfg = dict(interval=1)
train_cfg = dict(by_epoch=True, max_epochs=100, val_interval=1)
val_cfg = dict()
test_cfg = dict()
auto_scale_lr = dict(base_batch_size=256)
default_scope = 'mmcls'
default_hooks = dict(
timer=dict(type='IterTimerHook'),
Expand All @@ -140,9 +101,8 @@
dist_cfg=dict(backend='nccl'))
vis_backends = [dict(type='LocalVisBackend')]
visualizer = dict(
type='ClsVisualizer',
vis_backends=[dict(type='LocalVisBackend')],
name='visualizer')
type='ClsVisualizer', vis_backends=[dict(type='LocalVisBackend')])
log_level = 'INFO'
load_from = None
resume = False
randomness = dict(seed=None, deterministic=False)
5 changes: 3 additions & 2 deletions tests/test_codebase/test_mmcls/test_classification_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

IMAGE_SIZE = 64
NUM_CLASS = 1000
MODEL_CFG_PATH = 'tests/test_codebase/test_mmcls/data/model.py'

try:
import_codebase(Codebase.MMCLS)
Expand All @@ -31,7 +32,7 @@ def setup_class(cls):
# simplify backend inference
cls.wrapper = SwitchBackendWrapper(ORTWrapper)
cls.outputs = {
'outputs': torch.rand(1, 100),
'outputs': torch.rand(1, NUM_CLASS),
}
cls.wrapper.set(outputs=cls.outputs)
deploy_cfg = Config({'onnx_config': {'output_names': ['outputs']}})
Expand Down Expand Up @@ -99,7 +100,7 @@ def test_forward_test(self):

@backend_checker(Backend.ONNXRUNTIME)
def test_build_classification_model():
model_cfg = Config(dict(data=dict(test={'type': 'ImageNet'})))
model_cfg = Config.fromfile(MODEL_CFG_PATH)
deploy_cfg = Config(
dict(
backend_config=dict(type='onnxruntime'),
Expand Down