-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Fix case of nested tensors in BatchMixFeature #35063
Conversation
Hey @Rocketknight1! There is a PR that might be relevant in terms of how args/kwargs are propagated P.S. didn't notice it's a model-related change only, so might be not relevant |
@qubvel thanks for letting me know regardless, since we might make the same change in |
Note - this PR should not be merged yet, as I believe the issue in |
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. |
b74f736
to
8e07742
Compare
cc @ArthurZucker @LysandreJik for core maintainer review, this one should be ready! |
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 fixing!
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.
these tests should be in the image processing / processing but alrights, thanks! 🤗
@@ -66,10 +66,24 @@ def to(self, *args, **kwargs) -> "BatchMixFeature": | |||
Returns: | |||
[`BatchFeature`]: The same instance after modification. | |||
""" | |||
|
|||
def _recursive_to(obj, device, *args, **kwargs): |
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.
it's actually cleaner!
Closing because this change is included in #34801 instead |
Huge kudos to @zucchini-nlp for figuring this one out - we were getting intermittent failures and I couldn't figure out why. The reason was that
BatchMixFeature.to()
was breaking the structure of some inputs, because it used a nested list comprehension that assumed a specific list depth that wasn't always respected byPixtralProcessor
.This PR replaces the slightly hacky
.to()
code with a recursion that should preserve nesting structure regardless of list depth.TODO: