Skip to content

Add a Trainer.predict(), similar to Trainer.test(), except returns the predictions #5475

@changjonathanc

Description

@changjonathanc

🚀 Feature

Add a Trainer.predict(), similar to Trainer.test(), that returns the predictions

Motivation

I want to get prediction, without writing for batch in ..., to(cuda), output.append() ...

Pitch

Making prediction should be part of a LightningModule "system".
And it should be easy to add this functionality.

Alternatives

Currently the doc suggests to make prediction like normal PyTorch:
https://pytorch-lightning.readthedocs.io/en/latest/trainer.html#deployment-prediction

Additional context

Related forum post: https://forums.pytorchlightning.ai/t/save-test-predictions/549/3

Metadata

Metadata

Assignees

Labels

designIncludes a design discussionfeatureIs an improvement or enhancementpriority: 0High priority task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions