Skip to content

Commit 5226094

Browse files
committed
revert back
1 parent 1d1c13d commit 5226094

File tree

8 files changed

+17
-1
lines changed

8 files changed

+17
-1
lines changed

tests/pipelines/pag/test_pag_sd_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def test_pag_uncond(self):
269269
pipeline.enable_model_cpu_offload(device=torch_device)
270270
pipeline.set_progress_bar_config(disable=None)
271271

272-
inputs = self.get_inputs(torch_device)
272+
inputs = self.get_inputs(torch_device, guidance_scale=0.0)
273273
image = pipeline(**inputs).images
274274

275275
image_slice = image[0, -3:, -3:, -1].flatten()

tests/pipelines/stable_diffusion/test_stable_diffusion.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
CaptureLogger,
4747
backend_empty_cache,
4848
backend_max_memory_allocated,
49+
backend_reset_max_memory_allocated,
4950
backend_reset_peak_memory_stats,
5051
enable_full_determinism,
5152
is_torch_compile,
@@ -1142,6 +1143,7 @@ def test_stable_diffusion_low_cpu_mem_usage(self):
11421143

11431144
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
11441145
backend_empty_cache(torch_device)
1146+
backend_reset_max_memory_allocated(torch_device)
11451147
backend_reset_peak_memory_stats(torch_device)
11461148

11471149
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)

tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from diffusers.utils.testing_utils import (
3838
backend_empty_cache,
3939
backend_max_memory_allocated,
40+
backend_reset_max_memory_allocated,
4041
backend_reset_peak_memory_stats,
4142
enable_full_determinism,
4243
floats_tensor,
@@ -511,6 +512,7 @@ def callback_fn(step: int, timestep: int, latents: torch.Tensor) -> None:
511512
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
512513
backend_empty_cache(torch_device)
513514
backend_reset_peak_memory_stats(torch_device)
515+
backend_reset_max_memory_allocated(torch_device)
514516

515517
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
516518
"CompVis/stable-diffusion-v1-4", safety_checker=None, torch_dtype=torch.float16
@@ -529,6 +531,7 @@ def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
529531
def test_stable_diffusion_pipeline_with_model_offloading(self):
530532
backend_empty_cache(torch_device)
531533
backend_reset_peak_memory_stats(torch_device)
534+
backend_reset_max_memory_allocated(torch_device)
532535

533536
inputs = self.get_inputs(torch_device, dtype=torch.float16)
534537

tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from diffusers.utils.testing_utils import (
4040
backend_empty_cache,
4141
backend_max_memory_allocated,
42+
backend_reset_max_memory_allocated,
4243
backend_reset_peak_memory_stats,
4344
enable_full_determinism,
4445
floats_tensor,
@@ -702,6 +703,7 @@ def test_stable_diffusion_inpaint_k_lms(self):
702703
def test_stable_diffusion_inpaint_with_sequential_cpu_offloading(self):
703704
backend_empty_cache(torch_device)
704705
backend_reset_peak_memory_stats(torch_device)
706+
backend_reset_max_memory_allocated(torch_device)
705707

706708
pipe = StableDiffusionInpaintPipeline.from_pretrained(
707709
"botp/stable-diffusion-v1-5-inpainting", safety_checker=None, torch_dtype=torch.float16
@@ -904,6 +906,7 @@ def test_stable_diffusion_inpaint_k_lms(self):
904906
def test_stable_diffusion_inpaint_with_sequential_cpu_offloading(self):
905907
backend_empty_cache(torch_device)
906908
backend_reset_peak_memory_stats(torch_device)
909+
backend_reset_max_memory_allocated(torch_device)
907910

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

tests/pipelines/stable_diffusion/test_stable_diffusion_instruction_pix2pix.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from diffusers.utils.testing_utils import (
3636
backend_empty_cache,
3737
backend_max_memory_allocated,
38+
backend_reset_max_memory_allocated,
3839
backend_reset_peak_memory_stats,
3940
enable_full_determinism,
4041
floats_tensor,
@@ -389,6 +390,7 @@ def callback_fn(step: int, timestep: int, latents: torch.Tensor) -> None:
389390
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
390391
backend_empty_cache(torch_device)
391392
backend_reset_peak_memory_stats(torch_device)
393+
backend_reset_max_memory_allocated(torch_device)
392394

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

tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNet2DConditionModel
2626
from diffusers.utils.testing_utils import (
2727
backend_empty_cache,
28+
backend_reset_max_memory_allocated,
2829
backend_reset_peak_memory_stats,
2930
enable_full_determinism,
3031
floats_tensor,
@@ -245,6 +246,7 @@ def test_stable_diffusion_inpaint_pipeline_fp16(self):
245246
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
246247
backend_empty_cache(torch_device)
247248
backend_reset_peak_memory_stats(torch_device)
249+
backend_reset_max_memory_allocated(torch_device)
248250

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

tests/pipelines/stable_diffusion_2/test_stable_diffusion_v_pred.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from diffusers.utils.testing_utils import (
3434
backend_empty_cache,
3535
backend_max_memory_allocated,
36+
backend_reset_max_memory_allocated,
3637
backend_reset_peak_memory_stats,
3738
enable_full_determinism,
3839
load_numpy,
@@ -535,6 +536,7 @@ def test_stable_diffusion_low_cpu_mem_usage_v_pred(self):
535536
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading_v_pred(self):
536537
backend_empty_cache(torch_device)
537538
backend_reset_peak_memory_stats(torch_device)
539+
backend_reset_max_memory_allocated(torch_device)
538540

539541
pipeline_id = "stabilityai/stable-diffusion-2"
540542
prompt = "Andromeda galaxy in a bottle"

tests/pipelines/stable_diffusion_image_variation/test_stable_diffusion_image_variation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from diffusers.utils.testing_utils import (
3333
backend_empty_cache,
3434
backend_max_memory_allocated,
35+
backend_reset_max_memory_allocated,
3536
backend_reset_peak_memory_stats,
3637
enable_full_determinism,
3738
floats_tensor,
@@ -263,6 +264,7 @@ def callback_fn(step: int, timestep: int, latents: torch.Tensor) -> None:
263264
def test_stable_diffusion_pipeline_with_sequential_cpu_offloading(self):
264265
backend_empty_cache(torch_device)
265266
backend_reset_peak_memory_stats(torch_device)
267+
backend_reset_max_memory_allocated(torch_device)
266268

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

0 commit comments

Comments
 (0)