[Ray SGD] TorchTrainable pre 0.8.7 deprecation warning (#10984)

* torch trainable add pre 0.8.7 backwards compat

* raise instead

* Update python/ray/util/sgd/torch/torch_trainer.py
This commit is contained in:
Amog Kamsetty 2020-09-23 18:19:43 -07:00 committed by GitHub
parent 4c3f09094a
commit 52e1495e30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -670,6 +670,12 @@ class BaseTorchTrainable(Trainable):
You may want to override this if using a custom LR scheduler.
"""
if self._is_overriden("_train"):
raise DeprecationWarning(
"Trainable._train is deprecated and will be "
"removed in "
"a future version of Ray. Override Trainable.step instead.")
train_stats = self.trainer.train(max_retries=10, profile=True)
validation_stats = self.trainer.validate(profile=True)
stats = merge_dicts(train_stats, validation_stats)