diff --git a/examples/dreambooth/train_dreambooth_lora_sd3.py b/examples/dreambooth/train_dreambooth_lora_sd3.py index 5da947ca3a..6006e54461 100644 --- a/examples/dreambooth/train_dreambooth_lora_sd3.py +++ b/examples/dreambooth/train_dreambooth_lora_sd3.py @@ -1344,7 +1344,6 @@ def main(args): if not train_dataset.custom_instance_prompts: del tokenizers, text_encoders # Explicitly delete the objects as well, otherwise only the lists are deleted and the original references remain, preventing garbage collection - del tokenizer_one, tokenizer_two, tokenizer_three del text_encoder_one, text_encoder_two, text_encoder_three gc.collect() if torch.cuda.is_available(): diff --git a/examples/dreambooth/train_dreambooth_sd3.py b/examples/dreambooth/train_dreambooth_sd3.py index c012aebcc0..124d7b48ee 100644 --- a/examples/dreambooth/train_dreambooth_sd3.py +++ b/examples/dreambooth/train_dreambooth_sd3.py @@ -1372,7 +1372,6 @@ def main(args): if not args.train_text_encoder and not train_dataset.custom_instance_prompts: del tokenizers, text_encoders # Explicitly delete the objects as well, otherwise only the lists are deleted and the original references remain, preventing garbage collection - del tokenizer_one, tokenizer_two, tokenizer_three del text_encoder_one, text_encoder_two, text_encoder_three gc.collect() if torch.cuda.is_available():