def _wrapper(self, bit=10, mulaw=True): model = _create_model(local_size=0) dataset = SignWaveDataset( sampling_rate=sampling_rate, sampling_length=sampling_length, bit=bit, mulaw=mulaw, ) updater, reporter = setup_support(batch_size, gpu, model, dataset) trained_nll = _get_trained_nll() def _first_hook(o): self.assertTrue(o["main/nll_coarse"] > trained_nll) def _last_hook(o): self.assertTrue(o["main/nll_coarse"] < trained_nll) train_support(iteration, reporter, updater, _first_hook, _last_hook) # save model torch.save( model.predictor.state_dict(), "/tmp/" f"test_training_wavernn" f"-bit={bit}" f"-mulaw={mulaw}" f"-speaker_size=0" f"-iteration={iteration}.pth", )
def _wrapper(self, bit=10, mulaw=True): scale = 4 model = _create_model( local_size=2 * scale, local_scale=scale, ) dataset = DownLocalRandomDataset( sampling_rate=sampling_rate, sampling_length=sampling_length, scale=scale, bit=bit, mulaw=mulaw, ) updater, reporter = setup_support(batch_size, gpu, model, dataset) trained_nll = _get_trained_nll() def _first_hook(o): self.assertTrue(o["main/nll_coarse"] > trained_nll) def _last_hook(o): self.assertTrue(o["main/nll_coarse"] < trained_nll) train_support(iteration, reporter, updater, _first_hook, _last_hook)
def _wrapper(self, to_double=False, bit=10, mulaw=True): scale = 4 model = _create_model( local_size=2 * scale, local_scale=scale, ) dataset = DownLocalRandomDataset( sampling_length=sampling_length, scale=scale, to_double=to_double, bit=bit, mulaw=mulaw, local_padding_size=0, ) updater, reporter = setup_support(batch_size, gpu, model, dataset) trained_nll = _get_trained_nll() def _first_hook(o): self.assertTrue(o['main/nll_coarse'].data > trained_nll) if to_double: self.assertTrue(o['main/nll_fine'].data > trained_nll) def _last_hook(o): self.assertTrue(o['main/nll_coarse'].data < trained_nll) if to_double: self.assertTrue(o['main/nll_fine'].data < trained_nll) train_support(iteration, reporter, updater, _first_hook, _last_hook)
def _wrapper(self, to_double=False, bit=10, mulaw=True): speaker_size = 4 model = _create_model( local_size=0, speaker_size=speaker_size, ) datasets = [ SignWaveDataset( sampling_rate=sampling_rate, sampling_length=sampling_length, to_double=to_double, bit=bit, mulaw=mulaw, frequency=(i + 1) * 110, ) for i in range(speaker_size) ] dataset = SpeakerWavesDataset( wave_dataset=ConcatenatedDataset(*datasets), speaker_nums=list( chain.from_iterable([i] * len(d) for i, d in enumerate(datasets))), ) updater, reporter = setup_support(batch_size, gpu, model, dataset) trained_nll = _get_trained_nll() def _first_hook(o): self.assertTrue(o['main/nll_coarse'].data > trained_nll) if to_double: self.assertTrue(o['main/nll_fine'].data > trained_nll) def _last_hook(o): self.assertTrue(o['main/nll_coarse'].data < trained_nll) if to_double: self.assertTrue(o['main/nll_fine'].data < trained_nll) train_support(iteration, reporter, updater, _first_hook, _last_hook) # save model serializers.save_npz( '/tmp/' f'test_training_wavernn' f'-to_double={to_double}' f'-bit={bit}' f'-mulaw={mulaw}' f'-speaker_size={speaker_size}' f'-iteration={iteration}.npz', model.predictor, )
def _wrapper(self, bit=10, mulaw=True): speaker_size = 4 model = _create_model( local_size=0, speaker_size=speaker_size, ) datasets = [ SignWaveDataset( sampling_rate=sampling_rate, sampling_length=sampling_length, bit=bit, mulaw=mulaw, frequency=(i + 1) * 110, ) for i in range(speaker_size) ] dataset = SpeakerWavesDataset( wave_dataset=ConcatDataset(datasets), speaker_nums=list( chain.from_iterable([i] * len(d) for i, d in enumerate(datasets))), ) updater, reporter = setup_support(batch_size, gpu, model, dataset) trained_nll = _get_trained_nll() def _first_hook(o): self.assertTrue(o["main/nll_coarse"] > trained_nll) def _last_hook(o): self.assertTrue(o["main/nll_coarse"] < trained_nll) train_support(iteration, reporter, updater, _first_hook, _last_hook) # save model torch.save( model.predictor.state_dict(), "/tmp/" f"test_training_wavernn" f"-bit={bit}" f"-mulaw={mulaw}" f"-speaker_size={speaker_size}" f"-iteration={iteration}.pth", )
def _wrapper(self, to_double=False, bit=10, mulaw=True): model = _create_model(local_size=0) dataset = SignWaveDataset( sampling_rate=sampling_rate, sampling_length=sampling_length, to_double=to_double, bit=bit, mulaw=mulaw, ) updater, reporter = setup_support(batch_size, gpu, model, dataset) trained_nll = _get_trained_nll() def _first_hook(o): self.assertTrue(o['main/nll_coarse'].data > trained_nll) if to_double: self.assertTrue(o['main/nll_fine'].data > trained_nll) def _last_hook(o): self.assertTrue(o['main/nll_coarse'].data < trained_nll) if to_double: self.assertTrue(o['main/nll_fine'].data < trained_nll) train_support(iteration, reporter, updater, _first_hook, _last_hook) # save model serializers.save_npz( '/tmp/' f'test_training_wavernn' f'-to_double={to_double}' f'-bit={bit}' f'-mulaw={mulaw}' f'-speaker_size=0' f'-iteration={iteration}.npz', model.predictor, )