Skip to content

Commit e8b8655

Browse files
committed
free memory.
1 parent 734494c commit e8b8655

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

examples/flux-control/train_control_flux.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,11 @@ def get_sigmas(timesteps, n_dim=4, dtype=torch.float32):
11661166
flux_transformer.to(torch.float32)
11671167
flux_transformer.save_pretrained(args.output_dir)
11681168

1169+
del flux_transformer
1170+
del text_encoding_pipeline
1171+
del vae
1172+
free_memory()
1173+
11691174
# Run a final round of validation.
11701175
image_logs = None
11711176
if args.validation_prompt is not None:

examples/flux-control/train_control_lora_flux.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,11 @@ def get_sigmas(timesteps, n_dim=4, dtype=torch.float32):
13191319
transformer_lora_layers=transformer_lora_layers,
13201320
)
13211321

1322+
del flux_transformer
1323+
del text_encoding_pipeline
1324+
del vae
1325+
free_memory()
1326+
13221327
# Run a final round of validation.
13231328
image_logs = None
13241329
if args.validation_prompt is not None:

0 commit comments

Comments
 (0)