minimaxir / textgenrnn

Easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code.
Other
4.95k stars 751 forks source link

ImportError: cannot import name 'multi_gpu_model' from 'tensorflow.keras.utils' #238

Closed ghost closed 2 years ago

ghost commented 3 years ago

help please ImportError: cannot import name 'multi_gpu_model' from 'tensorflow.keras.utils' when I from textgenrnn import textgenrnn please

ghost commented 3 years ago

i saw another error about this but it doesn't talk about the download instead a google colab so I don't understand any of the terms

dlyanb commented 3 years ago

I also got this error and I solved it by finding textgenrnn in my site packages folder (the error message you're getting should tell you where the file is located) and manually patching line 5 of textgenrnn.py

before: from tensorflow.keras.utils import multi_gpu_model

after: from keras.utils import multi_gpu_model

I'm not sure why I had to do this or why it works but it does.

Simone-Cu commented 3 years ago

I think it's duplicated (and solved there) https://github.com/minimaxir/textgenrnn/issues/222#issuecomment-844562774