Skip to content

Commit

Permalink
Fix & update WaveRNN vocoder model (coqui-ai#1749)
Browse files Browse the repository at this point in the history
* Fixes KeyError bug. Adding logging to dashboard.

* Make pep8 compliant

* Make style compliant

* Still fixing style
  • Loading branch information
vanIvan authored Jul 26, 2022
1 parent 1a065fa commit 5094499
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions TTS/vocoder/models/wavernn.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class of models has however remained an elusive problem. With a focus on text-to
else:
raise RuntimeError("Unknown model mode value - ", self.args.mode)

self.ap = AudioProcessor(**config.audio.to_dict())
self.aux_dims = self.args.res_out_dims // 4

if self.args.use_upsample_net:
Expand Down Expand Up @@ -571,7 +572,7 @@ def eval_step(self, batch: Dict, criterion: Dict) -> Tuple[Dict, Dict]:
def test(
self, assets: Dict, test_loader: "DataLoader", output: Dict # pylint: disable=unused-argument
) -> Tuple[Dict, Dict]:
ap = assets["audio_processor"]
ap = self.ap
figures = {}
audios = {}
samples = test_loader.dataset.load_test_samples(1)
Expand All @@ -587,8 +588,16 @@ def test(
}
)
audios.update({f"test_{idx}/audio": y_hat})
# audios.update({f"real_{idx}/audio": y_hat})
return figures, audios

def test_log(
self, outputs: Dict, logger: "Logger", assets: Dict, steps: int # pylint: disable=unused-argument
) -> Tuple[Dict, np.ndarray]:
figures, audios = outputs
logger.eval_figures(steps, figures)
logger.eval_audios(steps, audios, self.ap.sample_rate)

@staticmethod
def format_batch(batch: Dict) -> Dict:
waveform = batch[0]
Expand All @@ -605,7 +614,7 @@ def get_data_loader( # pylint: disable=no-self-use
verbose: bool,
num_gpus: int,
):
ap = assets["audio_processor"]
ap = self.ap
dataset = WaveRNNDataset(
ap=ap,
items=samples,
Expand Down

0 comments on commit 5094499

Please sign in to comment.