transformers
18aa0866 - Fix Sam3Processor missing input_boxes_labels for padded None entries (#45171)

Commit
15 days ago
Fix Sam3Processor missing input_boxes_labels for padded None entries (#45171) * Fix Sam3Processor missing input_boxes_labels for padded None entries When input_boxes contains a mix of None and real box entries (e.g. input_boxes=[None, [[x1,y1,x2,y2]]]), the processor pads None entries with [-10,-10,0,0] but does not generate corresponding input_boxes_labels. The model's geometry encoder then treats all boxes as valid (box_mask=ones), including the padded ones, causing different behavior compared to input_boxes=None. Generate default input_boxes_labels when not provided by the user: None entries get label -10 (the pad value) so the model masks them out, real entries get label 1 (positive). User-provided labels are preserved unchanged. Adds processor tests covering mixed None/real batches, all-real batches, no-boxes, and user-provided label preservation. Fixes #45059 * simplify processing and standardize tests --------- Co-authored-by: yonigozlan <yoni.gozlan@huggingface.co>
Author
Parents
Loading