Deprecate LightningModule's write_predictions in favor of predict_step #7065
Labels
deprecation
Includes a deprecation
design
Includes a design discussion
feature
Is an improvement or enhancement
help wanted
Open to be worked on
🚀 Feature
Not a feature but a request for eventual removal:
The LightningModule has
write_predictions
andwrite_prediction_dict
as an API. The LightningModule also now has predict_step, there'sTrainer.predict()
, and users can configure callbacks for this loop based on the predict hooks.This means we can replace
write_predictions
withpredict_step
+ a callback to output results to any destination (not just a file), which is more flexible thanwrite_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 loopPitch
Mark these APIs on the Lightning Module as deprecated in v1.3 and slated fo removal in v1.5. Replace
write_predictions
withpredict_step
+ a callback to output results to any destination (not just a file), which is more flexible thanwrite_predictions
Alternatives
Keep as is
Additional context
The text was updated successfully, but these errors were encountered: