-
Notifications
You must be signed in to change notification settings - Fork 26.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
Processors: don't default padding side #33942
base: main
Are you sure you want to change the base?
Conversation
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.
Will be cleaner! added a single comment
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. |
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.
➕ on Pablo's comment, good to go otherwise!
value = ( | ||
getattr(self.tokenizer, modality_key) | ||
if hasattr(self.tokenizer, modality_key) | ||
else tokenizer_init_kwargs[modality_key] | ||
) | ||
default_kwargs[modality][modality_key] = value |
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 just realized the issue comes from this line when we use default tokenizer kwargs that were set during init. It a bit breaking if ppl change the attr like padding_side
and that is not reflected in init_kwargs, so I think we can check first tokenizer attr and then fallback to the init kwargs
@molbap wdyt?
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.
Ah I see, yes that makes sense, it should be a "soft" check though to make sure we are not requiring anything at this stage, just that if it is present, it should be superseding.
Handling priorities in this script is 🤪 good catch though!
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.
yea, i think the check is soft as we first see if attribute if present, and if not fallback to the usual init_kwargs[key]
What does this PR do?
Fixes #33847. We should not have default values for padding side after the last PR that enabled passing
padding_side
to tokenizer directly. Users are free to set padding side as tokenizer attr or pass it to processors directlycc @yonigozlan if you had any PRs in progress with default padding-side 😉