Skip to content

Not able to Generate Predictions with Trainer.predict() #10897

Discussion options

You must be logged in to vote

since your model is an instance of your LightningModule it cannot rely on model.forward to generate the predictions because predict_step by default calls LightningModule.predict.
you need to either override predict_step

def predict_step(...):
    return self.model(...)

or define forward method in your lightning module

def forward(...):
    return self.model(...)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@spranjal25
Comment options

@rohitgr7
Comment options

Answer selected by spranjal25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants