Skip to content

Commit 05be622

Browse files
Fix depth pipeline "input/weight type should be the same" error at fp16 (#8321)
Fix "input/weight type should be the same" Co-authored-by: YiYi Xu <[email protected]>
1 parent 352d96e commit 05be622

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def prepare_depth_map(self, image, depth_map, batch_size, do_classifier_free_gui
546546

547547
if depth_map is None:
548548
pixel_values = self.feature_extractor(images=image, return_tensors="pt").pixel_values
549-
pixel_values = pixel_values.to(device=device)
549+
pixel_values = pixel_values.to(device=device, dtype=dtype)
550550
# The DPT-Hybrid model uses batch-norm layers which are not compatible with fp16.
551551
# So we use `torch.autocast` here for half precision inference.
552552
if torch.backends.mps.is_available():

0 commit comments

Comments
 (0)