InpaintProcessor crashes when padding_mask_crop is set and a dimension is omitted

Đang mở Phù hợp với người mới
#15,433 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@QTSHI đang làm issue này rồi.

Từ ngày 1/12/2026.

  • #15443 của @QTSHI — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, pytorch
Lĩnh vực
computer-vision

Hướng nghiên cứu

Bắt đầu bằng cách đọc InpaintProcessor.preprocess() trong src/diffusers/image_processor.py và theo dõi cách suy ra kích thước ảnh khi bỏ qua height hoặc width. Tái hiện lỗi bằng ví dụ CPU trong issue, sau đó kiểm tra các bài kiểm thử gần đó của bộ xử lý ảnh để xác định nơi thêm trường hợp hồi quy. Công việc hoàn tất khi tiền xử lý với padding_mask_crop thành công dù bỏ qua một trong hai chiều và bài kiểm thử hồi quy đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

InpaintProcessor.preprocess() works without height and width until I set padding_mask_crop. With cropping enabled, omitting either dimension raises a TypeError.

from PIL import Image
from diffusers.image_processor import InpaintProcessor

image = Image.new("RGB", (64, 48))
mask = Image.new("L", image.size)
mask.paste(255, (24, 16, 40, 32))

InpaintProcessor().preprocess(image, mask=mask, padding_mask_crop=8)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'NoneType'

Passing both dimensions works. The crop calculation divides width by height before the processor has inferred the missing dimensions. I expected the omitted dimensions to be inferred from the input image, as they are without cropping.

Reproduced on main at 08d5de30 (Diffusers 0.44.0.dev0) on CPU. No model weights are needed.

Would it make sense to reuse the image processor's existing size inference before computing the crop? I can send a small PR with a regression test if that approach looks right.

Ngôn ngữ chính
Python
Star
35k
Fork
7.5k
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
58

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của huggingface/diffusers

Tất cả issue của huggingface/diffusers

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.