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] Check circle ci memory #2016

Merged
merged 3 commits into from
Sep 4, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions tests/configs/aot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@
),
loss_disc_shift=dict(type='DiscShiftLoss', loss_weight=0.001),
)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/configs/deepfillv1_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,10 @@
loss_disc_shift=dict(type='DiscShiftLoss', loss_weight=0.001),
train_cfg=dict(disc_step=2, start_iter=0, local_size=(128, 128)),
)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/configs/gl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,10 @@
dict(type='GetMaskedImage'),
dict(type='PackInputs'),
]


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/configs/one_stage_gl.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@
loss_l1_valid=dict(type='L1Loss', loss_weight=1.0),
loss_tv=dict(type='MaskedTVLoss', loss_weight=0.01),
train_cfg=dict(disc_step=1))


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/configs/pconv_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@
type='MaskedTVLoss',
loss_weight=0.1,
))


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/configs/two_stage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,10 @@
),
loss_disc_shift=dict(type='DiscShiftLoss', loss_weight=0.001),
)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ def test_base_mmagic_inferencer():
inferencer_instance = BaseMMagicInferencer(cfg, None)
extra_parameters = inferencer_instance.get_extra_parameters()
assert len(extra_parameters) == 0


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ def test_colorization_inferencer():
img=data_path, result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img.shape == (256, 256, 3)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ def test_conditional_inferencer():
label=1, result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img.shape == (4, 3, 32, 32)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_apis/test_inferencers/test_eg3d_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,10 @@ def test_eg3d_inferencer():
interpolation='camera',
num_images=2,
result_out_dir=result_out_dir)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ def test_image_super_resolution_inferencer():
img=img_path, result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img.shape == (480, 500, 3)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_apis/test_inferencers/test_inference_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ def test_calculate_grid_size():
target_nrow = (3, 3, 3, 1, 2)
for bz, ratio, tar in zip(inp_batch_size, aspect_ratio, target_nrow):
assert calculate_grid_size(bz, ratio) == tar


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ def test_inpainting_inferencer():
img=masked_img_path, mask=mask_path, result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img.shape == (256, 256, 3)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_apis/test_inferencers/test_matting_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ def test_matting_inferencer():
img=img_path, trimap=trimap_path, result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img.numpy().shape == (552, 800)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_apis/test_inferencers/test_mmedit_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ def test_mmagic_inferencer():

extra_parameters = inferencer_instance.get_extra_parameters()
assert len(extra_parameters) == 2


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,10 @@ def test_translation(self):
text=text, result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img[0].cpu().numpy().shape == (3, 32, 32)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ def test_translation_inferencer():
img=data_path, result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img[0].cpu().numpy().shape == (3, 256, 256)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ def test_unconditional_inferencer():
inference_result = inferencer_instance(result_out_dir=result_out_dir)
result_img = inference_result[1]
assert result_img.detach().numpy().shape == (1, 3, 256, 256)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ def test_video_interpolation_inferencer_fps_multiplier():
inference_result = inferencer_instance(
video=video_path, result_out_dir=result_out_dir)
assert inference_result is None


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ def test_video_restoration_inferencer_max_seq_len():
inference_result = inferencer_instance(
video=video_path, result_out_dir=result_out_dir)
assert inference_result is None


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_apis/test_mmagic_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ def test_edit():

if __name__ == '__main__':
test_edit()


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_basic_conditional_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,10 @@ def test_init(self):
[1, 2, 3, 4])
self.assertEqual(dataset[1]['data_samples'].gt_label.label.tolist(),
[1, 4, 5, 3])


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_basic_frames_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,3 +698,10 @@ def test_vfi_ann_dataset(self):
'00000000.png')
],
sample_idx=1)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_basic_image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,10 @@ def test_refsr_folder_dataset(self):
gt_path=str(self.data_root / 'gt' / 'baboon.png'),
ref_path=str(self.data_root / 'gt' / 'baboon.png'),
sample_idx=0)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ def test_cifar10_categories():

def test_imagenet_categories():
assert len(IMAGENET_CATEGORIES) == 1000


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_cifar10_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,10 @@ def test_extra_repr(self):
@classmethod
def tearDownClass(cls):
cls.tmpdir.cleanup()


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_comp1k_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,10 @@ def test_comp1k_dataset(self):
# assert 'alpha' in first_data
# assert isinstance(first_data['alpha'], np.ndarray)
# assert first_data['alpha'].shape == (552, 800)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_controlnet_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ def test_controlnet_dataset():
assert 'source_path' in data
assert 'target_path' in data
assert data['prompt'] == prompts[idx]


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ def test_infer_io_backend():


# TODO: add more uts


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_dreambooth_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ def test_dreambooth_dataset():
assert len(dataset) == 2
for data in dataset:
assert data['prompt'] == 'a sks ball'


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_grow_scale_image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@ def test_dynamic_unconditional_img_dataset(self):

with pytest.raises(AssertionError):
_ = GrowScaleImgDataset(10, self.default_pipeline, 10.)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_imagenet_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ def test_load_data_list(self):
with self.assertRaisesRegex(
AssertionError, r"\(3\) doesn't match .* classes \(1000\)"):
ImageNet(data_root=DATA_DIR, data_prefix=DATA_DIR)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_mscoco_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ def test_mscoco(self):
img_path=os.path.join(self.data_root, 'val2014',
'COCO_val2014_000000000042.jpg'),
sample_idx=0)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_paired_image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,10 @@ def test_paired_image_dataset(self):
assert img.ndim == 3
img = dataset[0]['inputs']['img_b']
assert img.ndim == 3


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_singan_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ def test_singan_dataset(self):
a = TestSinGANDataset()
a.setup_class()
a.test_singan_dataset()


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
7 changes: 7 additions & 0 deletions tests/test_datasets/test_transforms/test_albumentations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ def test_albumentations():
])
results = model(results)
assert results['img'].shape == (4, 4, 3)


def teardown_module():
import gc
gc.collect()
globals().clear()
locals().clear()
Loading
Loading