"git@developer.sourcefind.cn:OpenDAS/torch-cluster.git" did not exist on "73412857f2b1e7b7ca8b47ad0eebea2d5dc674ea"
Unverified Commit a67ff323 authored by Dhruv Nair's avatar Dhruv Nair Committed by GitHub
Browse files

Move slow tests to nightly (#4526)

* move slow pix2pixzero tests to nightly

* move slow panorama tests to nightly

* move txt2video full test to nightly

* clean up

* remove nightly test from text to video pipeline
parent 3c1b4933
...@@ -29,7 +29,7 @@ from diffusers import ( ...@@ -29,7 +29,7 @@ from diffusers import (
StableDiffusionPanoramaPipeline, StableDiffusionPanoramaPipeline,
UNet2DConditionModel, UNet2DConditionModel,
) )
from diffusers.utils import slow, torch_device from diffusers.utils import nightly, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS
...@@ -245,9 +245,9 @@ class StableDiffusionPanoramaPipelineFastTests(PipelineLatentTesterMixin, Pipeli ...@@ -245,9 +245,9 @@ class StableDiffusionPanoramaPipelineFastTests(PipelineLatentTesterMixin, Pipeli
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2 assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
@slow @nightly
@require_torch_gpu @require_torch_gpu
class StableDiffusionPanoramaSlowTests(unittest.TestCase): class StableDiffusionPanoramaNightlyTests(unittest.TestCase):
def tearDown(self): def tearDown(self):
super().tearDown() super().tearDown()
gc.collect() gc.collect()
......
...@@ -33,7 +33,7 @@ from diffusers import ( ...@@ -33,7 +33,7 @@ from diffusers import (
UNet2DConditionModel, UNet2DConditionModel,
) )
from diffusers.image_processor import VaeImageProcessor from diffusers.image_processor import VaeImageProcessor
from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils import floats_tensor, load_numpy, nightly, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, load_image, load_pt, require_torch_gpu, skip_mps from diffusers.utils.testing_utils import enable_full_determinism, load_image, load_pt, require_torch_gpu, skip_mps
from ..pipeline_params import ( from ..pipeline_params import (
...@@ -349,9 +349,9 @@ class StableDiffusionPix2PixZeroPipelineFastTests(PipelineLatentTesterMixin, Pip ...@@ -349,9 +349,9 @@ class StableDiffusionPix2PixZeroPipelineFastTests(PipelineLatentTesterMixin, Pip
return super().test_inference_batch_single_identical() return super().test_inference_batch_single_identical()
@slow @nightly
@require_torch_gpu @require_torch_gpu
class StableDiffusionPix2PixZeroPipelineSlowTests(unittest.TestCase): class StableDiffusionPix2PixZeroPipelineNightlyTests(unittest.TestCase):
def tearDown(self): def tearDown(self):
super().tearDown() super().tearDown()
gc.collect() gc.collect()
...@@ -477,9 +477,9 @@ class StableDiffusionPix2PixZeroPipelineSlowTests(unittest.TestCase): ...@@ -477,9 +477,9 @@ class StableDiffusionPix2PixZeroPipelineSlowTests(unittest.TestCase):
assert mem_bytes < 8.2 * 10**9 assert mem_bytes < 8.2 * 10**9
@slow @nightly
@require_torch_gpu @require_torch_gpu
class InversionPipelineSlowTests(unittest.TestCase): class InversionPipelineNightlyTests(unittest.TestCase):
def tearDown(self): def tearDown(self):
super().tearDown() super().tearDown()
gc.collect() gc.collect()
...@@ -539,47 +539,6 @@ class InversionPipelineSlowTests(unittest.TestCase): ...@@ -539,47 +539,6 @@ class InversionPipelineSlowTests(unittest.TestCase):
assert np.abs(expected_slice - image_slice.cpu().numpy()).max() < 5e-2 assert np.abs(expected_slice - image_slice.cpu().numpy()).max() < 5e-2
def test_stable_diffusion_pix2pix_full(self):
# numpy array of https://huggingface.co/datasets/hf-internal-testing/diffusers-images/blob/main/pix2pix/dog.png
expected_image = load_numpy(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/pix2pix/dog.npy"
)
pipe = StableDiffusionPix2PixZeroPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4", safety_checker=None, torch_dtype=torch.float16
)
pipe.inverse_scheduler = DDIMInverseScheduler.from_config(pipe.scheduler.config)
caption = "a photography of a cat with flowers"
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
pipe.set_progress_bar_config(disable=None)
generator = torch.manual_seed(0)
output = pipe.invert(caption, image=self.raw_image, generator=generator)
inv_latents = output[0]
source_prompts = 4 * ["a cat sitting on the street", "a cat playing in the field", "a face of a cat"]
target_prompts = 4 * ["a dog sitting on the street", "a dog playing in the field", "a face of a dog"]
source_embeds = pipe.get_embeds(source_prompts)
target_embeds = pipe.get_embeds(target_prompts)
image = pipe(
caption,
source_embeds=source_embeds,
target_embeds=target_embeds,
num_inference_steps=50,
cross_attention_guidance_amount=0.15,
generator=generator,
latents=inv_latents,
negative_prompt=caption,
output_type="np",
).images
max_diff = np.abs(expected_image - image).mean()
assert max_diff < 0.05
def test_stable_diffusion_2_pix2pix_full(self): def test_stable_diffusion_2_pix2pix_full(self):
# numpy array of https://huggingface.co/datasets/hf-internal-testing/diffusers-images/blob/main/pix2pix/dog_2.png # numpy array of https://huggingface.co/datasets/hf-internal-testing/diffusers-images/blob/main/pix2pix/dog_2.png
expected_image = load_numpy( expected_image = load_numpy(
......
...@@ -22,11 +22,10 @@ from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer ...@@ -22,11 +22,10 @@ from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import ( from diffusers import (
AutoencoderKL, AutoencoderKL,
DDIMScheduler, DDIMScheduler,
DPMSolverMultistepScheduler,
TextToVideoSDPipeline, TextToVideoSDPipeline,
UNet3DConditionModel, UNet3DConditionModel,
) )
from diffusers.utils import is_xformers_available, load_numpy, skip_mps, slow, torch_device from diffusers.utils import is_xformers_available, load_numpy, require_torch_gpu, skip_mps, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism from diffusers.utils.testing_utils import enable_full_determinism
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
...@@ -170,31 +169,15 @@ class TextToVideoSDPipelineFastTests(PipelineTesterMixin, unittest.TestCase): ...@@ -170,31 +169,15 @@ class TextToVideoSDPipelineFastTests(PipelineTesterMixin, unittest.TestCase):
@slow @slow
@skip_mps @skip_mps
@require_torch_gpu
class TextToVideoSDPipelineSlowTests(unittest.TestCase): class TextToVideoSDPipelineSlowTests(unittest.TestCase):
def test_full_model(self):
expected_video = load_numpy(
"https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text_to_video/video.npy"
)
pipe = TextToVideoSDPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
prompt = "Spiderman is surfing"
generator = torch.Generator(device="cpu").manual_seed(0)
video_frames = pipe(prompt, generator=generator, num_inference_steps=25, output_type="pt").frames
video = video_frames.cpu().numpy()
assert np.abs(expected_video - video).mean() < 5e-2
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"
) )
pipe = TextToVideoSDPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b") pipe = TextToVideoSDPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b")
pipe = pipe.to("cuda") pipe = pipe.to(torch_device)
prompt = "Spiderman is surfing" prompt = "Spiderman is surfing"
generator = torch.Generator(device="cpu").manual_seed(0) generator = torch.Generator(device="cpu").manual_seed(0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment