Compare commits

..

2 Commits

Author SHA1 Message Date
Dhruv Nair 795f2c90fd update 2024-03-22 10:44:25 +00:00
Dhruv Nair 84e2337807 update 2024-03-22 10:39:51 +00:00
12 changed files with 2345 additions and 26 deletions
File diff suppressed because it is too large Load Diff
@@ -115,10 +115,6 @@ class IFImg2ImgPipelineSlowTests(unittest.TestCase):
pipe.unet.set_attn_processor(AttnAddedKVProcessor())
pipe.enable_model_cpu_offload()
torch.cuda.reset_max_memory_allocated()
torch.cuda.empty_cache()
torch.cuda.reset_peak_memory_stats()
image = floats_tensor((1, 3, 64, 64), rng=random.Random(0)).to(torch_device)
generator = torch.Generator(device="cpu").manual_seed(0)
output = pipe(
@@ -113,10 +113,6 @@ class IFImg2ImgSuperResolutionPipelineSlowTests(unittest.TestCase):
pipe.unet.set_attn_processor(AttnAddedKVProcessor())
pipe.enable_model_cpu_offload()
torch.cuda.reset_max_memory_allocated()
torch.cuda.empty_cache()
torch.cuda.reset_peak_memory_stats()
generator = torch.Generator(device="cpu").manual_seed(0)
original_image = floats_tensor((1, 3, 256, 256), rng=random.Random(0)).to(torch_device)
@@ -111,6 +111,7 @@ class IFInpaintingPipelineSlowTests(unittest.TestCase):
pipe.unet.set_attn_processor(AttnAddedKVProcessor())
pipe.enable_model_cpu_offload()
# Super resolution test
torch.cuda.empty_cache()
torch.cuda.reset_max_memory_allocated()
torch.cuda.reset_peak_memory_stats()
@@ -27,6 +27,7 @@ from diffusers.utils.testing_utils import (
load_numpy,
require_torch_gpu,
slow,
torch_device,
)
from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference
@@ -257,7 +258,7 @@ class KandinskyV22PipelineIntegrationTests(unittest.TestCase):
image_emb, zero_image_emb = pipe_prior(
prompt,
generator=generator,
num_inference_steps=3,
num_inference_steps=5,
negative_prompt="",
).to_tuple()
@@ -266,7 +267,7 @@ class KandinskyV22PipelineIntegrationTests(unittest.TestCase):
image_embeds=image_emb,
negative_image_embeds=zero_image_emb,
generator=generator,
num_inference_steps=3,
num_inference_steps=100,
output_type="np",
)
@@ -34,6 +34,7 @@ from diffusers.utils.testing_utils import (
load_numpy,
nightly,
require_torch_gpu,
torch_device,
)
from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference
@@ -269,7 +270,7 @@ class KandinskyV22ControlnetPipelineIntegrationTests(unittest.TestCase):
image_emb, zero_image_emb = pipe_prior(
prompt,
generator=generator,
num_inference_steps=2,
num_inference_steps=5,
negative_prompt="",
).to_tuple()
@@ -279,7 +280,7 @@ class KandinskyV22ControlnetPipelineIntegrationTests(unittest.TestCase):
negative_image_embeds=zero_image_emb,
hint=hint,
generator=generator,
num_inference_steps=2,
num_inference_steps=100,
output_type="np",
)
@@ -35,6 +35,7 @@ from diffusers.utils.testing_utils import (
load_numpy,
nightly,
require_torch_gpu,
torch_device,
)
from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference
@@ -286,7 +287,6 @@ class KandinskyV22ControlnetImg2ImgPipelineIntegrationTests(unittest.TestCase):
strength=0.85,
generator=generator,
negative_prompt="",
num_inference_steps=5,
).to_tuple()
output = pipeline(
@@ -295,7 +295,7 @@ class KandinskyV22ControlnetImg2ImgPipelineIntegrationTests(unittest.TestCase):
negative_image_embeds=zero_image_emb,
hint=hint,
generator=generator,
num_inference_steps=5,
num_inference_steps=100,
height=512,
width=512,
strength=0.5,
@@ -35,6 +35,7 @@ from diffusers.utils.testing_utils import (
load_numpy,
require_torch_gpu,
slow,
torch_device,
)
from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference
@@ -287,7 +288,7 @@ class KandinskyV22Img2ImgPipelineIntegrationTests(unittest.TestCase):
image_embeds=image_emb,
negative_image_embeds=zero_image_emb,
generator=generator,
num_inference_steps=5,
num_inference_steps=100,
height=768,
width=768,
strength=0.2,
@@ -334,7 +334,7 @@ class KandinskyV22InpaintPipelineIntegrationTests(unittest.TestCase):
image_emb, zero_image_emb = pipe_prior(
prompt,
generator=generator,
num_inference_steps=2,
num_inference_steps=5,
negative_prompt="",
).to_tuple()
@@ -344,7 +344,7 @@ class KandinskyV22InpaintPipelineIntegrationTests(unittest.TestCase):
image_embeds=image_emb,
negative_image_embeds=zero_image_emb,
generator=generator,
num_inference_steps=2,
num_inference_steps=100,
height=768,
width=768,
output_type="np",
@@ -192,7 +192,7 @@ class Kandinsky3PipelineIntegrationTests(unittest.TestCase):
generator = torch.Generator(device="cpu").manual_seed(0)
image = pipe(prompt, num_inference_steps=5, generator=generator).images[0]
image = pipe(prompt, num_inference_steps=25, generator=generator).images[0]
assert image.size == (1024, 1024)
@@ -223,7 +223,7 @@ class Kandinsky3PipelineIntegrationTests(unittest.TestCase):
image = image.resize((w, h), resample=Image.BICUBIC, reducing_gap=1)
prompt = "A painting of the inside of a subway train with tiny raccoons."
image = pipe(prompt, image=image, strength=0.75, num_inference_steps=5, generator=generator).images[0]
image = pipe(prompt, image=image, strength=0.75, num_inference_steps=25, generator=generator).images[0]
assert image.size == (512, 512)
@@ -215,7 +215,7 @@ class Kandinsky3Img2ImgPipelineIntegrationTests(unittest.TestCase):
image = image.resize((w, h), resample=Image.BICUBIC, reducing_gap=1)
prompt = "A painting of the inside of a subway train with tiny raccoons."
image = pipe(prompt, image=image, strength=0.75, num_inference_steps=5, generator=generator).images[0]
image = pipe(prompt, image=image, strength=0.75, num_inference_steps=25, generator=generator).images[0]
assert image.size == (512, 512)
-6
View File
@@ -639,12 +639,6 @@ class PipelineTesterMixin:
"`callback_cfg_params = TEXT_TO_IMAGE_CFG_PARAMS.union({'mask', 'masked_image_latents'})`"
)
def setUp(self):
# clean up the VRAM before each test
super().setUp()
gc.collect()
torch.cuda.empty_cache()
def tearDown(self):
# clean up the VRAM after each test in case of CUDA runtime errors
super().tearDown()