Skip to content

Base import requirements for processors - #48522

Open
zucchini-nlp wants to merge 5 commits into
huggingface:mainfrom
zucchini-nlp:base-import-requirements-processing
Open

Base import requirements for processors#48522
zucchini-nlp wants to merge 5 commits into
huggingface:mainfrom
zucchini-nlp:base-import-requirements-processing

Conversation

@zucchini-nlp

@zucchini-nlp zucchini-nlp commented Sep 4, 2026

Copy link
Copy Markdown
Member

CPU CI GPU run-slow

What does this PR do?

Wanted to do it long time ago, a processor can't be initiated anyway if one of the subprocessor can't. So an error will be raised at run-time and after this PR it is raised at import time

Processor base requirements are inferred from its subprocessors - vision always requires PIL, while videos also require torch since that is the only backend supported. I think for audio we can add torchaudio as well after the big refactor lands

Actually, why don't we make all processors rely on torch at some point, we don't support any other framework anymore and I don't think processors are used to return list/numpy anyway?

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.


class Emu3ProcessorKwargs(ProcessingKwargs, total=False):
text_kwargs: Emu3TextKwargs
images_kwargs: Emu3ImageProcessorKwargs

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

is resolved automatically via self.image_processor.valid_kwargs - this line is redundant

Comment on lines -44 to -48
class Gemma4UnifiedVideoProcessorKwargs(VideosKwargs, total=False):
"""
patch_size (`int`, *optional*):
Size of each image patch in pixels.
max_soft_tokens (`int`, *optional*):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

should've never been here, a bug in modular that is fixed now

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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

run-slow: emu3, fuyu, gemma4, gemma4_unified, pixtral

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 33860172052:1
Result: failure | Jobs: 16 | Tests: 186,272 | Failures: 1 | Duration: 16h 7m

@vasqu vasqu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In general yes aligned here, would like the audio team for requirements potentially (torchaudio)

I wouldn't put torch as basic requirement for now, it could be used to prepare data on a super lightweight container (torch is quite big, even cpu only)

Comment on lines +2923 to +2924
"feature_extractor": [],
"audio_processor": [],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yea ig we could add torchaudio or similar as dep here 馃 not sure about this across all models tho cc @ebezzam @eustlb

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Iirc, torchaudio is no longer maintained anymore. Maybe we should start pivoting when we can

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not across all models yet, some really old ones are in numpy though I think Eustache is planning to get torchaudio as a proper backend for all transforms

for check, requirements in BASE_FILE_REQUIREMENTS.items():
if check(module_name, file_content):
base_requirements = requirements
if isinstance(requirements, Callable):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't everything a callable now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no, they return a tuple of requirements based on file name, and only processors need to check with file content to see supported attributes/modalities

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.

3 participants