Skip to content

Commit 2e181a3

Browse files
faaanyhlky
andauthored
Apply suggestions from code review
Co-authored-by: hlky <[email protected]>
1 parent 88263e8 commit 2e181a3

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,8 @@ def test_stable_diffusion_inpaint_k_lms(self):
709709

710710
def test_stable_diffusion_inpaint_with_sequential_cpu_offloading(self):
711711
backend_empty_cache(torch_device)
712-
backend_reset_peak_memory_stats(torch_device)
713712
backend_reset_max_memory_allocated(torch_device)
713+
backend_reset_peak_memory_stats(torch_device)
714714

715715
pipe = StableDiffusionInpaintPipeline.from_pretrained(
716716
"botp/stable-diffusion-v1-5-inpainting", safety_checker=None, torch_dtype=torch.float16
@@ -912,8 +912,8 @@ def test_stable_diffusion_inpaint_k_lms(self):
912912

913913
def test_stable_diffusion_inpaint_with_sequential_cpu_offloading(self):
914914
backend_empty_cache(torch_device)
915-
backend_reset_peak_memory_stats(torch_device)
916915
backend_reset_max_memory_allocated(torch_device)
916+
backend_reset_peak_memory_stats(torch_device)
917917

918918
vae = AsymmetricAutoencoderKL.from_pretrained(
919919
"cross-attention/asymmetric-autoencoder-kl-x-1-5", torch_dtype=torch.float16

tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ def callback_fn(step: int, timestep: int, latents: torch.Tensor) -> None:
389389

390390
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
391391
backend_empty_cache(torch_device)
392-
backend_reset_peak_memory_stats(torch_device)
393392
backend_reset_max_memory_allocated(torch_device)
393+
backend_reset_peak_memory_stats(torch_device)
394394

395395
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
396396
"timbrooks/instruct-pix2pix", safety_checker=None, torch_dtype=torch.float16

tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ def test_stable_diffusion_inpaint_pipeline_fp16(self):
252252

253253
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
254254
backend_empty_cache(torch_device)
255-
backend_reset_peak_memory_stats(torch_device)
256255
backend_reset_max_memory_allocated(torch_device)
256+
backend_reset_peak_memory_stats(torch_device)
257257

258258
init_image = load_image(
259259
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"

tests/pipelines/stable_diffusion_2/test_stable_diffusion_v_pred.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ def test_stable_diffusion_low_cpu_mem_usage_v_pred(self):
535535

536536
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading_v_pred(self):
537537
backend_empty_cache(torch_device)
538-
backend_reset_peak_memory_stats(torch_device)
539538
backend_reset_max_memory_allocated(torch_device)
539+
backend_reset_peak_memory_stats(torch_device)
540540

541541
pipeline_id = "stabilityai/stable-diffusion-2"
542542
prompt = "Andromeda galaxy in a bottle"

tests/pipelines/stable_diffusion_image_variation/test_stable_diffusion_image_variation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ def callback_fn(step: int, timestep: int, latents: torch.Tensor) -> None:
263263

264264
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
265265
backend_empty_cache(torch_device)
266-
backend_reset_peak_memory_stats(torch_device)
267266
backend_reset_max_memory_allocated(torch_device)
267+
backend_reset_peak_memory_stats(torch_device)
268268

269269
pipe = StableDiffusionImageVariationPipeline.from_pretrained(
270270
"lambdalabs/sd-image-variations-diffusers", safety_checker=None, torch_dtype=torch.float16

0 commit comments

Comments
 (0)