russian_g2p icon indicating copy to clipboard operation
russian_g2p copied to clipboard

RuntimeError: Method `model_from_yaml()` has been removed due to security risk of arbitrary code execution. Please use `Model.to_json()` and `model_from_json()` instead.

Open psydok opened this issue 2 years ago • 1 comments

> !python gen_forward.py --input_text 'Пр+ивет.' melgan

First error. Ok, added the word tensorflow to the beginning (from tensorflow.keras.optimizers import Adam):

Traceback (most recent call last):
  File "inference.py", line 24, in <module>
    from russian_g2p.Transcription import Transcription
  File "/content/drive/MyDrive/russian_g2p/russian_g2p/Transcription.py", line 1, in <module>
    from russian_g2p.Preprocessor import Preprocessor
  File "/content/drive/MyDrive/russian_g2p/russian_g2p/Preprocessor.py", line 3, in <module>
    from rnnmorph.predictor import RNNMorphPredictor
  File "/usr/local/lib/python3.7/dist-packages/rnnmorph/predictor.py", line 13, in <module>
    from rnnmorph.model import LSTMMorphoAnalysis
  File "/usr/local/lib/python3.7/dist-packages/rnnmorph/model.py", line 14, in <module>
    from keras.optimizers import Adam
ImportError: cannot import name 'Adam' from 'keras.optimizers' (/usr/local/lib/python3.7/dist-packages/keras/optimizers.py)

Two error:

/usr/local/lib/python3.7/dist-packages/librosa/util/decorators.py:9: NumbaDeprecationWarning: An import was requested from a module that has moved location.
Import requested from: 'numba.decorators', please update to use 'numba.core.decorators' or pin to Numba version 0.48.0. This alias will not be present in Numba version 0.50.0.
  from numba.decorators import jit as optional_jit
/usr/local/lib/python3.7/dist-packages/librosa/util/decorators.py:9: NumbaDeprecationWarning: An import was requested from a module that has moved location.
Import of 'jit' requested from: 'numba.decorators', please update to use 'numba.core.decorators' or pin to Numba version 0.48.0. This alias will not be present in Numba version 0.50.0.
  from numba.decorators import jit as optional_jit
Using device: cuda

Initialising Forward TTS Model...

Traceback (most recent call last):
  File "gen_forward.py", line 124, in <module>
    text = clean_text(input_text.strip())
  File "/content/drive/My Drive/ForwardTacotron/utils/text/__init__.py", line 59, in clean_text
    text = cleaner(text)
  File "/content/drive/My Drive/ForwardTacotron/utils/text/cleaners.py", line 94, in rus_cleaners
    text = rus_to_phonemes(text)
  File "/content/drive/My Drive/ForwardTacotron/utils/text/cleaners.py", line 104, in rus_to_phonemes
    transcriptor = Transcription()
  File "/content/drive/MyDrive/russian_g2p/russian_g2p/Transcription.py", line 9, in __init__
    self.__preprocessor = Preprocessor(batch_size=batch_size)
  File "/content/drive/MyDrive/russian_g2p/russian_g2p/Preprocessor.py", line 10, in __init__
    self.predictor = RNNMorphPredictor(language="ru")
  File "/usr/local/lib/python3.7/dist-packages/rnnmorph/predictor.py", line 88, in __init__
    self.model.load_eval(self.build_config, eval_model_config_path, eval_model_weights_path)
  File "/usr/local/lib/python3.7/dist-packages/rnnmorph/model.py", line 135, in load_eval
    self.eval_model = model_from_yaml(f.read(), custom_objects=custom_objects)
  File "/usr/local/lib/python3.7/dist-packages/keras/saving/model_config.py", line 75, in model_from_yaml
    'Method `model_from_yaml()` has been removed due to security risk of '
RuntimeError: Method `model_from_yaml()` has been removed due to security risk of arbitrary code execution. Please use `Model.to_json()` and `model_from_json()` instead.

Please tell me how to fix it?

Everything worked before.

psydok avatar Oct 08 '21 16:10 psydok

Fixed in upstream rnnmorph https://github.com/IlyaGusev/rnnmorph/commit/e59bf607dbdaf937f1e35d196ba76f7d245638ac

AliceCyber avatar Oct 14 '21 20:10 AliceCyber