Skip to content

Fix AutoVideoProcessor class lookup when torchvision is unavailable#43989

Open
Abhijeetsingh610 wants to merge 3 commits intohuggingface:mainfrom
Abhijeetsingh610:fix1-43986-video-processor-none-mapping
Open

Fix AutoVideoProcessor class lookup when torchvision is unavailable#43989
Abhijeetsingh610 wants to merge 3 commits intohuggingface:mainfrom
Abhijeetsingh610:fix1-43986-video-processor-none-mapping

Conversation

@Abhijeetsingh610
Copy link
Copy Markdown

@Abhijeetsingh610 Abhijeetsingh610 commented Feb 13, 2026

What does this PR do?

Fixes a crash in AutoVideoProcessor when torchvision is unavailable.

VIDEO_PROCESSOR_MAPPING_NAMES can contain None, and video_processor_class_from_name was doing if class_name in extractors, which raises TypeError for None.

This PR:

  • skips None entries in video_processor_class_from_name
  • adds a regression test in tests/models/auto/test_video_processing_auto.py

Fixes #43986 #43986

@christopher5106
Copy link
Copy Markdown

Hi,

Does this PR also solve this issue: huggingface/diffusers#13140 (comment)

?

Thanks

@Abhijeetsingh610
Copy link
Copy Markdown
Author

Thanks for checking. Yes, this PR addresses the same root cause as huggingface/diffusers#13140.
In that issue, the crash happens in transformers.models.auto.video_processing_auto.video_processor_class_from_name when a mapping entry is None (typically when torchvision is unavailable) and code checks class_name in extractors.
This PR adds a None guard for that lookup and includes a regression test.
So once this is merged and released in transformers, that diffusers issue should be resolved when using the updated transformers version.

@Frojdholm
Copy link
Copy Markdown

@christopher5106 note that the root cause for the crash is you not having torchvision installed.

If your model requires a video processor it will not work since this will not create one. If the video processor is optional this might solve your issue.

@christopher5106
Copy link
Copy Markdown

@Frojdholm the bug appears on an image model, Qwen-Image and Qwen-Image-Edit. In that case, there is no video in inputs and outputs.

Copy link
Copy Markdown
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the fix we want. Video processors were originally copied from image processor that have slow/fast versions. But since videos entirely rely on torchvision, we need to raise an error if it's not installed and not skip until the last error message

Same might apply for image processors, only in case when the model has a fast-only processor implemented (we have a couple models only). We need to check if torchvision is installed in L363 elif video_processor_class is None and not is_torchvision_available(): raise ValueError(informative and actioanable message)

@github-actions
Copy link
Copy Markdown
Contributor

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

run-slow: auto

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.

Confusing crash when loading a video model through AutoProcessor without torchvision installed

5 participants