* pydataset unitest
Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9132896
master
| @@ -78,7 +78,7 @@ class Registry(object): | |||||
| f'{self._name}[{default_group}] and will ' | f'{self._name}[{default_group}] and will ' | ||||
| 'be overwritten') | 'be overwritten') | ||||
| logger.warning(f'{self._modules[default_group][module_name]}' | logger.warning(f'{self._modules[default_group][module_name]}' | ||||
| 'to {module_cls}') | |||||
| f'to {module_cls}') | |||||
| # also register module in the default group for faster access | # also register module in the default group for faster access | ||||
| # only by module name | # only by module name | ||||
| self._modules[default_group][module_name] = module_cls | self._modules[default_group][module_name] = module_cls | ||||
| @@ -60,7 +60,7 @@ class ImageMattingTest(unittest.TestCase): | |||||
| cv2.imwrite('result.png', result['output_png']) | cv2.imwrite('result.png', result['output_png']) | ||||
| print(f'Output written to {osp.abspath("result.png")}') | print(f'Output written to {osp.abspath("result.png")}') | ||||
| @unittest.skipUnless(test_level() >= 2, 'skip test in current test level') | |||||
| @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') | |||||
| def test_run_with_modelscope_dataset(self): | def test_run_with_modelscope_dataset(self): | ||||
| dataset = PyDataset.load('beans', split='train', target='image') | dataset = PyDataset.load('beans', split='train', target='image') | ||||
| img_matting = pipeline(Tasks.image_matting, model=self.model_id) | img_matting = pipeline(Tasks.image_matting, model=self.model_id) | ||||
| @@ -33,8 +33,6 @@ class ImgPreprocessor(Preprocessor): | |||||
| class PyDatasetTest(unittest.TestCase): | class PyDatasetTest(unittest.TestCase): | ||||
| @unittest.skipUnless(test_level() >= 2, | |||||
| 'skip test due to dataset api problem') | |||||
| def test_ds_basic(self): | def test_ds_basic(self): | ||||
| ms_ds_full = PyDataset.load('squad') | ms_ds_full = PyDataset.load('squad') | ||||
| ms_ds_full_hf = hfdata.load_dataset('squad') | ms_ds_full_hf = hfdata.load_dataset('squad') | ||||