Skip to content

Commit 0d9117e

Browse files
committed
garbage collection
1 parent e2169b0 commit 0d9117e

2 files changed

Lines changed: 4 additions & 110 deletions

File tree

tests/flux/test_flux_txt2img_cache_controlnet.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from nunchaku.caching.diffusers_adapters import apply_cache_on_pipe
1515
from nunchaku.models.transformers.transformer_flux import NunchakuFluxTransformer2dModel
1616
from nunchaku.utils import get_precision
17+
import gc
1718

1819
bfl_repo = "black-forest-labs/FLUX.1-dev"
1920
dtype = torch.bfloat16 # or torch.float16, or torch.float32
@@ -89,6 +90,9 @@
8990
).images[0]
9091
txt2img_res.save("flux.1-dev-txt2img.jpg")
9192

93+
gc.collect()
94+
torch.cuda.empty_cache()
95+
9296
# cache
9397
apply_cache_on_pipe(
9498
pipe_cn,

tests/test_flux_txt2img_cache_controlnet.py

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)