Skip to content

Conversation

@zucchini-nlp
Copy link
Member

What does this PR do?

As per title, these helpers are used in vLLM and don't work if we save a processor after v5. Now all processor's subcomponents are saved in one single place in processor_config.json, so we need to check it as well when trying to locate the config file

fyi @hmellor

@HuggingFaceDocBuilderDev

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.

Copy link
Contributor

@molbap molbap left a comment

Choose a reason for hiding this comment

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

Thanks, looks fine to me! just a couple questions

Comment on lines +199 to +202
if "audio_processor" in feature_extractor_dict:
feature_extractor_dict = feature_extractor_dict["audio_processor"]
else:
feature_extractor_dict = feature_extractor_dict.get("feature_extractor", feature_extractor_dict)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused by the logic here, can you remind me why we need to get this / why audio_processor is directly accessible?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is to get the actual config from nested structure if we're loading from processor_config.json. In audio models we have no standardization unfortunately, and some call the attribute as audio_processor or feature_extractor

We need to get any of the two keys if available, otherwise just return

Copy link
Contributor

Choose a reason for hiding this comment

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

Crystal clear, thanks, actual audio processors will help a lot when they arrive, cc @eustlb for reference

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes, much needed!

)
return {}

resolved_config_file = resolved_config_files[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

So this means if two are present we don't take the PROCESSOR, why do we iterate on both?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, I haven't noticed that we're prioritizing IMAGE_PROCESSOR here. Imo the priority should be as follows if we find more than one file on the hub:

PROCESSOR -> IMAGE_PROCESSOR and for videos PROCESSOR -> VIDEO_PROCESSOR -> IMAGE_PROCESSOR

Do you think this priority makes sense? I will update accordingly

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it respects the encapsulation of concerns for this set of class, IMO ok!

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

[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.

3 participants