Skip to content

Commit e2dae06

Browse files
authored
[tests] Fix controlnet tests (#13736)
* add serge reviewer to enable claude for inline reviews. * remove local settings * fix controlnet test failures. * remove serge reviewer workflow from the mix
1 parent 037efda commit e2dae06

4 files changed

Lines changed: 14 additions & 25 deletions

File tree

tests/pipelines/controlnet_flux/test_controlnet_flux.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_dummy_inputs(self, device, seed=0):
143143
(1, 3, 32, 32),
144144
generator=generator,
145145
device=torch.device(device),
146-
dtype=torch.float16,
146+
dtype=torch.float32,
147147
)
148148

149149
controlnet_conditioning_scale = 0.5
@@ -163,7 +163,7 @@ def get_dummy_inputs(self, device, seed=0):
163163
def test_controlnet_flux(self):
164164
components = self.get_dummy_components()
165165
flux_pipe = FluxControlNetPipeline(**components)
166-
flux_pipe = flux_pipe.to(torch_device, dtype=torch.float16)
166+
flux_pipe = flux_pipe.to(torch_device, dtype=torch.float32)
167167
flux_pipe.set_progress_bar_config(disable=None)
168168

169169
inputs = self.get_dummy_inputs(torch_device)
@@ -174,9 +174,7 @@ def test_controlnet_flux(self):
174174

175175
assert image.shape == (1, 32, 32, 3)
176176

177-
expected_slice = np.array(
178-
[0.47387695, 0.63134766, 0.5605469, 0.61621094, 0.7207031, 0.7089844, 0.70410156, 0.6113281, 0.64160156]
179-
)
177+
expected_slice = np.array([0.6677, 0.6138, 0.5296, 0.6109, 0.5672, 0.6373, 0.5463, 0.6068, 0.5569])
180178

181179
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, (
182180
f"Expected: {expected_slice}, got: {image_slice.flatten()}"

tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def get_dummy_inputs(self, device, seed=0):
126126
(1, 3, 16, 16),
127127
generator=generator,
128128
device=torch.device(device),
129-
dtype=torch.float16,
129+
dtype=torch.float32,
130130
)
131131

132132
controlnet_conditioning_scale = 0.5
@@ -146,7 +146,7 @@ def get_dummy_inputs(self, device, seed=0):
146146
def test_controlnet_hunyuandit(self):
147147
components = self.get_dummy_components()
148148
pipe = HunyuanDiTControlNetPipeline(**components)
149-
pipe = pipe.to(torch_device, dtype=torch.float16)
149+
pipe = pipe.to(torch_device, dtype=torch.float32)
150150
pipe.set_progress_bar_config(disable=None)
151151

152152
inputs = self.get_dummy_inputs(torch_device)
@@ -156,14 +156,7 @@ def test_controlnet_hunyuandit(self):
156156
image_slice = image[0, -3:, -3:, -1]
157157
assert image.shape == (1, 16, 16, 3)
158158

159-
if torch_device == "xpu":
160-
expected_slice = np.array(
161-
[0.6948242, 0.89160156, 0.59375, 0.5078125, 0.57910156, 0.6035156, 0.58447266, 0.53564453, 0.52246094]
162-
)
163-
else:
164-
expected_slice = np.array(
165-
[0.6953125, 0.89208984, 0.59375, 0.5078125, 0.5786133, 0.6035156, 0.5839844, 0.53564453, 0.52246094]
166-
)
159+
expected_slice = np.array([0.5925, 0.5392, 0.4450, 0.7140, 0.3954, 0.3553, 0.3842, 0.5994, 0.3765])
167160

168161
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, (
169162
f"Expected: {expected_slice}, got: {image_slice.flatten()}"

tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ def get_dummy_inputs(self, device, seed=0):
156156
(1, 3, 32, 32),
157157
generator=generator,
158158
device=torch.device(device),
159-
dtype=torch.float16,
159+
dtype=torch.float32,
160160
)
161161

162162
control_mask = randn_tensor(
163163
(1, 1, 32, 32),
164164
generator=generator,
165165
device=torch.device(device),
166-
dtype=torch.float16,
166+
dtype=torch.float32,
167167
)
168168

169169
controlnet_conditioning_scale = 0.95
@@ -184,7 +184,7 @@ def get_dummy_inputs(self, device, seed=0):
184184
def test_controlnet_inpaint_sd3(self):
185185
components = self.get_dummy_components()
186186
sd_pipe = StableDiffusion3ControlNetInpaintingPipeline(**components)
187-
sd_pipe = sd_pipe.to(torch_device, dtype=torch.float16)
187+
sd_pipe = sd_pipe.to(torch_device, dtype=torch.float32)
188188
sd_pipe.set_progress_bar_config(disable=None)
189189

190190
inputs = self.get_dummy_inputs(torch_device)
@@ -195,9 +195,7 @@ def test_controlnet_inpaint_sd3(self):
195195

196196
assert image.shape == (1, 32, 32, 3)
197197

198-
expected_slice = np.array(
199-
[0.51708984, 0.7421875, 0.4580078, 0.6435547, 0.65625, 0.43603516, 0.5151367, 0.65722656, 0.60839844]
200-
)
198+
expected_slice = np.array([0.2875, 0.3173, 0.4028, 0.7248, 0.6338, 0.4238, 0.1730, 0.4609, 0.5424])
201199

202200
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, (
203201
f"Expected: {expected_slice}, got: {image_slice.flatten()}"

tests/pipelines/controlnet_sd3/test_controlnet_sd3.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def get_dummy_inputs(self, device, seed=0):
173173
(1, 3, 32, 32),
174174
generator=generator,
175175
device=torch.device(device),
176-
dtype=torch.float16,
176+
dtype=torch.float32,
177177
)
178178

179179
controlnet_conditioning_scale = 0.5
@@ -192,7 +192,7 @@ def get_dummy_inputs(self, device, seed=0):
192192

193193
def run_pipe(self, components, use_sd35=False):
194194
sd_pipe = StableDiffusion3ControlNetPipeline(**components)
195-
sd_pipe = sd_pipe.to(torch_device, dtype=torch.float16)
195+
sd_pipe = sd_pipe.to(torch_device, dtype=torch.float32)
196196
sd_pipe.set_progress_bar_config(disable=None)
197197

198198
inputs = self.get_dummy_inputs(torch_device)
@@ -204,9 +204,9 @@ def run_pipe(self, components, use_sd35=False):
204204
assert image.shape == (1, 32, 32, 3)
205205

206206
if not use_sd35:
207-
expected_slice = np.array([0.5767, 0.7100, 0.5981, 0.5674, 0.5952, 0.4102, 0.5093, 0.5044, 0.6030])
207+
expected_slice = np.array([0.4578, 0.3582, 0.4046, 0.0953, 0.6878, 0.5821, 0.5541, 0.5888, 0.4651])
208208
else:
209-
expected_slice = np.array([1.0000, 0.9072, 0.4209, 0.2744, 0.5737, 0.3840, 0.6113, 0.6250, 0.6328])
209+
expected_slice = np.array([0.3721, 0.5626, 0.4657, 0.2845, 0.5241, 0.5917, 0.6265, 0.6955, 0.3969])
210210

211211
assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, (
212212
f"Expected: {expected_slice}, got: {image_slice.flatten()}"

0 commit comments

Comments
 (0)