From 5b9a3de142e7a645573b4f4a8c1ce9c59746ab08 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 15 Jan 2023 09:25:30 +0100 Subject: Added functional trainer --- trainer_old/base.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'trainer_old') diff --git a/trainer_old/base.py b/trainer_old/base.py index 1f85e71..5903d96 100644 --- a/trainer_old/base.py +++ b/trainer_old/base.py @@ -174,19 +174,13 @@ class TrainingStrategy(): @contextmanager def on_train(self, epoch: int): - try: - self.tokenizer.train() - yield - finally: - pass + self.tokenizer.train() + yield @contextmanager def on_eval(self): - try: - self.tokenizer.eval() - yield - finally: - pass + self.tokenizer.eval() + yield def on_before_optimize(self, epoch: int): ... -- cgit v1.2.3-70-g09d2