mirror of
https://github.com/huggingface/diffusers.git
synced 2025-12-14 16:34:27 +08:00
Compare commits
2 Commits
fast-gpu-t
...
tests-memo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
795f2c90fd | ||
|
|
84e2337807 |
2329
tests/lora/test_lora_layers_peft.py
Normal file
2329
tests/lora/test_lora_layers_peft.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -85,6 +85,12 @@ class IFPipelineFastTests(PipelineTesterMixin, IFPipelineTesterMixin, unittest.T
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class IFPipelineSlowTests(unittest.TestCase):
|
class IFPipelineSlowTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -94,6 +94,12 @@ class IFImg2ImgPipelineFastTests(PipelineTesterMixin, IFPipelineTesterMixin, uni
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class IFImg2ImgPipelineSlowTests(unittest.TestCase):
|
class IFImg2ImgPipelineSlowTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ class IFImg2ImgSuperResolutionPipelineFastTests(PipelineTesterMixin, IFPipelineT
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class IFImg2ImgSuperResolutionPipelineSlowTests(unittest.TestCase):
|
class IFImg2ImgSuperResolutionPipelineSlowTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ class IFInpaintingPipelineFastTests(PipelineTesterMixin, IFPipelineTesterMixin,
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class IFInpaintingPipelineSlowTests(unittest.TestCase):
|
class IFInpaintingPipelineSlowTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -94,6 +94,12 @@ class IFInpaintingSuperResolutionPipelineFastTests(PipelineTesterMixin, IFPipeli
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class IFInpaintingSuperResolutionPipelineSlowTests(unittest.TestCase):
|
class IFInpaintingSuperResolutionPipelineSlowTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ class IFSuperResolutionPipelineFastTests(PipelineTesterMixin, IFPipelineTesterMi
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class IFSuperResolutionPipelineSlowTests(unittest.TestCase):
|
class IFSuperResolutionPipelineSlowTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -50,7 +50,14 @@ enable_full_determinism()
|
|||||||
class IPAdapterNightlyTestsMixin(unittest.TestCase):
|
class IPAdapterNightlyTestsMixin(unittest.TestCase):
|
||||||
dtype = torch.float16
|
dtype = torch.float16
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
gc.collect()
|
gc.collect()
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
@@ -313,7 +320,7 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin):
|
|||||||
feature_extractor=feature_extractor,
|
feature_extractor=feature_extractor,
|
||||||
torch_dtype=self.dtype,
|
torch_dtype=self.dtype,
|
||||||
)
|
)
|
||||||
pipeline.to(torch_device)
|
pipeline.enable_model_cpu_offload()
|
||||||
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
||||||
|
|
||||||
inputs = self.get_dummy_inputs()
|
inputs = self.get_dummy_inputs()
|
||||||
@@ -373,7 +380,7 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin):
|
|||||||
feature_extractor=feature_extractor,
|
feature_extractor=feature_extractor,
|
||||||
torch_dtype=self.dtype,
|
torch_dtype=self.dtype,
|
||||||
)
|
)
|
||||||
pipeline.to(torch_device)
|
pipeline.enable_model_cpu_offload()
|
||||||
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
||||||
|
|
||||||
inputs = self.get_dummy_inputs(for_image_to_image=True)
|
inputs = self.get_dummy_inputs(for_image_to_image=True)
|
||||||
@@ -442,7 +449,7 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin):
|
|||||||
feature_extractor=feature_extractor,
|
feature_extractor=feature_extractor,
|
||||||
torch_dtype=self.dtype,
|
torch_dtype=self.dtype,
|
||||||
)
|
)
|
||||||
pipeline.to(torch_device)
|
pipeline.enable_model_cpu_offload()
|
||||||
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
|
||||||
|
|
||||||
inputs = self.get_dummy_inputs(for_inpainting=True)
|
inputs = self.get_dummy_inputs(for_inpainting=True)
|
||||||
@@ -490,7 +497,7 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin):
|
|||||||
image_encoder=image_encoder,
|
image_encoder=image_encoder,
|
||||||
torch_dtype=self.dtype,
|
torch_dtype=self.dtype,
|
||||||
)
|
)
|
||||||
pipeline.to(torch_device)
|
pipeline.enable_model_cpu_offload()
|
||||||
pipeline.load_ip_adapter(
|
pipeline.load_ip_adapter(
|
||||||
"h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter-plus-face_sdxl_vit-h.safetensors"
|
"h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter-plus-face_sdxl_vit-h.safetensors"
|
||||||
)
|
)
|
||||||
@@ -518,7 +525,7 @@ class IPAdapterSDXLIntegrationTests(IPAdapterNightlyTestsMixin):
|
|||||||
image_encoder=image_encoder,
|
image_encoder=image_encoder,
|
||||||
torch_dtype=self.dtype,
|
torch_dtype=self.dtype,
|
||||||
)
|
)
|
||||||
pipeline.to(torch_device)
|
pipeline.enable_model_cpu_offload()
|
||||||
pipeline.load_ip_adapter(
|
pipeline.load_ip_adapter(
|
||||||
"h94/IP-Adapter", subfolder="sdxl_models", weight_name=["ip-adapter-plus-face_sdxl_vit-h.safetensors"] * 2
|
"h94/IP-Adapter", subfolder="sdxl_models", weight_name=["ip-adapter-plus-face_sdxl_vit-h.safetensors"] * 2
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -275,6 +275,12 @@ class KandinskyPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyPipelineIntegrationTests(unittest.TestCase):
|
class KandinskyPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -299,6 +299,12 @@ class KandinskyImg2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyImg2ImgPipelineIntegrationTests(unittest.TestCase):
|
class KandinskyImg2ImgPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -297,6 +297,12 @@ class KandinskyInpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
|
|||||||
@nightly
|
@nightly
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyInpaintPipelineIntegrationTests(unittest.TestCase):
|
class KandinskyInpaintPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -223,6 +223,12 @@ class KandinskyV22PipelineFastTests(PipelineTesterMixin, unittest.TestCase):
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyV22PipelineIntegrationTests(unittest.TestCase):
|
class KandinskyV22PipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
@@ -238,12 +244,12 @@ class KandinskyV22PipelineIntegrationTests(unittest.TestCase):
|
|||||||
pipe_prior = KandinskyV22PriorPipeline.from_pretrained(
|
pipe_prior = KandinskyV22PriorPipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipe_prior.to(torch_device)
|
pipe_prior.enable_model_cpu_offload()
|
||||||
|
|
||||||
pipeline = KandinskyV22Pipeline.from_pretrained(
|
pipeline = KandinskyV22Pipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipeline = pipeline.to(torch_device)
|
pipeline = pipeline.enable_model_cpu_offload()
|
||||||
pipeline.set_progress_bar_config(disable=None)
|
pipeline.set_progress_bar_config(disable=None)
|
||||||
|
|
||||||
prompt = "red cat, 4k photo"
|
prompt = "red cat, 4k photo"
|
||||||
|
|||||||
@@ -228,6 +228,12 @@ class KandinskyV22ControlnetPipelineFastTests(PipelineTesterMixin, unittest.Test
|
|||||||
@nightly
|
@nightly
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyV22ControlnetPipelineIntegrationTests(unittest.TestCase):
|
class KandinskyV22ControlnetPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
@@ -250,12 +256,12 @@ class KandinskyV22ControlnetPipelineIntegrationTests(unittest.TestCase):
|
|||||||
pipe_prior = KandinskyV22PriorPipeline.from_pretrained(
|
pipe_prior = KandinskyV22PriorPipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipe_prior.to(torch_device)
|
pipe_prior.enable_model_cpu_offload()
|
||||||
|
|
||||||
pipeline = KandinskyV22ControlnetPipeline.from_pretrained(
|
pipeline = KandinskyV22ControlnetPipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-controlnet-depth", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-controlnet-depth", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipeline = pipeline.to(torch_device)
|
pipeline = pipeline.enable_model_cpu_offload()
|
||||||
pipeline.set_progress_bar_config(disable=None)
|
pipeline.set_progress_bar_config(disable=None)
|
||||||
|
|
||||||
prompt = "A robot, 4k photo"
|
prompt = "A robot, 4k photo"
|
||||||
|
|||||||
@@ -235,6 +235,12 @@ class KandinskyV22ControlnetImg2ImgPipelineFastTests(PipelineTesterMixin, unitte
|
|||||||
@nightly
|
@nightly
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyV22ControlnetImg2ImgPipelineIntegrationTests(unittest.TestCase):
|
class KandinskyV22ControlnetImg2ImgPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
@@ -264,12 +270,12 @@ class KandinskyV22ControlnetImg2ImgPipelineIntegrationTests(unittest.TestCase):
|
|||||||
pipe_prior = KandinskyV22PriorEmb2EmbPipeline.from_pretrained(
|
pipe_prior = KandinskyV22PriorEmb2EmbPipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipe_prior.to(torch_device)
|
pipe_prior.enable_model_cpu_offload()
|
||||||
|
|
||||||
pipeline = KandinskyV22ControlnetImg2ImgPipeline.from_pretrained(
|
pipeline = KandinskyV22ControlnetImg2ImgPipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-controlnet-depth", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-controlnet-depth", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipeline = pipeline.to(torch_device)
|
pipeline = pipeline.enable_model_cpu_offload()
|
||||||
|
|
||||||
pipeline.set_progress_bar_config(disable=None)
|
pipeline.set_progress_bar_config(disable=None)
|
||||||
|
|
||||||
|
|||||||
@@ -240,6 +240,12 @@ class KandinskyV22Img2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCas
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyV22Img2ImgPipelineIntegrationTests(unittest.TestCase):
|
class KandinskyV22Img2ImgPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
@@ -260,12 +266,12 @@ class KandinskyV22Img2ImgPipelineIntegrationTests(unittest.TestCase):
|
|||||||
pipe_prior = KandinskyV22PriorPipeline.from_pretrained(
|
pipe_prior = KandinskyV22PriorPipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipe_prior.to(torch_device)
|
pipe_prior.enable_model_cpu_offload()
|
||||||
|
|
||||||
pipeline = KandinskyV22Img2ImgPipeline.from_pretrained(
|
pipeline = KandinskyV22Img2ImgPipeline.from_pretrained(
|
||||||
"kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16
|
"kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16
|
||||||
)
|
)
|
||||||
pipeline = pipeline.to(torch_device)
|
pipeline = pipeline.enable_model_cpu_offload()
|
||||||
|
|
||||||
pipeline.set_progress_bar_config(disable=None)
|
pipeline.set_progress_bar_config(disable=None)
|
||||||
|
|
||||||
|
|||||||
@@ -293,6 +293,12 @@ class KandinskyV22InpaintPipelineFastTests(PipelineTesterMixin, unittest.TestCas
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class KandinskyV22InpaintPipelineIntegrationTests(unittest.TestCase):
|
class KandinskyV22InpaintPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -169,6 +169,12 @@ class Kandinsky3PipelineFastTests(PipelineTesterMixin, unittest.TestCase):
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class Kandinsky3PipelineIntegrationTests(unittest.TestCase):
|
class Kandinsky3PipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -187,6 +187,12 @@ class Kandinsky3Img2ImgPipelineFastTests(PipelineTesterMixin, unittest.TestCase)
|
|||||||
@slow
|
@slow
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class Kandinsky3Img2ImgPipelineIntegrationTests(unittest.TestCase):
|
class Kandinsky3Img2ImgPipelineIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# clean up the VRAM after each test
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|||||||
@@ -779,7 +779,14 @@ class StableDiffusionXLImg2ImgRefinerOnlyPipelineFastTests(
|
|||||||
|
|
||||||
@slow
|
@slow
|
||||||
class StableDiffusionXLImg2ImgIntegrationTests(unittest.TestCase):
|
class StableDiffusionXLImg2ImgIntegrationTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# clean up the VRAM before each test
|
||||||
|
super().setUp()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
# clean up the VRAM after each test
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
gc.collect()
|
gc.collect()
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import gc
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -183,6 +184,18 @@ class TextToVideoSDPipelineFastTests(PipelineTesterMixin, SDFunctionTesterMixin,
|
|||||||
@skip_mps
|
@skip_mps
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class TextToVideoSDPipelineSlowTests(unittest.TestCase):
|
class TextToVideoSDPipelineSlowTests(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()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def test_two_step_model(self):
|
def test_two_step_model(self):
|
||||||
expected_video = load_numpy(
|
expected_video = load_numpy(
|
||||||
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/video_2step.npy"
|
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/video_2step.npy"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import gc
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@@ -26,6 +27,18 @@ from ..test_pipelines_common import assert_mean_pixel_difference
|
|||||||
@nightly
|
@nightly
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class TextToVideoZeroPipelineSlowTests(unittest.TestCase):
|
class TextToVideoZeroPipelineSlowTests(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()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def test_full_model(self):
|
def test_full_model(self):
|
||||||
model_id = "runwayml/stable-diffusion-v1-5"
|
model_id = "runwayml/stable-diffusion-v1-5"
|
||||||
pipe = TextToVideoZeroPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
|
pipe = TextToVideoZeroPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import gc
|
||||||
import inspect
|
import inspect
|
||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
@@ -381,6 +382,18 @@ class TextToVideoZeroSDXLPipelineFastTests(PipelineTesterMixin, unittest.TestCas
|
|||||||
@nightly
|
@nightly
|
||||||
@require_torch_gpu
|
@require_torch_gpu
|
||||||
class TextToVideoZeroSDXLPipelineSlowTests(unittest.TestCase):
|
class TextToVideoZeroSDXLPipelineSlowTests(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()
|
||||||
|
gc.collect()
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def test_full_model(self):
|
def test_full_model(self):
|
||||||
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
||||||
pipe = TextToVideoZeroSDXLPipeline.from_pretrained(
|
pipe = TextToVideoZeroSDXLPipeline.from_pretrained(
|
||||||
|
|||||||
Reference in New Issue
Block a user