-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Support subfolder with AutoProcessor
#29169
Support subfolder with AutoProcessor
#29169
Conversation
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. |
Hi @JingyaHuang, thanks for opening this PR! My understanding is that using Which, tbh, is a bit surprising as it works with other Auto APIs like AutoModel, so I'd be pro adding it here. @ydshieh do you know why it was added originally? |
Thanks @amyeroberts ! Yeah it's a bit suprise, since in Optimum we store config for compiled models, and it works fine with subfolder for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind having this if this removes some confusing / is expected from our usual api!
From optimum perspective, it would be really nice if we could enable subfolder with AutoProcessor, otherwise we might need to override it... @ArthurZucker @amyeroberts |
Will take a look |
Hi. First of all,
this is not the case, and the internal discussion is about that model type is not exposed publicly, not about Looking at the two parts inside
and
in Looking at the definitions of these 2 methods, you will see So, to me, it looks like |
However, there is one thing I still think strange. Let me take a deeper look before merging this PR 🙏 |
even with the PR, the loading is done via the following block rather then # Last try: we use the PROCESSOR_MAPPING.
elif type(config) in PROCESSOR_MAPPING:
return PROCESSOR_MAPPING[type(config)].from_pretrained(pretrained_model_name_or_path, **kwargs) rather than using the config_dict, _ = FeatureExtractionMixin.get_feature_extractor_dict(
pretrained_model_name_or_path, **kwargs
)
processor_class = config_dict.get("processor_class", None) (as the No big deal. Good for me this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding!
What does this PR do?
Support
subfolder
option inAutoProcessor
. Currently we are not able to load processors in subfolder, eg.We will get following error:
However I am able to load processor in subfolder with directly:
cc. @fxmarty FYI our
maybe_load_preprocessors
is not able to store sentence transformers clip processor without this.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.