Cannot import LightningCLI #18683
Unanswered
ioannisCC
asked this question in
code help: CV
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am trying the last 2 days to implement a CLI in a pytorch lightning code, but whenever I try to import the Lightning CLI component i get the following error:
(venv) (base) ioannis@eduroam-10-200-53-165 fds-train % python3 src/scripts/cli_demo.py --help
Traceback (most recent call last):
File "/Users/ioannis/asat/FDS-pytorch-lightning/fds-train/src/scripts/cli_demo.py", line 2, in
from lightning.pytorch.cli import LightningCLI
ModuleNotFoundError: No module named 'lightning.pytorch'; 'lightning' is not a package
Note that i have installed all the necessary packages and also the my code looks like below:
from lightning.pytorch.cli import LightningCLI
from lightning.pytorch.demos.boring_classes import DemoModel, BoringDataModule
def cli_main():
cli = LightningCLI(DemoModel, BoringDataModule)
# note: don't call fit!!
if name == "main":
cli_main()
# note: it is good practice to implement the CLI in a function and call it in the main if block
The code, as well as the packages and libraries installations were made as mentioned in the latest pytorch lightning documentation https://lightning.ai/docs/pytorch/stable/cli/lightning_cli_intermediate.html#train-a-model-with-the-cli.
Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions