From eb6a92abda5893c975437026cdaf0ce0bfefe2a4 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 10 Apr 2023 10:34:12 +0200 Subject: Update --- training/functional.py | 4 +--- training/strategy/dreambooth.py | 2 +- training/strategy/lora.py | 2 +- training/strategy/ti.py | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'training') diff --git a/training/functional.py b/training/functional.py index e14aeea..46d25f6 100644 --- a/training/functional.py +++ b/training/functional.py @@ -644,11 +644,9 @@ def train( min_snr_gamma: int = 5, **kwargs, ): - text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler, extra = strategy.prepare( + text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler = strategy.prepare( accelerator, text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler, **kwargs) - kwargs.update(extra) - vae.to(accelerator.device, dtype=dtype) vae.requires_grad_(False) vae.eval() diff --git a/training/strategy/dreambooth.py b/training/strategy/dreambooth.py index 695174a..42624cd 100644 --- a/training/strategy/dreambooth.py +++ b/training/strategy/dreambooth.py @@ -198,7 +198,7 @@ def dreambooth_prepare( text_encoder.text_model.embeddings.requires_grad_(False) - return text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler, {} + return text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler dreambooth_strategy = TrainingStrategy( diff --git a/training/strategy/lora.py b/training/strategy/lora.py index ae85401..73ec8f2 100644 --- a/training/strategy/lora.py +++ b/training/strategy/lora.py @@ -184,7 +184,7 @@ def lora_prepare( text_encoder.text_model.embeddings.token_override_embedding.params.requires_grad_(True) - return text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler, {} + return text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler lora_strategy = TrainingStrategy( diff --git a/training/strategy/ti.py b/training/strategy/ti.py index 9cdc1bb..363c3f9 100644 --- a/training/strategy/ti.py +++ b/training/strategy/ti.py @@ -207,7 +207,7 @@ def textual_inversion_prepare( text_encoder.text_model.embeddings.position_embedding.requires_grad_(False) text_encoder.text_model.embeddings.token_embedding.requires_grad_(False) - return text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler, {} + return text_encoder, unet, optimizer, train_dataloader, val_dataloader, lr_scheduler textual_inversion_strategy = TrainingStrategy( -- cgit v1.2.3-70-g09d2