Skip to content

Commit 7421933

Browse files
committed
utils/pil_utils: add TORCH_INTERPOLATION map for consistent resample-mode translation
1 parent 9ed594f commit 7421933

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/diffusers/utils/pil_utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
"nearest": PIL.Image.NEAREST,
2222
}
2323

24-
# Maps VaeImageProcessor `resample` config strings to torch.nn.functional.interpolate modes.
25-
# "lanczos" has no native torch equivalent; bilinear+antialias is the closest high-quality substitute.
26-
# The bool indicates whether antialias=True should be passed (not supported for "nearest").
24+
# Resample modes natively supported by torch.nn.functional.interpolate.
25+
# Modes absent from this dict (e.g. "lanczos") are not supported; callers
26+
# should warn and fall back to default "nearest" behavior.
2727
TORCH_INTERPOLATION = {
2828
"linear": ("bilinear", True),
2929
"bilinear": ("bilinear", True),
3030
"bicubic": ("bicubic", True),
31-
"lanczos": ("bilinear", True),
3231
"nearest": ("nearest", False),
3332
}
3433

0 commit comments

Comments
 (0)