diff options
Diffstat (limited to 'training/strategy/dreambooth.py')
-rw-r--r-- | training/strategy/dreambooth.py | 7 |
1 files changed, 2 insertions, 5 deletions
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( | |||
142 | ) | 142 | ) |
143 | pipeline.save_pretrained(checkpoint_output_dir) | 143 | pipeline.save_pretrained(checkpoint_output_dir) |
144 | 144 | ||
145 | del unet_ | 145 | del unet_, text_encoder_, pipeline |
146 | del text_encoder_ | ||
147 | del pipeline | ||
148 | 146 | ||
149 | if torch.cuda.is_available(): | 147 | if torch.cuda.is_available(): |
150 | torch.cuda.empty_cache() | 148 | torch.cuda.empty_cache() |
@@ -165,8 +163,7 @@ def dreambooth_strategy_callbacks( | |||
165 | unet_.to(dtype=orig_unet_dtype) | 163 | unet_.to(dtype=orig_unet_dtype) |
166 | text_encoder_.to(dtype=orig_text_encoder_dtype) | 164 | text_encoder_.to(dtype=orig_text_encoder_dtype) |
167 | 165 | ||
168 | del unet_ | 166 | del unet_, text_encoder_ |
169 | del text_encoder_ | ||
170 | 167 | ||
171 | if torch.cuda.is_available(): | 168 | if torch.cuda.is_available(): |
172 | torch.cuda.empty_cache() | 169 | torch.cuda.empty_cache() |