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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions torchtune/models/llama3_2_vision/_model_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

encoder = llama3_2_vision_encoder(
patch_size=14,
num_heads=16,
Expand Down Expand Up @@ -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?

decoder_type = LoRATrainable(decoder_trainable.lower())
encoder_type = LoRATrainable(encoder_trainable.lower())
fusion_type = LoRATrainable(fusion_trainable.lower())
Expand Down
Loading