Skip to content

Conversation

@qgallouedec
Copy link
Member

@qgallouedec qgallouedec commented Sep 19, 2025

…_thw` in GRPO and RLOO trainers; update `split_pixel_values_by_grid` to use `image_grid_thw`

if hasattr(self.processing_class, "_get_num_multimodal_tokens"):
image_sizes = [(image.height, image.width) for image in images]
multimodal_extra_data = self.processing_class._get_num_multimodal_tokens(image_sizes)
Copy link
Member Author

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

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

Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

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

Nice clean up - LGTM

**kwargs,
)
prompt_inputs = super(_GRPOTrainer, self)._prepare_inputs(prompt_inputs)
prompt_inputs = super()._prepare_inputs(prompt_inputs)
Copy link
Member

Choose a reason for hiding this comment

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

Much cleaner!

if "image_grid_thw" not in batch or "pixel_values" not in batch:
return batch

lengths = batch["image_split_sizes"] # [batch_size]
Copy link
Member

Choose a reason for hiding this comment

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

Do I understand correctly, that image_split_sizes was only really used in this helper method to extract the image lengths? If so, then I agree it's redundant with image_grid_thw

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, precisely

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.

3 participants