def suite(): suite = unittest.TestSuite() suite.addTest(managers.suite()) suite.addTest(base.suite()) suite.addTest(api.suite()) suite.addTest(frontend.suite()) return suite
import sys sys.path.insert(0, '..') import unittest import json import numpy as np import torch from model import DurIAN from base import suite, BaseModelForwardPassTest seed = 0 np.random.seed(seed) torch.manual_seed(seed) torch.backends.cudnn.deterministic = True class DurIANForwardPassTest(BaseModelForwardPassTest): def __init__(self, *args, **kwargs): super(DurIANForwardPassTest, self).__init__(*args, **kwargs) self.CLASS_TYPE = DurIAN with open('../configs/default.json') as f: self.config = json.load(f) self.config['n_symbols'] = 100 if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(suite([DurIANForwardPassTest]))
def __init__(self, *args, **kwargs): super(BaselineDurIANBackwardPassBCETest, self).__init__(*args, **kwargs) self.CLASS_TYPE = BaselineDurIAN with open('../configs/baseline.json') as f: self.config = json.load(f) self.config['n_symbols'] = 100 self.config['solve_alignments_as_mse'] = False self.config['solve_alignments_as_bce'] = True self.criterion = DurIANLoss(self.config) class BaselineDurIANBackwardPassJoinTest(BaseModelBackwardPassTest): def __init__(self, *args, **kwargs): super(BaselineDurIANBackwardPassJoinTest, self).__init__(*args, **kwargs) self.CLASS_TYPE = BaselineDurIAN with open('../configs/baseline.json') as f: self.config = json.load(f) self.config['n_symbols'] = 100 self.config['solve_alignments_as_mse'] = True self.config['solve_alignments_as_bce'] = True self.criterion = DurIANLoss(self.config) if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(suite([ BaselineDurIANBackwardPassMSETest, BaselineDurIANBackwardPassBCETest, BaselineDurIANBackwardPassJoinTest ]))
def __init__(self, *args, **kwargs): super(DurIANBackwardPassBCETest, self).__init__(*args, **kwargs) self.CLASS_TYPE = DurIAN with open('../configs/default.json') as f: self.config = json.load(f) self.config['n_symbols'] = 100 self.config['solve_alignments_as_mse'] = False self.config['solve_alignments_as_bce'] = True self.criterion = DurIANLoss(self.config) class DurIANBackwardPassJoinTest(BaseModelBackwardPassTest): def __init__(self, *args, **kwargs): super(DurIANBackwardPassJoinTest, self).__init__(*args, **kwargs) self.CLASS_TYPE = DurIAN with open('../configs/default.json') as f: self.config = json.load(f) self.config['n_symbols'] = 100 self.config['solve_alignments_as_mse'] = True self.config['solve_alignments_as_bce'] = True self.criterion = DurIANLoss(self.config) if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(suite([ DurIANBackwardPassMSETest, DurIANBackwardPassBCETest, DurIANBackwardPassJoinTest ]))
import sys sys.path.insert(0, '..') import unittest import json import numpy as np import torch from model import BaselineDurIAN from base import suite, BaseModelForwardPassTest seed = 0 np.random.seed(seed) torch.manual_seed(seed) torch.backends.cudnn.deterministic = True class BaselineDurIANForwardPassTest(BaseModelForwardPassTest): def __init__(self, *args, **kwargs): super(BaselineDurIANForwardPassTest, self).__init__(*args, **kwargs) self.CLASS_TYPE = BaselineDurIAN with open('../configs/baseline.json') as f: self.config = json.load(f) self.config['n_symbols'] = 100 if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(suite([BaselineDurIANForwardPassTest]))