move releasing cache outside of the loop

This commit is contained in:
Kohya S
2023-07-30 13:30:42 +09:00
parent 54a4aa22ed
commit e6034b7eb6

View File

@@ -2165,8 +2165,9 @@ def cache_batch_latents(
info.latents = latent
if flip_aug:
info.latents_flipped = flipped_latent
if torch.cuda.is_available():
torch.cuda.empty_cache()
if torch.cuda.is_available():
torch.cuda.empty_cache()
def cache_batch_text_encoder_outputs(