@@ -77,6 +77,7 @@ def test_load_custom_pipeline(self):
7777 pipeline = DiffusionPipeline .from_pretrained (
7878 "google/ddpm-cifar10-32" , custom_pipeline = "hf-internal-testing/diffusers-dummy-pipeline"
7979 )
80+ pipeline = pipeline .to (torch_device )
8081 # NOTE that `"CustomPipeline"` is not a class that is defined in this library, but solely on the Hub
8182 # under https://huggingface.co/hf-internal-testing/diffusers-dummy-pipeline/blob/main/pipeline.py#L24
8283 assert pipeline .__class__ .__name__ == "CustomPipeline"
@@ -85,6 +86,7 @@ def test_run_custom_pipeline(self):
8586 pipeline = DiffusionPipeline .from_pretrained (
8687 "google/ddpm-cifar10-32" , custom_pipeline = "hf-internal-testing/diffusers-dummy-pipeline"
8788 )
89+ pipeline = pipeline .to (torch_device )
8890 images , output_str = pipeline (num_inference_steps = 2 , output_type = "np" )
8991
9092 assert images [0 ].shape == (1 , 32 , 32 , 3 )
@@ -96,6 +98,7 @@ def test_local_custom_pipeline(self):
9698 pipeline = DiffusionPipeline .from_pretrained (
9799 "google/ddpm-cifar10-32" , custom_pipeline = local_custom_pipeline_path
98100 )
101+ pipeline = pipeline .to (torch_device )
99102 images , output_str = pipeline (num_inference_steps = 2 , output_type = "np" )
100103
101104 assert pipeline .__class__ .__name__ == "CustomLocalPipeline"
@@ -109,7 +112,7 @@ def test_load_pipeline_from_git(self):
109112 clip_model_id = "laion/CLIP-ViT-B-32-laion2B-s34B-b79K"
110113
111114 feature_extractor = CLIPFeatureExtractor .from_pretrained (clip_model_id , device_map = "auto" )
112- clip_model = CLIPModel .from_pretrained (clip_model_id , torch_dtype = torch .float16 , device_map = "auto" )
115+ clip_model = CLIPModel .from_pretrained (clip_model_id , torch_dtype = torch .float16 )
113116
114117 pipeline = DiffusionPipeline .from_pretrained (
115118 "CompVis/stable-diffusion-v1-4" ,
@@ -380,10 +383,11 @@ def test_from_pretrained_hub(self):
380383 scheduler = DDPMScheduler (num_train_timesteps = 10 )
381384
382385 ddpm = DDPMPipeline .from_pretrained (model_path , scheduler = scheduler , device_map = "auto" )
383- ddpm .to (torch_device )
386+ ddpm = ddpm .to (torch_device )
384387 ddpm .set_progress_bar_config (disable = None )
388+
385389 ddpm_from_hub = DiffusionPipeline .from_pretrained (model_path , scheduler = scheduler , device_map = "auto" )
386- ddpm_from_hub .to (torch_device )
390+ ddpm_from_hub = ddpm_from_hub .to (torch_device )
387391 ddpm_from_hub .set_progress_bar_config (disable = None )
388392
389393 generator = torch .manual_seed (0 )
@@ -404,11 +408,11 @@ def test_from_pretrained_hub_pass_model(self):
404408 ddpm_from_hub_custom_model = DiffusionPipeline .from_pretrained (
405409 model_path , unet = unet , scheduler = scheduler , device_map = "auto"
406410 )
407- ddpm_from_hub_custom_model .to (torch_device )
411+ ddpm_from_hub_custom_model = ddpm_from_hub_custom_model .to (torch_device )
408412 ddpm_from_hub_custom_model .set_progress_bar_config (disable = None )
409413
410414 ddpm_from_hub = DiffusionPipeline .from_pretrained (model_path , scheduler = scheduler , device_map = "auto" )
411- ddpm_from_hub .to (torch_device )
415+ ddpm_from_hub = ddpm_from_hub .to (torch_device )
412416 ddpm_from_hub_custom_model .set_progress_bar_config (disable = None )
413417
414418 generator = torch .manual_seed (0 )
0 commit comments