3636 StableDiffusionDepth2ImgPipeline ,
3737 UNet2DConditionModel ,
3838)
39- from diffusers .utils import is_accelerate_available , is_accelerate_version
4039from diffusers .utils .testing_utils import (
4140 enable_full_determinism ,
4241 floats_tensor ,
4342 load_image ,
4443 load_numpy ,
4544 nightly ,
45+ require_accelerate_version_greater ,
4646 require_non_cpu ,
4747 require_torch_gpu ,
4848 skip_mps ,
@@ -227,6 +227,7 @@ def test_save_load_float16(self):
227227 max_diff = np .abs (output - output_loaded ).max ()
228228 self .assertLess (max_diff , 2e-2 , "The output of the fp16 pipeline changed after saving and loading." )
229229
230+ @require_non_cpu
230231 def test_float16_inference (self ):
231232 components = self .get_dummy_components ()
232233 pipe = self .pipeline_class (** components )
@@ -246,10 +247,8 @@ def test_float16_inference(self):
246247 max_diff = np .abs (output - output_fp16 ).max ()
247248 self .assertLess (max_diff , 1.3e-2 , "The outputs of the fp16 and fp32 pipelines are too different." )
248249
249- @unittest .skipIf (
250- not is_accelerate_available () or is_accelerate_version ("<" , "0.14.0" ),
251- reason = "CPU offload is only available with `accelerate v0.14.0` or higher" ,
252- )
250+ @require_non_cpu
251+ @require_accelerate_version_greater ("0.14.0" )
253252 def test_cpu_offload_forward_pass (self ):
254253 components = self .get_dummy_components ()
255254 pipe = self .pipeline_class (** components )
0 commit comments