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

still getting the same error. #218

Open
koutkout opened this issue Mar 26, 2023 · 4 comments
Open

still getting the same error. #218

koutkout opened this issue Mar 26, 2023 · 4 comments

Comments

@koutkout
Copy link

I tried different lightning versions and it didn't work. I rolled back to 0.4.2 and although generation was running fine but training wasn't running!
I now have aitextgen 0.6.0 with pytorch-lightning 1.7.0
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]
Traceback (most recent call last):
File "trainai[trainai.py](http://trainai.py/)", line 28, in
ai.train(data, batch_size=8, num_steps=50000, generate_every=5000)
File "C:\Python310\lib\site-packages\aitextgen[aitextgen.py](http://aitextgen.py/)", line 752, in train
trainer.fit(train_model)
File "C:\Python310\lib\site-packages\pytorch_lightning\trainer[trainer.py](http://trainer.py/)", line 700, in fit
self._call_and_handle_interrupt(
File "C:\Python310\lib\site-packages\pytorch_lightning\trainer[trainer.py](http://trainer.py/)", line 654, in _call_and_handle_interrupt
return trainer_fn(*args, **kwargs)
File "C:\Python310\lib\site-packages\pytorch_lightning\trainer[trainer.py](http://trainer.py/)", line 741, in _fit_impl
results = self._run(model, ckpt_path=self.ckpt_path)
File "C:\Python310\lib\site-packages\pytorch_lightning\trainer[trainer.py](http://trainer.py/)", line 1147, in _run
self.strategy.setup(self)
File "C:\Python310\lib\site-packages\pytorch_lightning\strategies[single_device.py](http://single_device.py/)", line 74, in setup
super().setup(trainer)
File "C:\Python310\lib\site-packages\pytorch_lightning\strategies[strategy.py](http://strategy.py/)", line 153, in setup
self.setup_optimizers(trainer)
File "C:\Python310\lib\site-packages\pytorch_lightning\strategies[strategy.py](http://strategy.py/)", line 141, in setup_optimizers
self.optimizers, self.lr_scheduler_configs, self.optimizer_frequencies = _init_optimizers_and_lr_schedulers(
File "C:\Python310\lib\site-packages\pytorch_lightning\core[optimizer.py](http://optimizer.py/)", line 194, in _init_optimizers_and_lr_schedulers
_validate_scheduler_api(lr_scheduler_configs, model)
File "C:\Python310\lib\site-packages\pytorch_lightning\core[optimizer.py](http://optimizer.py/)", line 351, in _validate_scheduler_api
raise MisconfigurationException(
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.

=============
if i upgrade to lightning==2.0.0 then I will get:
Traceback (most recent call last):
File "trainai[trainai.py](http://trainai.py/)", line 1, in
from aitextgen.TokenDataset import TokenDataset
File "C:\Python310\lib\site-packages\aitextgen[init.py](http://init.py/)", line 1, in
from .aitextgen import aitextgen # noqa
File "C:\Python310\lib\site-packages\aitextgen[aitextgen.py](http://aitextgen.py/)", line 14, in
from pytorch_lightning.plugins import DeepSpeedPlugin
ImportError: cannot import name 'DeepSpeedPlugin' from 'pytorch_lightning.plugins' (C:\Python310\lib\site-packages\pytorch_lightning\plugins_init_.py)

Please help.

@astrolul
Copy link

Same I recently tried this out and I was getting all sorts of errors, let me know when this is fixed because I want to use it ASAP.

@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

@koutkout
Copy link
Author

koutkout commented Apr 7, 2023

Thanks. It was solved earlier. But now there's another problem. I remember testing it a week ago and it was working but for unknown reason it's not working now.
ImportError Traceback (most recent call last)
in <cell line: 1>()
----> 1 from aitextgen import aitextgen
2 from aitextgen.colab import mount_gdrive, copy_file_from_gdrive
3 ai = aitextgen(tf_gpt2="124M", to_gpu=True)

1 frames
/usr/local/lib/python3.9/dist-packages/aitextgen/aitextgen.py in
12 import torch
13 from pkg_resources import resource_filename
---> 14 from pytorch_lightning.plugins import DeepSpeedPlugin
15 from tqdm.auto import trange
16 from transformers import (

ImportError: cannot import name 'DeepSpeedPlugin' from 'pytorch_lightning.plugins' (/usr/local/lib/python3.9/dist-packages/pytorch_lightning/plugins/init.py)

@scorixear
Copy link

Thanks. It was solved earlier. But now there's another problem. I remember testing it a week ago and it was working but for unknown reason it's not working now. ImportError Traceback (most recent call last) in <cell line: 1>() ----> 1 from aitextgen import aitextgen 2 from aitextgen.colab import mount_gdrive, copy_file_from_gdrive 3 ai = aitextgen(tf_gpt2="124M", to_gpu=True)

1 frames /usr/local/lib/python3.9/dist-packages/aitextgen/aitextgen.py in 12 import torch 13 from pkg_resources import resource_filename ---> 14 from pytorch_lightning.plugins import DeepSpeedPlugin 15 from tqdm.auto import trange 16 from transformers import (

ImportError: cannot import name 'DeepSpeedPlugin' from 'pytorch_lightning.plugins' (/usr/local/lib/python3.9/dist-packages/pytorch_lightning/plugins/init.py)

as you already figured out, aitextgen is build on older versions of pytorch_lightning, but doesn't have any max-version in their requirements.
#216 updates those library changes, they are however mostly for show, the algorithms behind them (or api calls) all stayed the same.

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

4 participants