| @@ -18,7 +18,7 @@ __all__ = ['SambertNetHifi16k'] | |||||
| def multi_label_symbol_to_sequence(my_classes, my_symbol): | def multi_label_symbol_to_sequence(my_classes, my_symbol): | ||||
| one_hot = MultiLabelBinarizer(my_classes) | |||||
| one_hot = MultiLabelBinarizer(classes=my_classes) | |||||
| tokens = my_symbol.strip().split(' ') | tokens = my_symbol.strip().split(' ') | ||||
| sequences = [] | sequences = [] | ||||
| for token in tokens: | for token in tokens: | ||||
| @@ -20,7 +20,6 @@ class GenericTtsFrontend(Model): | |||||
| def __init__(self, model_dir='.', lang_type='pinyin', *args, **kwargs): | def __init__(self, model_dir='.', lang_type='pinyin', *args, **kwargs): | ||||
| super().__init__(model_dir, *args, **kwargs) | super().__init__(model_dir, *args, **kwargs) | ||||
| import ttsfrd | import ttsfrd | ||||
| frontend = ttsfrd.TtsFrontendEngine() | frontend = ttsfrd.TtsFrontendEngine() | ||||
| zip_file = os.path.join(model_dir, 'resource.zip') | zip_file = os.path.join(model_dir, 'resource.zip') | ||||
| self._res_path = os.path.join(model_dir, 'resource') | self._res_path = os.path.join(model_dir, 'resource') | ||||
| @@ -39,6 +39,7 @@ class FillMaskPipeline(Pipeline): | |||||
| fill_mask_model.eval() | fill_mask_model.eval() | ||||
| super().__init__( | super().__init__( | ||||
| model=fill_mask_model, preprocessor=preprocessor, **kwargs) | model=fill_mask_model, preprocessor=preprocessor, **kwargs) | ||||
| self.preprocessor = preprocessor | self.preprocessor = preprocessor | ||||
| self.tokenizer = preprocessor.tokenizer | self.tokenizer = preprocessor.tokenizer | ||||
| self.mask_id = {'veco': 250001, 'sbert': 103} | self.mask_id = {'veco': 250001, 'sbert': 103} | ||||
| @@ -94,6 +95,7 @@ class FillMaskPipeline(Pipeline): | |||||
| pred_strings = [] | pred_strings = [] | ||||
| for ids in rst_ids: # batch | for ids in rst_ids: # batch | ||||
| # TODO vocab size is not stable | # TODO vocab size is not stable | ||||
| if self.model.config.vocab_size == 21128: # zh bert | if self.model.config.vocab_size == 21128: # zh bert | ||||
| pred_string = self.tokenizer.convert_ids_to_tokens(ids) | pred_string = self.tokenizer.convert_ids_to_tokens(ids) | ||||
| pred_string = ''.join(pred_string) | pred_string = ''.join(pred_string) | ||||
| @@ -1,25 +1,25 @@ | |||||
| #tts | #tts | ||||
| h5py==2.10.0 | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.1-cp36-cp36m-linux_x86_64.whl; python_version=='3.6' | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.1-cp37-cp37m-linux_x86_64.whl; python_version=='3.7' | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.1-cp38-cp38-linux_x86_64.whl; python_version=='3.8' | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.1-cp39-cp39-linux_x86_64.whl; python_version=='3.9' | |||||
| https://swap.oss-cn-hangzhou.aliyuncs.com/Jiaqi%2Fmaas%2Ftts%2Frequirements%2Fpytorch_wavelets-1.3.0-py3-none-any.whl?Expires=1685688388&OSSAccessKeyId=LTAI4Ffebq4d9jTVDwiSbY4L&Signature=jcQbg5EZ%2Bdys3%2F4BRn3srrKLdIg%3D | |||||
| h5py | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/pytorch_wavelets-1.3.0-py3-none-any.whl | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.2-cp36-cp36m-linux_x86_64.whl; python_version=='3.6' | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.2-cp37-cp37m-linux_x86_64.whl; python_version=='3.7' | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.2-cp38-cp38-linux_x86_64.whl; python_version=='3.8' | |||||
| https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/TTS/requirements/ttsfrd-0.0.2-cp39-cp39-linux_x86_64.whl; python_version=='3.9' | |||||
| inflect | inflect | ||||
| keras==2.2.4 | |||||
| keras | |||||
| librosa | librosa | ||||
| lxml | lxml | ||||
| matplotlib | matplotlib | ||||
| nara_wpe | nara_wpe | ||||
| numpy==1.18.* | |||||
| numpy | |||||
| protobuf>3,<=3.20 | protobuf>3,<=3.20 | ||||
| ptflops | ptflops | ||||
| PyWavelets>=1.0.0 | PyWavelets>=1.0.0 | ||||
| scikit-learn==0.23.2 | |||||
| scikit-learn | |||||
| sox | sox | ||||
| tensorboard | tensorboard | ||||
| tensorflow==1.15.* | tensorflow==1.15.* | ||||
| torch==1.10.* | |||||
| torch | |||||
| torchaudio | torchaudio | ||||
| torchvision | torchvision | ||||
| tqdm | tqdm | ||||
| @@ -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() >= 1, 'skip test in current test level') | |||||
| @unittest.skipUnless(test_level() >= 2, '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) | ||||
| @@ -87,7 +87,7 @@ class SequenceClassificationTest(unittest.TestCase): | |||||
| result = text_classification(dataset) | result = text_classification(dataset) | ||||
| self.printDataset(result) | self.printDataset(result) | ||||
| @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') | |||||
| @unittest.skipUnless(test_level() >= 2, 'skip test in current test level') | |||||
| def test_run_with_modelscope_dataset(self): | def test_run_with_modelscope_dataset(self): | ||||
| text_classification = pipeline(task=Tasks.text_classification) | text_classification = pipeline(task=Tasks.text_classification) | ||||
| # loaded from modelscope dataset | # loaded from modelscope dataset | ||||
| @@ -33,7 +33,7 @@ class ImgPreprocessor(Preprocessor): | |||||
| class PyDatasetTest(unittest.TestCase): | class PyDatasetTest(unittest.TestCase): | ||||
| @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') | |||||
| @unittest.skipUnless(test_level() >= 2, 'skip test in current test level') | |||||
| 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') | ||||
| @@ -49,7 +49,7 @@ class PyDatasetTest(unittest.TestCase): | |||||
| print(next(iter(ms_ds_train))) | print(next(iter(ms_ds_train))) | ||||
| print(next(iter(ms_image_train))) | print(next(iter(ms_image_train))) | ||||
| @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') | |||||
| @unittest.skipUnless(test_level() >= 2, 'skip test in current test level') | |||||
| @require_torch | @require_torch | ||||
| def test_to_torch_dataset_text(self): | def test_to_torch_dataset_text(self): | ||||
| model_id = 'damo/bert-base-sst2' | model_id = 'damo/bert-base-sst2' | ||||
| @@ -64,7 +64,7 @@ class PyDatasetTest(unittest.TestCase): | |||||
| dataloader = torch.utils.data.DataLoader(pt_dataset, batch_size=5) | dataloader = torch.utils.data.DataLoader(pt_dataset, batch_size=5) | ||||
| print(next(iter(dataloader))) | print(next(iter(dataloader))) | ||||
| @unittest.skipUnless(test_level() >= 1, 'skip test in current test level') | |||||
| @unittest.skipUnless(test_level() >= 2, 'skip test in current test level') | |||||
| @require_tf | @require_tf | ||||
| def test_to_tf_dataset_text(self): | def test_to_tf_dataset_text(self): | ||||
| import tensorflow as tf | import tensorflow as tf | ||||