summaryrefslogtreecommitdiffstats
path: root/trainer_old
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2023-01-15 09:25:30 +0100
committerVolpeon <git@volpeon.ink>2023-01-15 09:25:30 +0100
commit5b9a3de142e7a645573b4f4a8c1ce9c59746ab08 (patch)
treec551bd9a3f2f85f7aeb1e7f4bd3b2ebd0cb20450 /trainer_old
parentUpdate (diff)
downloadtextual-inversion-diff-5b9a3de142e7a645573b4f4a8c1ce9c59746ab08.tar.gz
textual-inversion-diff-5b9a3de142e7a645573b4f4a8c1ce9c59746ab08.tar.bz2
textual-inversion-diff-5b9a3de142e7a645573b4f4a8c1ce9c59746ab08.zip
Added functional trainer
Diffstat (limited to 'trainer_old')
-rw-r--r--trainer_old/base.py14
1 files changed, 4 insertions, 10 deletions
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():
174 174
175 @contextmanager 175 @contextmanager
176 def on_train(self, epoch: int): 176 def on_train(self, epoch: int):
177 try: 177 self.tokenizer.train()
178 self.tokenizer.train() 178 yield
179 yield
180 finally:
181 pass
182 179
183 @contextmanager 180 @contextmanager
184 def on_eval(self): 181 def on_eval(self):
185 try: 182 self.tokenizer.eval()
186 self.tokenizer.eval() 183 yield
187 yield
188 finally:
189 pass
190 184
191 def on_before_optimize(self, epoch: int): 185 def on_before_optimize(self, epoch: int):
192 ... 186 ...