Skip to content

ValueError(f"{func} does not have a return type annotation") when implementing LightningCLI #19637

Discussion options

You must be logged in to vote

Hi Mauvilsa,

thank you for your reply. While trying to come up with a minimal reproduction example I actually found the solution to my problem:
LightningCLI() does not take the instance of the model as a parameter but the class itself (as I guess instantiation is then done by the pipeline itself). To be more clear:

Wrong / Not Working:

from lightning.pytorch.cli import LightningCLI
from MyFancyModel import MyFancyModelClass
from MyFancyDataModule import MyFancyDataModuleClass

model = MyFancyModelClass()
datamodule = MyFancyDataModuleClass()

LightningCLI = LightningCLI(model, datamodule)

Correct / Working:

from lightning.pytorch.cli import LightningCLI
from MyFancyModel import MyFancyMo…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by djtschke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment