-
Couldn't load subscription status.
- Fork 2.3k
🟩 Drop image_split_sizes in favour of image_grid_thw
#4111
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
Changes from 2 commits
552e899
449ef07
c8933aa
52d8bd9
e17ec42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1783,10 +1783,10 @@ def split_pixel_values_by_grid(batch: dict[str, torch.Tensor]) -> dict[str, Unio | |
| Splits `batch["pixel_values"]` into a list of tensors based on the product of each row in | ||
| `batch["image_grid_thw"]`, while keeping other entries unchanged. | ||
| """ | ||
| if "image_split_sizes" not in batch or "pixel_values" not in batch: | ||
| if "image_grid_thw" not in batch or "pixel_values" not in batch: | ||
| return batch | ||
|
|
||
| lengths = batch["image_split_sizes"] # [batch_size] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I understand correctly, that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, precisely |
||
| lengths = batch["image_grid_thw"].prod(-1).tolist() # [batch_size] | ||
| pixel_values = batch["pixel_values"] # [total, feature_dim] | ||
|
|
||
| if sum(lengths) != pixel_values.size(0): | ||
|
|
||
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 also avoids calling a private method