Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processor accepts any kwargs #31889

Merged
merged 5 commits into from
Jul 11, 2024

Conversation

zucchini-nlp
Copy link
Member

What does this PR do?

This PR changes VLMs' processors so that they can accept any kwarg, but will raise a warning if any of the passed kwargs is not used.

Currently, if a new kwargs is added to processors (e.g. chat template), the updated files on the hub won't work with older version of transformers because older versions didn't have a new kwargs in their __init__. This change will facilitate future PRs that introduce new kwargs in processors, and we'll be able to add any feature without problems

Note: PR doesn't modify processors of image-only or audio-only models, and actually some of them already support **kwargs at init (e.g. Clip) due to the deprecation cycle of "feature_extractor" kwarg.

@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
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!

src/transformers/processing_utils.py Outdated Show resolved Hide resolved
@zucchini-nlp zucchini-nlp merged commit 14d3b3f into huggingface:main Jul 11, 2024
20 checks passed
amyeroberts pushed a commit to amyeroberts/transformers that referenced this pull request Jul 19, 2024
* accept kwargs in processors

* return unused kwargs

* fix tests

* typo

* update the other way
MHRDYN7 pushed a commit to MHRDYN7/transformers that referenced this pull request Jul 23, 2024
* accept kwargs in processors

* return unused kwargs

* fix tests

* typo

* update the other way
zucchini-nlp added a commit to zucchini-nlp/transformers that referenced this pull request Jul 24, 2024
* accept kwargs in processors

* return unused kwargs

* fix tests

* typo

* update the other way
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