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

update pytorch-lightning requirement to >= 1.8.0 #202

Merged
merged 3 commits into from
Mar 16, 2023

Conversation

llimllib
Copy link
Contributor

@llimllib llimllib commented Dec 20, 2022

pytorch_lightning removed this variable in commit Lightning-AI/pytorch-lightning@7ef8746 part of Lightning-AI/pytorch-lightning#14550, which seems to have gone out in lightning 1.8.0.

  • replace _TPU_AVAILABLE with TPUAccelerator.is_available, which seems to be what the above referenced commit uses in its place
  • fix updated callback name on_batch_end -> on_train_batch_end
  • update pytorch-lightning req in requirements.txt

Without the change in place, I get:

$ python -c "from aitextgen.train import ATGTransformer"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/llimllib/.venv/lib/python3.10/site-packages/aitextgen/__init__.py", line 1, in <module>
    from .aitextgen import aitextgen  # noqa
  File "/Users/llimllib/.venv/lib/python3.10/site-packages/aitextgen/aitextgen.py", line 31, in <module>
    from .train import ATGProgressBar, ATGTransformer
  File "/Users/llimllib/.venv/lib/python3.10/site-packages/aitextgen/train.py", line 14, in <module>
    from pytorch_lightning.utilities import _TPU_AVAILABLE
ImportError: cannot import name '_TPU_AVAILABLE' from 'pytorch_lightning.utilities' (/Users/llimllib/.venv/lib/python3.10/site-packages/pytorch_lightning/utilities/__init__.py)

With it in place, I get no output as expected

python -c "from aitextgen.train import ATGTransformer"

I was also able to use the example colab notebook with this branch, which I was not able to using the published version of aitextgen

fixes #200

pytorch_lightning removed this variable in commit
7ef87464ddd740f8af8388bd95130066c65874da:
Lightning-AI/pytorch-lightning@7ef8746

replace _TPU_AVAILABLE with TPUAccelerator.is_available
Copy link

@carmocca carmocca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyTorch Lightning dev here. LGTM!

@llimllib llimllib changed the title fix missing _TPU_AVAILABLE variable update pytorch-lightning requirement to >= 1.8.0 Dec 21, 2022
Copy link

@Morpheus636 Morpheus636 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainers, please merge this.

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

Successfully merging this pull request may close these issues.

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