fix: erroneous warning with PyTorchCallback
Previously, PyTorchTrial would issue warnings about
on_validation_step_start and on_validation_step_end anytime you provided
any PyTorchCallback, regardless of whether or not you used the
deprecated methods.
@@ -395,8 +395,10 @@ class PyTorchTrialController(det.LoopTrialController):
model.eval()
for callback in self.callbacks.values():
+ if util.is_overridden(callback.on_validation_step_start, pytorch.PyTorchCallback):
logging.warning(
- "on_validation_step_start is now deprecated, please use on_validation_start instead"
+ "on_validation_step_start is now deprecated, "
+ "please use on_validation_start instead"
)
callback.on_validation_step_start()
@@ -486,6 +488,7 @@ class PyTorchTrialController(det.LoopTrialController):
metrics = hvd.broadcast_object(metrics, root_rank=0)
for callback in self.callbacks.values():
+ if util.is_overridden(callback.on_validation_step_end, pytorch.PyTorchCallback):
logging.warning(
"on_validation_step_end is now deprecated, please use on_validation_end instead"
)
