File tree Expand file tree Collapse file tree 2 files changed +78
-36
lines changed Expand file tree Collapse file tree 2 files changed +78
-36
lines changed Original file line number Diff line number Diff line change 88from diffusers import FluxPipeline , FluxPriorReduxPipeline
99from diffusers .utils import load_image
1010from diffusers .utils .testing_utils import (
11+ Expectations ,
1112 backend_empty_cache ,
1213 numpy_cosine_similarity_distance ,
1314 require_big_accelerator ,
2122@pytest .mark .big_gpu_with_torch_cuda
2223class FluxReduxSlowTests (unittest .TestCase ):
2324 pipeline_class = FluxPriorReduxPipeline
24- repo_id = "YiYiXu/yiyi-redux" # update to " black-forest-labs/FLUX.1-Redux-dev" once PR is merged
25+ repo_id = "black-forest-labs/FLUX.1-Redux-dev"
2526 base_pipeline_class = FluxPipeline
2627 base_repo_id = "black-forest-labs/FLUX.1-schnell"
2728
@@ -69,41 +70,82 @@ def test_flux_redux_inference(self):
6970 image = pipe_base (** base_pipeline_inputs , ** redux_pipeline_output ).images [0 ]
7071
7172 image_slice = image [0 , :10 , :10 ]
72- expected_slice = np .array (
73- [
74- 0.30078125 ,
75- 0.37890625 ,
76- 0.46875 ,
77- 0.28125 ,
78- 0.36914062 ,
79- 0.47851562 ,
80- 0.28515625 ,
81- 0.375 ,
82- 0.4765625 ,
83- 0.28125 ,
84- 0.375 ,
85- 0.48046875 ,
86- 0.27929688 ,
87- 0.37695312 ,
88- 0.47851562 ,
89- 0.27734375 ,
90- 0.38085938 ,
91- 0.4765625 ,
92- 0.2734375 ,
93- 0.38085938 ,
94- 0.47265625 ,
95- 0.27539062 ,
96- 0.37890625 ,
97- 0.47265625 ,
98- 0.27734375 ,
99- 0.37695312 ,
100- 0.47070312 ,
101- 0.27929688 ,
102- 0.37890625 ,
103- 0.47460938 ,
104- ],
105- dtype = np .float32 ,
73+ expected_slices = Expectations (
74+ {
75+ ("cuda" , 7 ): np .array (
76+ [
77+ 0.30078125 ,
78+ 0.37890625 ,
79+ 0.46875 ,
80+ 0.28125 ,
81+ 0.36914062 ,
82+ 0.47851562 ,
83+ 0.28515625 ,
84+ 0.375 ,
85+ 0.4765625 ,
86+ 0.28125 ,
87+ 0.375 ,
88+ 0.48046875 ,
89+ 0.27929688 ,
90+ 0.37695312 ,
91+ 0.47851562 ,
92+ 0.27734375 ,
93+ 0.38085938 ,
94+ 0.4765625 ,
95+ 0.2734375 ,
96+ 0.38085938 ,
97+ 0.47265625 ,
98+ 0.27539062 ,
99+ 0.37890625 ,
100+ 0.47265625 ,
101+ 0.27734375 ,
102+ 0.37695312 ,
103+ 0.47070312 ,
104+ 0.27929688 ,
105+ 0.37890625 ,
106+ 0.47460938 ,
107+ ],
108+ dtype = np .float32 ,
109+ ),
110+ ("xpu" , 3 ): np .array (
111+ [
112+ 0.20507812 ,
113+ 0.30859375 ,
114+ 0.3984375 ,
115+ 0.18554688 ,
116+ 0.30078125 ,
117+ 0.41015625 ,
118+ 0.19921875 ,
119+ 0.3125 ,
120+ 0.40625 ,
121+ 0.19726562 ,
122+ 0.3125 ,
123+ 0.41601562 ,
124+ 0.19335938 ,
125+ 0.31445312 ,
126+ 0.4140625 ,
127+ 0.1953125 ,
128+ 0.3203125 ,
129+ 0.41796875 ,
130+ 0.19726562 ,
131+ 0.32421875 ,
132+ 0.41992188 ,
133+ 0.19726562 ,
134+ 0.32421875 ,
135+ 0.41992188 ,
136+ 0.20117188 ,
137+ 0.32421875 ,
138+ 0.41796875 ,
139+ 0.203125 ,
140+ 0.32617188 ,
141+ 0.41796875 ,
142+ ],
143+ dtype = np .float32 ,
144+ ),
145+ }
106146 )
147+ expected_slice = expected_slices .get_expectation ()
148+
107149 max_diff = numpy_cosine_similarity_distance (expected_slice .flatten (), image_slice .flatten ())
108150
109151 assert max_diff < 1e-4
Original file line number Diff line number Diff line change @@ -1347,7 +1347,7 @@ def test_components_function(self):
13471347
13481348 @unittest .skipIf (torch_device not in ["cuda" , "xpu" ], reason = "float16 requires CUDA or XPU" )
13491349 @require_accelerator
1350- def test_float16_inference (self , expected_max_diff = 5e -2 ):
1350+ def test_float16_inference (self , expected_max_diff = 6e -2 ):
13511351 components = self .get_dummy_components ()
13521352 pipe = self .pipeline_class (** components )
13531353 for component in pipe .components .values ():
You can’t perform that action at this time.
0 commit comments