From 52e1495e3059a4a57816e02637c14f4705ea20b1 Mon Sep 17 00:00:00 2001 From: Amog Kamsetty Date: Wed, 23 Sep 2020 18:19:43 -0700 Subject: [PATCH] [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 --- python/ray/util/sgd/torch/torch_trainer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/ray/util/sgd/torch/torch_trainer.py b/python/ray/util/sgd/torch/torch_trainer.py index 805ae37bd..9293eb548 100644 --- a/python/ray/util/sgd/torch/torch_trainer.py +++ b/python/ray/util/sgd/torch/torch_trainer.py @@ -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)