mirror of
https://github.com/huggingface/transformers.git
synced 2026-10-29 01:06:24 +08:00
* Remove the torch.stack of cropped images for SAM that was broken for crops_n_layers > 0 crops have different dimensions from the full image/each other, so can't be stacked, keeping them as a list of tensors is compatible * Iterative inference over crops with SAM to avoid errors with crops_n_layers > 0 Every chunk now only carries its own crop's information (features, points, box, sizes) + full image size. The points_per_batch check now catches errors before feature computation. * Fix _pad_masks by allowing non int bounding boxes that generate_crop_boxes produces * Fix the incorrect coordinates of boxes belonging to crop masks * Spread the points correctly across crops by fixing _generate_crop_images * Make crop chunk construction in preprocessing simpler and yield them outside of device context * Implement testing for point and mask generation with crops_n_layers > 0