-
Notifications
You must be signed in to change notification settings - Fork 6.5k
[Stable Diffusion] Fix padding / truncation #1226
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
| untruncated_ids = self.tokenizer(prompt, padding="max_length", return_tensors="np").input_ids | ||
|
|
||
| if text_input_ids.shape[-1] > self.tokenizer.model_max_length: | ||
| if not np.equal(text_input_ids, untruncated_ids): |
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.
Error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Suggested Change:
if not np.equal(text_input_ids.all, untruncated_ids.all):
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.
Good catch! Thanks - this should be fixed :-)
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.
Tested changes, verified is it fixed 👍
|
Error: Prompt: Output: |
Thanks should be fixed as well |
|
Merging as it's blocking on some other PRs |
* [Stable Diffusion] Fix padding / truncation * finish
This should fix the padding issue remarked in #1165 .
Still need to add tests, but maybe you could already give it a quick review @anton-l @pcuenca @patil-suraj