Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while using the Google collab : cannot import name 'DeepSpeedPlugin' from 'pytorch_lightning.plugins' #215

Open
Fqlox opened this issue Mar 21, 2023 · 24 comments

Comments

@Fqlox
Copy link

Fqlox commented Mar 21, 2023

I tried both google collab (train from scratch or finetune with GPT-NEO) both have an issue while loading the module and gives :
cannot import name 'DeepSpeedPlugin' from 'pytorch_lightning.plugins' (on the first cell while importing aitextgen)

I tried do uninstall and reinstall libraries as mentioned here. But it did not do the trick.

Is there a workaround ?

Thanks in advance.

@JosephTico
Copy link

Having same issue

@rgxb2807
Copy link

Having the same issue but locally (Ubuntu 22.04 )

@evelinearr
Copy link

Have the exact same issue on collab

@mpsparrow
Copy link

mpsparrow commented Mar 25, 2023

This may be a compatibility issue with the new version 2.0.0 of pytorch-lightning. Haven't fully tested it anything myself, but reverting to a previous version of pytorch-lightning like version 1.9.4 may be a workaround.

pip uninstall pytorch-lightning
pip install pytorch-lightning==1.9.4

Another possibility is to install directly from master. 78a0bfd looks like it comments out DeepSleepPlugin, which may solve the issue.

pip install git+https://github.com/minimaxir/aitextgen

#216 also seems to provide some bug fixes. Could try:

pip install git+https://github.com/scorixear/aitextgen

@analyticray
Copy link

I tried pip uninstall pytorch-lightning
pip install pytorch-lightning==1.9.4

and also
pip install git+https://github.com/minimaxir/aitextgen
pip install git+https://github.com/scorixear/aitextgen

but still same error

@Fqlox
Copy link
Author

Fqlox commented Mar 27, 2023

This may be a compatibility issue with the new version 2.0.0 of pytorch-lightning. Haven't fully tested it anything myself, but reverting to a previous version of pytorch-lightning like version 1.9.4 may be a workaround.

pip uninstall pytorch-lightning
pip install pytorch-lightning==1.9.4

Another possibility is to install directly from master. 78a0bfd looks like it comments out DeepSleepPlugin, which may solve the issue.

pip install git+https://github.com/minimaxir/aitextgen

#216 also seems to provide some bug fixes. Could try:

pip install git+https://github.com/scorixear/aitextgen

Thanks for your answer
I tried this on the google colab:

#!pip install -q aitextgen

!pip install git+https://github.com/scorixear/aitextgen

!pip uninstall pytorch-lightning
!pip install pytorch-lightning==1.9.4

and still got an issue (another one, but still an issue):
ModuleNotFoundError: No module named 'pytorch_lightning.callbacks.progress.progress_bar'

It seems that the module aitextgen need to access a very specific version of pytorch lightning

@analyticray
Copy link

Hi. Is there any solution to this?

@JosephTico
Copy link

JosephTico commented Mar 28, 2023

Maybe it's related to 7bfbddb, a rollback to an earlier PyTorch-lightning around 1.3.1

@Fqlox
Copy link
Author

Fqlox commented Mar 29, 2023

Maybe it's related to 7bfbddb, a rollback to an earlier PyTorch-lightning around 1.3.1

Tried installing 1.3.1 instead of 1.9.4 and got

ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/usr/local/lib/python3.9/dist-packages/torchmetrics/utilities/data.py)

@JosephTico
Copy link

Maybe it's related to 7bfbddb, a rollback to an earlier PyTorch-lightning around 1.3.1

Tried installing 1.3.1 instead of 1.9.4 and got

`ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/usr/local/lib/python3.9/dist-packages/torchmetrics/utilities/data.py)

`

Did you also a version prior to that commit I mentioned?

@darrinh
Copy link

darrinh commented Mar 30, 2023

On Ubuntu 22.04 doing pip install pytorch-lightning==1.7.0 got it working for me with the demo. Trying to use the training example gives:

pytorch_lightning.utilities.exceptions.MisconfigurationException: The provided lr scheduler LambdaLR doesn't follow PyTorch's LRScheduler API. You should override the LightningModule.lr_scheduler_step hook with your own logic if you are using a custom LR scheduler.

@darrinh
Copy link

darrinh commented Mar 30, 2023

I've tried various versions of the touch lib + aitext and none of them work as yet.

@analyticray
Copy link

I manage to resolve the error on the google colab by running this:

!pip install -qq pytorch-lightning==1.7.0 transformers==4.21.3 aitextgen==0.6.0

Please do let me know if it also solves your issue on colab?

@Fqlox
Copy link
Author

Fqlox commented Mar 31, 2023

I manage to resolve the error on the google colab by running this:

!pip install -qq pytorch-lightning==1.7.0 transformers==4.21.3 aitextgen==0.6.0

Please do let me know if it also solves your issue on colab?

It works fine in both colab and local (CPU) for me,

Thanks

@darrinh
Copy link

darrinh commented Mar 31, 2023 via email

@VTSTech
Copy link

VTSTech commented Apr 1, 2023

pip install -qq pytorch-lightning==1.7.0 made it work for me on Win10 x64 Py 3.11

@darrinh
Copy link

darrinh commented Apr 2, 2023

Thanks Veritas83

pip install -qq pytorch-lightning==1.7.0 made it work for me on Win10 x64 Py 3.11

Thanks, that combo doesn't work with python 3.8.10, which is default for ubuntu 22.04, so I need to try an newer version of python.

@starryendymion
Copy link

On Ubuntu 22.04 doing pip install pytorch-lightning==1.7.0 got it working for me with the demo. Trying to use the training example gives:

pytorch_lightning.utilities.exceptions.MisconfigurationException: The provided lr scheduler LambdaLR doesn't follow PyTorch's LRScheduler API. You should override the LightningModule.lr_scheduler_step hook with your own logic if you are using a custom LR scheduler.

i am getting the same error while training, found any fix ?

@anpoddubny
Copy link

anpoddubny commented Apr 26, 2023

Same issue with me (Python 3.10.8, Mac OS, pip install pytorch-lightning==1.7.0 ). Error with training

The provided lr scheduler LambdaLR doesn't follow PyTorch's LRScheduler API
seems to be also discussed in issue #219

@ViCtOr-dev13
Copy link

try this :
#!pip install -q aitextgen

!pip install git+https://github.com/scorixear/aitextgen

#!pip uninstall pytorch-lightning
!pip install pytorch-lightning==1.9.4

@huyremy
Copy link

huyremy commented Jul 24, 2023

it'

try this : #!pip install -q aitextgen

!pip install git+https://github.com/scorixear/aitextgen

#!pip uninstall pytorch-lightning !pip install pytorch-lightning==1.9.4

it's work but I get this error:
ModuleNotFoundError: No module named 'transformers.models.cpmant.configuration_cpmant'. Can you help me ? I think due to version of transformerr.

@atoqed-1
Copy link

I've tried the various suggestions here, and none of them work with both generation and fine tuning.

With this setup:

python 3.11 - Windows 64bit
torch == 2.0.1
pytorch-lightning == 2.0.6

You get this error for both text generation and fine tuning:
ImportError: cannot import name 'DeepSpeedPlugin' from 'pytorch_lightning.plugins'

Downgrading pytorch-lightning to 1.9.4 gives this error:

ImportError: cannot import name '_TPU_AVAILABLE' from 'pytorch_lightning.utilities'

I've chased these errors and have had a case where text generation works (though I unfortunately lost that particular combination of packages), but fine tuning failed. I'm in need of fine tuning so this isn't good for my use case.

The requirements file suggests that a wide range of package versions will support the package, but it seems more apparent that a narrow version of packages should be recommended.

Do we have any insight into what exact package/python versions allows both text generation and fine tuning to work?

@UESTCSober
Copy link

try this : #!pip install -q aitextgen

!pip install git+https://github.com/scorixear/aitextgen

#!pip uninstall pytorch-lightning !pip install pytorch-lightning==1.9.4

1.9.4 really works

@francescoboc
Copy link

francescoboc commented Dec 11, 2023

I have the same problem. Tried all solutions proposed, none of them work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests