TypeError("__init__() got an unexpected keyword argument 'phonemes'") with NeMo

Question:

I’m trying to run a skript based on NeMo and am stuck with this error

File "use_me.py", line 7, in <module>
    spec_generator = FastPitchModel.restore_from(model_path)
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/core/classes/modelPT.py", line 434, in restore_from
    instance = cls._save_restore_connector.restore_from(
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/core/connectors/save_restore_connector.py", line 239, in restore_from
    loaded_params = self.load_config_and_state_dict(
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/core/connectors/save_restore_connector.py", line 162, in load_config_and_state_dict
    instance = calling_cls.from_config_dict(config=conf, trainer=trainer)
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/core/classes/common.py", line 507, in from_config_dict
    raise e
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/core/classes/common.py", line 499, in from_config_dict
    instance = cls(cfg=config, trainer=trainer)
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/collections/tts/models/fastpitch.py", line 94, in __init__
    self._setup_tokenizer(cfg)
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/nemo/collections/tts/models/fastpitch.py", line 216, in _setup_tokenizer
    self.vocab = instantiate(cfg.text_tokenizer, **text_tokenizer_kwargs)
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 222, in instantiate
    return instantiate_node(
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 339, in instantiate_node
    return _call_target(_target_, partial, args, kwargs, full_key)
  File "/data/fburkhardt/tts/fastpitch_nemo/venv/lib/python3.8/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 97, in _call_target
    raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error in call to target 'nemo.collections.common.tokenizers.text_to_speech.tts_tokenizers.GermanCharsTokenizer':
TypeError("__init__() got an unexpected keyword argument 'phonemes'")
full_key: text_tokenizer

When trying to run the skript to test this model

https://huggingface.co/inOXcrm/German_multispeaker_FastPitch_nemo

So far i was unable to google the solution, i simply did
pip install nemo_toolkit[‘all’]
and
pip install pynini==2.1.5
as suggested by the NeMo installation

any hints?

Asked By: Felix Burkhardt

||

Answers:

So, after talking to the author of the model, he told me that the NeMo guys changed their library after he compiled his model, so the workaround is simply to install an older version

pip install nemo_toolkit['all']==1.14.0 

In addition, I did

pip install numpy==1.23.5
pip install protobuf==3.20.2

to get rid of the later incompatibilities

Answered By: Felix Burkhardt
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.