textgenrnn icon indicating copy to clipboard operation
textgenrnn copied to clipboard

Error "multi_gpu_model" not found

Open Unity123 opened this issue 4 years ago • 25 comments

Whenever I try to import textgenrnn, it gives me that error. I've tested it on colab, and it works fine there when I set it to tensorflow 1.x but throws the error in 2.x. But the latest version of textgenrnn doesn't support 1.x, so please fix this!

Unity123 avatar Dec 31 '20 22:12 Unity123

Hello, I had this error and was able to bypass by downgrading from TensorFlow 2.4.x to 2.3.2: pip3 install tensorflow==2.3.2

gabedanon avatar Jan 14 '21 23:01 gabedanon

I'd very much like to use 2.4 with my project, but it always throws this error with it. Hope we can find a solution.

gaben5841 avatar Jan 23 '21 04:01 gaben5841

cannot import name 'multi_gpu_model' from 'keras.utils' it shows me this error

1siddharth avatar Feb 01 '21 19:02 1siddharth

I just commented the import line for it is not used in the whole file.

ZhaoqingT avatar Feb 04 '21 16:02 ZhaoqingT

I downgraded the tensorflow and keras (keras==2.3.0 tensorflow-gpu==2.3.2) with python 3.7.9 and it works fine now ..!

1siddharth avatar Feb 05 '21 04:02 1siddharth

This is still an issue and there is no tensorflow 2.3.x for python3.9 (on pypi) and for example Debian only packages python3.9 in their upcoming release.

allo- avatar May 07 '21 06:05 allo-

I got the same error on python 3.82 I tried downgrading to tensorflow==2.3.2 but now I got this other error: "AttributeError: module 'tensorflow.compat.v2' has no attribute 'internal'" Did anyone got it working on 3.8?

fernaoguerra avatar May 19 '21 22:05 fernaoguerra

Ok. Everything solved for me once I installed directly from the github repo: pip3 install git+git://github.com/minimaxir/textgenrnn.git

fernaoguerra avatar May 19 '21 23:05 fernaoguerra

I just commented the import line for it is not used in the whole file.

Yeah but isnt the error occur when we import textgenrnn?

mytran2111 avatar Jun 01 '21 18:06 mytran2111

Ok. Everything solved for me once I installed directly from the github repo: pip3 install git+git://github.com/minimaxir/textgenrnn.git

OH MAN, i love you <3 It work fine to me

Sabadon avatar Jun 14 '21 09:06 Sabadon

I was pinged about this issue so I set the Colab notebook to the workaround noted.

Not entirely sure if there's an easy fix because dependency issues are unfun.

minimaxir avatar Jul 13 '21 02:07 minimaxir

I was pinged about this issue so I set the Colab notebook to the workaround noted.

Not entirely sure if there's an easy fix because dependency issues are unfun.

Not sure if I'm being an idiot or not as I don't know how pip actually works, but the version currently on GitHub works fine (at least for me and presumably everyone else celebrating on @fernaoguerra's comment) which is more recent (April 2020) than the version currently available on PyPI/pip (Feb 2020) so is the solution simply not to make the most current version on GitHub the one that installs through pip?

mattallinson avatar Jul 29 '21 06:07 mattallinson

The multi_gpu_model import was removed in current master so installing from source works fine. Looks like it was moved to its own utils

updating the published version in pip would solve this going forward, if the project had CI this could have been caught before publishing a non-working version

Aergonus avatar Aug 04 '21 23:08 Aergonus

Usually, it is not advised to edit the module itself. But you need to edit the module itself and change the multi_gpu_module and set_session import lines to these

from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model
from keras.backend import set_session

Though, the changes should be done to the module in a PR and new update should be released to PyPI

FireHead90544 avatar Feb 16 '22 19:02 FireHead90544

这是来自QQ邮箱的假期自动回复邮件。你好,邮件已收到,尽快回复。

renning1205 avatar Feb 16 '22 19:02 renning1205

Tensorflow sucks ass. Someone needs to fix it. Tensorflow, not textgenrnn.

FlashlightET avatar Aug 06 '22 04:08 FlashlightET

Ok. Everything solved for me once I installed directly from the github repo: pip3 install git+git://github.com/minimaxir/textgenrnn.git

Thank you! In Google Colab I had to do this a little different: !pip3 install textgenrnn@git+https://github.com/minimaxir/textgenrnn.git@master

ioiste avatar Jan 01 '23 23:01 ioiste

这是来自QQ邮箱的假期自动回复邮件。你好,邮件已收到,尽快回复。

renning1205 avatar Jan 01 '23 23:01 renning1205

Hello, has anyone had this issue again recently and resolved it? tensorflow==2.3.2 is deprecated, installing directly from git isn't working, and updating tensorflow + keras also did not work out for me

pimentoliver avatar Mar 03 '23 15:03 pimentoliver

这是来自QQ邮箱的假期自动回复邮件。你好,邮件已收到,尽快回复。

renning1205 avatar Mar 03 '23 15:03 renning1205

There's an easy fix, if you don't mind losing multi gpu compatibility. Look for where it's looking for multi_gpu_model.py, and make a .py file with a comment in it, there, to hide that error, because it find what it's looking for. I am just training on CPU, and none of my boards support more than one GPU, so that's what I do.

MaraJadeLives avatar Mar 26 '23 16:03 MaraJadeLives

What python and tensorflow version are you using? I have the problem, that it seems to get worse with newer python/cuda/tensorflow versions to get it to run and currently I use a virtual environment with outdated libraries which may even stop working with python 3.11 and later versions.

allo- avatar Mar 26 '23 16:03 allo-

any updates on this? what needs to be changed in google colab notebook to bypass these errors?

jasminefederer avatar Apr 28 '23 14:04 jasminefederer

I know I should share my changes, but I made a fork of textgenrnn, and put my changes in it.

On Fri, Apr 28, 2023 at 6:43 AM jasmine rose federer < @.***> wrote:

any updates on this? what needs to be changed in google colab notebook to bypass these errors?

— Reply to this email directly, view it on GitHub https://github.com/minimaxir/textgenrnn/issues/222#issuecomment-1527675165, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXC4XQ5DBF55YZKTOUCQWP3XDPJQVANCNFSM4VPZFNDQ . You are receiving this because you commented.Message ID: @.***>

MaraJadeLives avatar Apr 28 '23 20:04 MaraJadeLives

No idea what you'd need to change in colab.

On Fri, Apr 28, 2023 at 12:03 PM A Fujioka @.***> wrote:

I know I should share my changes, but I made a fork of textgenrnn, and put my changes in it.

On Fri, Apr 28, 2023 at 6:43 AM jasmine rose federer < @.***> wrote:

any updates on this? what needs to be changed in google colab notebook to bypass these errors?

— Reply to this email directly, view it on GitHub https://github.com/minimaxir/textgenrnn/issues/222#issuecomment-1527675165, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXC4XQ5DBF55YZKTOUCQWP3XDPJQVANCNFSM4VPZFNDQ . You are receiving this because you commented.Message ID: @.***>

MaraJadeLives avatar Apr 28 '23 20:04 MaraJadeLives