r9y9 / wavenet_vocoder

WaveNet vocoder
https://r9y9.github.io/wavenet_vocoder/
Other
2.31k stars 499 forks source link

KeyError when trying to parse hparams json file #177

Closed Fredrum closed 4 years ago

Fredrum commented 4 years ago

Hi! The other error (that I'm currently just ignoring) when I run the colab is a KeyError from this part:

# Setup WaveNet vocoder hparams
from hparams import hparams
with open(wn_preset) as f:
  hparams.parse_json(f.read())

I get: ----> 6 hparams.parse_json(f.read()) and --> 500 param_type, is_list = self._hparam_types[name] KeyError 'builder'

The json file does have that key and what seems a valid value "wavenet" (same as the module default).

Anyone has an idea what this issue could be?

Cheers Fred

r9y9 commented 4 years ago

This is because I made breaking changes to the master, but haven't updated the colab notebook yet. I will fix this later today.

r9y9 commented 4 years ago

Fixed by https://github.com/r9y9/Colaboratory/commit/6661ee7eb7300c51430d2bd16292fd8d7c186d1f

Mingrg commented 3 years ago

Hi @r9y9 I have this problem in my own environment, I executed this:

python synthesis.py --preset=20180510_mixture_lj_checkpoint_step000320000_ema.json \
  --conditional=./data/ljspeech/ljspeech-mel-00001.npy \
  20180510_mixture_lj_checkpoint_step000320000_ema.pth \
  generated

and got the same error:

  File "synthesis.py", line 212, in <module>
    hparams.parse_json(f.read())
  File "/data1/rd/mingruigang/TTS/wavenet_vocoder/wavenet_vocoder/tfcompat/hparam.py", line 610, in parse_json
    return self.override_from_dict(values_map)
  File "/data1/rd/mingruigang/TTS/wavenet_vocoder/wavenet_vocoder/tfcompat/hparam.py", line 562, in override_from_dict
    self.set_hparam(name, value)
  File "/data1/rd/mingruigang/TTS/wavenet_vocoder/wavenet_vocoder/tfcompat/hparam.py", line 503, in set_hparam
    param_type, is_list = self._hparam_types[name]
KeyError: 'builder'

And I don't know where the problem is :(

Mingrg commented 3 years ago

Hi @r9y9 I have this problem in my own environment, I executed this:

python synthesis.py --preset=20180510_mixture_lj_checkpoint_step000320000_ema.json \
  --conditional=./data/ljspeech/ljspeech-mel-00001.npy \
  20180510_mixture_lj_checkpoint_step000320000_ema.pth \
  generated

and got the same error:

  File "synthesis.py", line 212, in <module>
    hparams.parse_json(f.read())
  File "/data1/rd/mingruigang/TTS/wavenet_vocoder/wavenet_vocoder/tfcompat/hparam.py", line 610, in parse_json
    return self.override_from_dict(values_map)
  File "/data1/rd/mingruigang/TTS/wavenet_vocoder/wavenet_vocoder/tfcompat/hparam.py", line 562, in override_from_dict
    self.set_hparam(name, value)
  File "/data1/rd/mingruigang/TTS/wavenet_vocoder/wavenet_vocoder/tfcompat/hparam.py", line 503, in set_hparam
    param_type, is_list = self._hparam_types[name]
KeyError: 'builder'

And I don't know where the problem is :(

My execute step is:

  1. execute your ljspeech demo synthesis, the error is like above info.
  2. execute in my own recipe, like:
    python synthesis.py --preset=conf/gaussian_wavenet.json \
    --conditional=dump/mzc/logmelspectrogram/norm/dev/wanxiangtu_0006_0009_00033102_00038237-feats.npy \
    exp/mzc_train_no_dev_gaussian_wavenet/checkpoint_step000500000.pth.pth \
    generated

    the recipe is copy from egs/gaussian, in egs/gaussian there is no builder in 'egs/gaussian/conf/gaussian_wavenet.json', so the error in step1 not occurred again. But there is another error in synthesis.py:

    waveform = batch_wavegen(model, length, c=c, g=speaker_id, initial_value=initial_value, fast=True)
    TypeError: batch_wavegen() got multiple values for argument 'c'

    I found that the batch_wavegen(model, length, c=c, g=speaker_id, initial_value=initial_value, fast=True) is not match the function in synthesis.py def batch_wavegen(model, c=None, g=None, fast=True, tqdm=tqdm): 3.So I change the code in synthesis.py. from: waveform = batch_wavegen(model, length, c=c, g=speaker_id, initial_value=initial_value, fast=True) to: waveform = wavegen(model, length, c=c, g=speaker_id, initial_value=initial_value, fast=True) but there is another error: :(

    File "/data1/rd/xx/TTS/wavenet_vocoder/wavenet_vocoder/wavenet.py", line 276, in incremental_forward
    assert c.size(-1) == T

    I know your fix is in the jupyter config or something, what should I change when I want to execute in my own linux environment, not the jupyter notebook. Thank you so much