From a0b63ee7f4a8c793c0d200c86ef07677aa4cbf2e Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 13 Apr 2023 07:14:24 +0200 Subject: Update --- training/strategy/dreambooth.py | 7 ++----- training/strategy/lora.py | 6 ++---- training/strategy/ti.py | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'training/strategy') diff --git a/training/strategy/dreambooth.py b/training/strategy/dreambooth.py index fa51bc7..4ae28b7 100644 --- a/training/strategy/dreambooth.py +++ b/training/strategy/dreambooth.py @@ -142,9 +142,7 @@ def dreambooth_strategy_callbacks( ) pipeline.save_pretrained(checkpoint_output_dir) - del unet_ - del text_encoder_ - del pipeline + del unet_, text_encoder_, pipeline if torch.cuda.is_available(): torch.cuda.empty_cache() @@ -165,8 +163,7 @@ def dreambooth_strategy_callbacks( unet_.to(dtype=orig_unet_dtype) text_encoder_.to(dtype=orig_text_encoder_dtype) - del unet_ - del text_encoder_ + del unet_, text_encoder_ if torch.cuda.is_available(): torch.cuda.empty_cache() diff --git a/training/strategy/lora.py b/training/strategy/lora.py index 73ec8f2..1517ee8 100644 --- a/training/strategy/lora.py +++ b/training/strategy/lora.py @@ -140,8 +140,7 @@ def lora_strategy_callbacks( with open(checkpoint_output_dir / "lora_config.json", "w") as f: json.dump(lora_config, f) - del unet_ - del text_encoder_ + del unet_, text_encoder_ if torch.cuda.is_available(): torch.cuda.empty_cache() @@ -153,8 +152,7 @@ def lora_strategy_callbacks( save_samples_(step=step, unet=unet_, text_encoder=text_encoder_) - del unet_ - del text_encoder_ + del unet_, text_encoder_ if torch.cuda.is_available(): torch.cuda.empty_cache() diff --git a/training/strategy/ti.py b/training/strategy/ti.py index 08af89d..ca7cc3d 100644 --- a/training/strategy/ti.py +++ b/training/strategy/ti.py @@ -158,8 +158,7 @@ def textual_inversion_strategy_callbacks( unet_.to(dtype=orig_unet_dtype) text_encoder_.to(dtype=orig_text_encoder_dtype) - del unet_ - del text_encoder_ + del unet_, text_encoder_ if torch.cuda.is_available(): torch.cuda.empty_cache() -- cgit v1.2.3-54-g00ecf