Skip to content

Commit f9a77e4

Browse files
committed
fix more cases
1 parent 040e54a commit f9a77e4

File tree

1 file changed

+103
-12
lines changed

1 file changed

+103
-12
lines changed

tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py

Lines changed: 103 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,34 @@ def test_canny(self):
238238

239239
original_image = image[-3:, -3:, -1].flatten()
240240

241-
expected_image = np.array(
242-
[0.43652344, 0.4399414, 0.44921875, 0.45043945, 0.45703125, 0.44873047, 0.43579102, 0.44018555, 0.42578125]
243-
)
241+
if torch_device == "xpu":
242+
expected_image = np.array(
243+
[
244+
0.2944336,
245+
0.30981445,
246+
0.24389648,
247+
0.2890625,
248+
0.32006836,
249+
0.2578125,
250+
0.31469727,
251+
0.34545898,
252+
0.28515625,
253+
]
254+
)
255+
else:
256+
expected_image = np.array(
257+
[
258+
0.43652344,
259+
0.4399414,
260+
0.44921875,
261+
0.45043945,
262+
0.45703125,
263+
0.44873047,
264+
0.43579102,
265+
0.44018555,
266+
0.42578125,
267+
]
268+
)
244269

245270
assert np.abs(original_image.flatten() - expected_image).max() < 1e-2
246271

@@ -277,9 +302,24 @@ def test_pose(self):
277302

278303
original_image = image[-3:, -3:, -1].flatten()
279304

280-
expected_image = np.array(
281-
[0.4091797, 0.4177246, 0.39526367, 0.4194336, 0.40356445, 0.3857422, 0.39208984, 0.40429688, 0.37451172]
282-
)
305+
if torch_device == "xpu":
306+
expected_image = np.array(
307+
[0.59277344, 0.6640625, 0.75146484, 0.74121094, 0.7636719, 0.7426758, 0.6879883, 0.6455078, 0.6386719]
308+
)
309+
else:
310+
expected_image = np.array(
311+
[
312+
0.4091797,
313+
0.4177246,
314+
0.39526367,
315+
0.4194336,
316+
0.40356445,
317+
0.3857422,
318+
0.39208984,
319+
0.40429688,
320+
0.37451172,
321+
]
322+
)
283323

284324
assert np.abs(original_image.flatten() - expected_image).max() < 1e-2
285325

@@ -316,9 +356,34 @@ def test_depth(self):
316356

317357
original_image = image[-3:, -3:, -1].flatten()
318358

319-
expected_image = np.array(
320-
[0.31982422, 0.32177734, 0.30126953, 0.3190918, 0.3100586, 0.31396484, 0.3232422, 0.33544922, 0.30810547]
321-
)
359+
if torch_device == "xpu":
360+
expected_image = np.array(
361+
[
362+
0.7529297,
363+
0.69628906,
364+
0.62060547,
365+
0.76708984,
366+
0.7158203,
367+
0.65185547,
368+
0.74853516,
369+
0.69628906,
370+
0.6455078,
371+
]
372+
)
373+
else:
374+
expected_image = np.array(
375+
[
376+
0.31982422,
377+
0.32177734,
378+
0.30126953,
379+
0.3190918,
380+
0.3100586,
381+
0.31396484,
382+
0.3232422,
383+
0.33544922,
384+
0.30810547,
385+
]
386+
)
322387

323388
assert np.abs(original_image.flatten() - expected_image).max() < 1e-2
324389

@@ -356,8 +421,34 @@ def test_multi_controlnet(self):
356421
assert image.shape == (1024, 1024, 3)
357422

358423
original_image = image[-3:, -3:, -1].flatten()
359-
expected_image = np.array(
360-
[0.43652344, 0.44018555, 0.4494629, 0.44995117, 0.45654297, 0.44848633, 0.43603516, 0.4404297, 0.42626953]
361-
)
424+
425+
if torch_device == "xpu":
426+
expected_image = np.array(
427+
[
428+
0.28320312,
429+
0.28125,
430+
0.31347656,
431+
0.29736328,
432+
0.29077148,
433+
0.33740234,
434+
0.33911133,
435+
0.35668945,
436+
0.38452148,
437+
]
438+
)
439+
else:
440+
expected_image = np.array(
441+
[
442+
0.43652344,
443+
0.44018555,
444+
0.4494629,
445+
0.44995117,
446+
0.45654297,
447+
0.44848633,
448+
0.43603516,
449+
0.4404297,
450+
0.42626953,
451+
]
452+
)
362453

363454
assert np.abs(original_image.flatten() - expected_image).max() < 1e-2

0 commit comments

Comments
 (0)