InpaintProcessor crashes when padding_mask_crop is set and a dimension is omitted

未關閉 適合新手
#15,433 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@QTSHI 已經在處理了。

開始於 2026年12月1日。

  • #15443 來自 @QTSHI —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
82/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python, pytorch

研究方向

先閱讀 src/diffusers/image_processor.py 中的 InpaintProcessor.preprocess(),追蹤省略 height 或 width 時圖像尺寸的推斷方式。使用 issue 中的 CPU 範例重現故障,接著檢查附近的圖像處理器測試,找出應在哪裡新增回歸測試。省略任一尺寸時,使用 padding_mask_crop 的前處理都能成功,且回歸測試通過,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
35k
分支
7.5k
平均合併
2 天 22 小時
30 天內合併 PR
58

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

huggingface/diffusers 的其他 Issue

查看 huggingface/diffusers 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。