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 摘要。