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

Assert LLama Vision Image size divides by 14 #1745

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pbontrager
Copy link
Contributor

Image size must be divisible by ViT patches in the CLIP encoder, 14.

Copy link

pytorch-bot bot commented Oct 2, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/1745

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 2ac9100 with merge base 7cf656b (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 2, 2024
@joecummings
Copy link
Contributor

Add a test.

@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 69.34%. Comparing base (7cf656b) to head (2ac9100).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...orchtune/models/llama3_2_vision/_model_builders.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1745      +/-   ##
==========================================
+ Coverage   69.33%   69.34%   +0.01%     
==========================================
  Files         305      305              
  Lines       15892    15914      +22     
==========================================
+ Hits        11018    11036      +18     
- Misses       4874     4878       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -159,6 +160,7 @@ def lora_llama3_2_vision_11b(
a subset of the attention projections in each layer.

"""
assert image_size % 14 == 0, "image_size must be divisible by 14, the encode patch size"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make this a ValueError instead?

@@ -41,6 +41,7 @@ def llama3_2_vision_11b(
Returns:
DeepFusionModel: Instantiation of the Llama 3.2 Vision 11B model
"""
assert image_size % 14 == 0, "image_size must be divisible by 14, the encode patch size"
Copy link
Contributor

Choose a reason for hiding this comment

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

did you mean encoder or encode?

Also, should it be ValueError, or assert? I think that normally we prefer to raise ValueError

Copy link
Contributor

Choose a reason for hiding this comment

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

just saw Rafi's comment :P

Copy link
Contributor

@RdoubleA RdoubleA left a comment

Choose a reason for hiding this comment

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

just need to address comments and it's good to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants