From 21d70916f66e74a87c631a06b70774954b085b48 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 7 Apr 2023 14:14:00 +0200 Subject: Fix --- training/strategy/dreambooth.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'training/strategy/dreambooth.py') diff --git a/training/strategy/dreambooth.py b/training/strategy/dreambooth.py index 9808027..0286673 100644 --- a/training/strategy/dreambooth.py +++ b/training/strategy/dreambooth.py @@ -84,11 +84,9 @@ def dreambooth_strategy_callbacks( else: return nullcontext() - def on_accum_model(): - return unet - @contextmanager def on_train(epoch: int): + unet.train() tokenizer.train() if epoch < train_text_encoder_epochs: @@ -101,6 +99,7 @@ def dreambooth_strategy_callbacks( @contextmanager def on_eval(): + unet.eval() tokenizer.eval() text_encoder.eval() @@ -174,7 +173,6 @@ def dreambooth_strategy_callbacks( torch.cuda.empty_cache() return TrainingCallbacks( - on_accum_model=on_accum_model, on_train=on_train, on_eval=on_eval, on_before_optimize=on_before_optimize, -- cgit v1.2.3-54-g00ecf