Skip to content

fix: remove nonexistent PILImageResampling import from video_processing_utils#45227

Closed
akhilc08 wants to merge 2 commits intohuggingface:mainfrom
akhilc08:fix/remove-nonexistent-pilimageResampling-import
Closed

fix: remove nonexistent PILImageResampling import from video_processing_utils#45227
akhilc08 wants to merge 2 commits intohuggingface:mainfrom
akhilc08:fix/remove-nonexistent-pilimageResampling-import

Conversation

@akhilc08
Copy link
Copy Markdown

@akhilc08 akhilc08 commented Apr 3, 2026

Summary

  • Remove the unused PILImageResampling runtime import from video_processing_utils.py which causes an ImportError when Pillow is not installed
  • Also remove the now-unused is_vision_available import that only guarded the removed import
  • PILImageResampling was only referenced in string type annotations and docstrings, so no runtime import is needed

Details

PILImageResampling is defined in image_utils.py only inside an if is_vision_available(): block (i.e., only when Pillow is installed). When users install transformers without Pillow (e.g., pip install transformers[torch]), the import fails with:

ImportError: cannot import name 'PILImageResampling' from 'transformers.image_utils'

This blocks transformers serve and transformers chat commands.

Closes #44933

🤖 Generated with Claude Code

akhilc08 and others added 2 commits April 3, 2026 13:42
…decoding

Add bounds check in `_split_tokens_on_unicode()` to prevent IndexError
when the decoded token stream ends with a dangling Unicode replacement
character (U+FFFD), causing the computed index to equal `len(decoded_full)`.

Closes #44869

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ng_utils

The PILImageResampling name is only defined in image_utils.py when
Pillow is installed (inside `if is_vision_available():`). When Pillow
is not installed, importing it causes an ImportError. Since
PILImageResampling is only used in string type annotations and
docstrings in video_processing_utils.py, the runtime import is
unnecessary. Remove both the import and the now-unused
is_vision_available import.

Closes #44933

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

[For maintainers] Suggested jobs to run (before merge)

run-slow: whisper

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=45227&sha=941832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nonexistant import from image_utils

1 participant