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

enforce original size to be a list #33564

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

dom-dziela
Copy link
Contributor

What does this PR do?

Fixes #33531
Changes the datatype of original_size from torch.tensor(original_size, dtype = torch.int64) to a list. This prevents possible calculation inaccuracies induced by hardware- and torch-versions, as in issue above, by conducting calculation in base python.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
  • Did you read the Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@amyeroberts
@zucchini-nlp

Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

@dom-dziela Thanks for fixing this! Can you run make fix-copies to make our CI happy?

@dom-dziela
Copy link
Contributor Author

If I run make fix-copies the changes are deleted. Am I doing something wrong? Sorry first PR :)

@zucchini-nlp
Copy link
Member

@dom-dziela Ah, I forgot this is LLaVa-OV. The modified function has a # Copied from transformers.models.llava_next.modeling_llava_next.unpad_image just above, so you'd need to fix the same function in llava-next and run make fix-copies again 🤗

@dom-dziela dom-dziela force-pushed the change_dtype_in_unpad_images branch from 9a55164 to 6b4ff66 Compare September 18, 2024 14:37
@zucchini-nlp
Copy link
Member

@dom-dziela Thanks a lot! Can you pls also propagate changes to llava-next-video model? My bad that it didn't propagare automatically with make fix-copies

Also, requested review from core maintainer, after their approval we can merge

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 fixing!

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

@amyeroberts amyeroberts merged commit 9db963a into huggingface:main Sep 18, 2024
16 checks passed
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* enforce original size to be a list

* formatting

* apply datatype change to unpad_image in llava_next
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.

Numerical inaccuracy in unpad_image (LlavaOnevison)
4 participants