Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/lora/test_lora_layers_sd.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class StableDiffusionLoRATests(PeftLoraLoaderMixinTests, unittest.TestCase):
"latent_channels": 4,
}

def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down Expand Up @@ -150,6 +155,11 @@ def test_integration_move_lora_cpu(self):
@require_torch_gpu
@require_peft_backend
class LoraIntegrationTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
10 changes: 10 additions & 0 deletions tests/lora/test_lora_layers_sdxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ class StableDiffusionXLLoRATests(PeftLoraLoaderMixinTests, unittest.TestCase):
"sample_size": 128,
}

def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand All @@ -100,6 +105,11 @@ def tearDown(self):
@require_torch_gpu
@require_peft_backend
class LoraSDXLIntegrationTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
6 changes: 6 additions & 0 deletions tests/models/autoencoders/test_models_vae.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,12 @@ def test_stable_diffusion_encode_sample(self, seed, expected_slice):

@slow
class ConsistencyDecoderVAEIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/animatediff/test_animatediff.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ def test_xformers_attention_forwardGenerator_pass(self):
@slow
@require_torch_gpu
class AnimateDiffPipelineSlowTests(unittest.TestCase):
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
super().tearDown()
Expand Down
10 changes: 10 additions & 0 deletions tests/pipelines/audioldm/test_audioldm.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ def test_xformers_attention_forwardGenerator_pass(self):

@nightly
class AudioLDMPipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down Expand Up @@ -411,6 +416,11 @@ def test_audioldm(self):

@nightly
class AudioLDMPipelineNightlyTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/audioldm2/test_audioldm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,11 @@ def test_sequential_cpu_offload_forward_pass(self):

@nightly
class AudioLDM2PipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/consistency_models/test_consistency_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ def test_consistency_model_pipeline_onestep_class_cond(self):
@nightly
@require_torch_gpu
class ConsistencyModelPipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
10 changes: 10 additions & 0 deletions tests/pipelines/controlnet/test_controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,11 @@ def test_save_pretrained_raise_not_implemented_exception(self):
@slow
@require_torch_gpu
class ControlNetPipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down Expand Up @@ -1135,6 +1140,11 @@ def test_single_file_component_configs(self):
@slow
@require_torch_gpu
class StableDiffusionMultiControlNetPipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/controlnet/test_controlnet_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ def test_save_pretrained_raise_not_implemented_exception(self):
@slow
@require_torch_gpu
class ControlNetImg2ImgPipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/controlnet/test_controlnet_inpaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@ def test_save_pretrained_raise_not_implemented_exception(self):
@slow
@require_torch_gpu
class ControlNetInpaintPipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/controlnet/test_controlnet_sdxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,11 @@ def test_negative_conditions(self):
@slow
@require_torch_gpu
class ControlNetSDXLPipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/dance_diffusion/test_dance_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ def test_inference_batch_single_identical(self):
@nightly
@require_torch_gpu
class PipelineIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/dit/test_dit.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def test_xformers_attention_forwardGenerator_pass(self):
@nightly
@require_torch_gpu
class DiTPipelineIntegrationTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/i2vgen_xl/test_i2vgenxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ def test_num_videos_per_prompt(self):
@slow
@require_torch_gpu
class I2VGenXLPipelineSlowTests(unittest.TestCase):
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
super().tearDown()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/kandinsky/test_kandinsky_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ def test_kandinsky_img2img(self):
@nightly
@require_torch_gpu
class KandinskyImg2ImgPipelineNightlyTests(unittest.TestCase):
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
super().tearDown()
Expand Down
10 changes: 10 additions & 0 deletions tests/pipelines/latent_diffusion/test_latent_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ def test_inference_text2img(self):
@nightly
@require_torch_gpu
class LDMTextToImagePipelineSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down Expand Up @@ -174,6 +179,11 @@ def test_ldm_default_ddim(self):
@nightly
@require_torch_gpu
class LDMTextToImagePipelineNightlyTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/ledits_pp/test_ledits_pp_stable_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ def test_ledits_pp_warmup_steps(self):
@slow
@require_torch_gpu
class LEditsPPPipelineStableDiffusionSlowTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/musicldm/test_musicldm.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ def test_to_dtype(self):
@nightly
@require_torch_gpu
class MusicLDMPipelineNightlyTests(unittest.TestCase):
def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/paint_by_example/test_paint_by_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ def test_inference_batch_single_identical(self):
@nightly
@require_torch_gpu
class PaintByExamplePipelineIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
5 changes: 5 additions & 0 deletions tests/pipelines/pixart_alpha/test_pixart.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ class PixArtAlphaPipelineIntegrationTests(unittest.TestCase):
ckpt_id_512 = "PixArt-alpha/PixArt-XL-2-512x512"
prompt = "A small cactus with a happy face in the Sahara desert."

def setUp(self):
super().setUp()
gc.collect()
torch.cuda.empty_cache()

def tearDown(self):
super().tearDown()
gc.collect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@


class SafeDiffusionPipelineFastTests(unittest.TestCase):
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
super().tearDown()
Expand Down Expand Up @@ -267,6 +273,12 @@ def test_semantic_diffusion_fp16(self):
@nightly
@require_torch_gpu
class SemanticDiffusionPipelineIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/shap_e/test_shap_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ def test_sequential_cpu_offload_forward_pass(self):
@nightly
@require_torch_gpu
class ShapEPipelineIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/shap_e/test_shap_e_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ def test_sequential_cpu_offload_forward_pass(self):
@nightly
@require_torch_gpu
class ShapEImg2ImgPipelineIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/stable_cascade/test_stable_cascade_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ def test_stable_cascade_decoder_single_prompt_multiple_image_embeddings_with_gui
@slow
@require_torch_gpu
class StableCascadeDecoderPipelineIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
6 changes: 6 additions & 0 deletions tests/pipelines/stable_cascade/test_stable_cascade_prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ def test_stable_cascade_decoder_prompt_embeds(self):
@slow
@require_torch_gpu
class StableCascadePriorPipelineIntegrationTests(unittest.TestCase):
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
super().tearDown()
Expand Down
Loading