ImportError: cannot import name 'multi_gpu_model' from 'tensorflow.keras.utils' in textgenrnn

226 Views Asked by At

I am trying to train a textgenrnn model in python and save the weights, i have a txt file with a list of titles that i want to use. this is my code:

from textgenrnn import textgenrnn
t = textgenrnn()
t.train_from_file(r"filepath goes here", num_epochs=10)

But I get this error:

2023-05-25 14:40:27.353193: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2023-05-25 14:40:27.353897: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "C:\Users\HP\Desktop\train_er.py", line 1, in <module>
    from textgenrnn import textgenrnn
  File "C:\Users\HP\anaconda3\lib\site-packages\textgenrnn\__init__.py", line 1, in <module>
    from .textgenrnn import textgenrnn
  File "C:\Users\HP\anaconda3\lib\site-packages\textgenrnn\textgenrnn.py", line 5, in <module>
    from tensorflow.keras.utils import multi_gpu_model
ImportError: cannot import name 'multi_gpu_model' from 'tensorflow.keras.utils' (C:\Users\HP\anaconda3\lib\site-packages\keras\api\_v2\keras\utils\__init__.py)

I have tensorflow 2.10.0, keras 2.10.0, textgenrnn 2.0.0 and CUDA installed

0

There are 0 best solutions below