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

Deprecate LightningModule's write_predictions in favor of predict_step #7065

Closed
ananthsub opened this issue Apr 17, 2021 · 0 comments · Fixed by #7066
Closed

Deprecate LightningModule's write_predictions in favor of predict_step #7065

ananthsub opened this issue Apr 17, 2021 · 0 comments · Fixed by #7066
Labels
deprecation Includes a deprecation design Includes a design discussion feature Is an improvement or enhancement help wanted Open to be worked on

Comments

@ananthsub
Copy link
Contributor

ananthsub commented Apr 17, 2021

🚀 Feature

Not a feature but a request for eventual removal:
The LightningModule has write_predictions and write_prediction_dict as an API. The LightningModule also now has predict_step, there's Trainer.predict(), and users can configure callbacks for this loop based on the predict hooks.

This means we can replace write_predictions with predict_step + a callback to output results to any destination (not just a file), which is more flexible than write_predictions

Motivation

Avoid confusion/redundancy for users as to which hook they should implement

write_predictions also reaches deep into the trainer internals which is bad practice. this also implies that the trainer is available, which is not strictly necessary for pure inference: as a user I should be able to generate batches on my own and run the forward pass without requiring access to the trainer or its internal evaluation loop

Pitch

Mark these APIs on the Lightning Module as deprecated in v1.3 and slated fo removal in v1.5. Replace write_predictions with predict_step + a callback to output results to any destination (not just a file), which is more flexible than write_predictions

Alternatives

Keep as is

Additional context

@ananthsub ananthsub added feature Is an improvement or enhancement help wanted Open to be worked on design Includes a design discussion deprecation Includes a deprecation labels Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation Includes a deprecation design Includes a design discussion feature Is an improvement or enhancement help wanted Open to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant