From de5a5d09676efbfcecfa46f80fd52dc24afa132d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 8 Jun 2024 09:32:54 +0200 Subject: [PATCH] Don't use assert in non-test code. --- freqtrade/freqai/torch/PyTorchModelTrainer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/freqai/torch/PyTorchModelTrainer.py b/freqtrade/freqai/torch/PyTorchModelTrainer.py index 602c8e95b..54c42a284 100644 --- a/freqtrade/freqai/torch/PyTorchModelTrainer.py +++ b/freqtrade/freqai/torch/PyTorchModelTrainer.py @@ -148,7 +148,8 @@ class PyTorchModelTrainer(PyTorchTrainerInterface): the motivation here is that `n_steps` is easier to optimize and keep stable, across different n_obs - the number of data points. """ - assert isinstance(self.n_steps, int), "Either `n_steps` or `n_epochs` should be set." + if not isinstance(self.n_steps, int): + raise ValueError("Either `n_steps` or `n_epochs` should be set.") n_batches = n_obs // self.batch_size n_epochs = max(self.n_steps // n_batches, 1) if n_epochs <= 10: