Conversation
|
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. |
|
run-slow: conditional_detr, deformable_detr, detr, grounding_dino, rf_detr, rt_detr, yolos |
|
This comment contains models: ["models/conditional_detr", "models/deformable_detr", "models/detr", "models/grounding_dino", "models/rf_detr", "models/rt_detr", "models/yolos"] |
CI ResultsCommit Info
Model CI Report❌ 2 new failed tests from this PR 😭
|
|
run-slow: rf_detr |
| ("cuda", (8, 0)): [0.959521, 0.931229, 0.897797, 0.7286, 0.672863], | ||
| ("xpu", None): [0.959521, 0.931229, 0.897797, 0.7286, 0.672863], | ||
| ("cuda", (8, 0)): [0.960207, 0.934029, 0.896868, 0.718928, 0.707891], | ||
| ("cpu", None): [0.960285, 0.934246, 0.896883, 0.718877, 0.707271], |
There was a problem hiding this comment.
regenerated because of antialiasing change in preprocessing
|
This comment contains models: ["models/rf_detr"] |
zucchini-nlp
left a comment
There was a problem hiding this comment.
It's great to see grouped iter (could be an mlinter rule 🤔 ). I am seeing a breaking changes, and not sure why are they added, left comments 👇🏻
| annotations = reorder_images(grouped_annotations, grouped_images_index) | ||
| encoded_inputs["labels"] = [ | ||
| BatchFeature(annotation, tensor_type=return_tensors) for annotation in annotations | ||
| ] |
There was a problem hiding this comment.
what is the diff here from DetrImageProcessor._preprocess?
There was a problem hiding this comment.
rfdetr does rescale then resize while detr does resize then rescale
| if paired_list is None | ||
| else {key: [item] for key, item in _iterate_items(paired_list, is_nested)} |
There was a problem hiding this comment.
why we had to return a list[item] instead of unsqueezing a new dim?
There was a problem hiding this comment.
because with disable_grouping==False we always returned a list instead of unsqueeze. The reason is that paired values are not necessarily tensors.
| ) | ||
| image = resized_image | ||
| orig_size = stacked_images.shape[-2:] | ||
| stacked_images = self.resize(stacked_images, size=size, resample=resample, antialias=False) |
There was a problem hiding this comment.
this is breaking, why we need to change antialias=False?
There was a problem hiding this comment.
zucchini-nlp
left a comment
There was a problem hiding this comment.
LGTM, lets run slow tests for rf_detr before merging
| grouped_annotations[key] = stacked_annotations | ||
| processed_images = reorder_images(grouped_images, grouped_images_index) | ||
|
|
||
| if do_pad: | ||
| # depends on all resized image shapes so we need another loop | ||
| if pad_size is not None: | ||
| padded_size = (pad_size.height, pad_size.width) | ||
| else: | ||
| padded_size = get_max_height_width(images) | ||
|
|
||
| padded_images = [] | ||
| padded_annotations = [] | ||
| for image, annotation in zip(images, annotations if annotations is not None else [None] * len(images)): |
There was a problem hiding this comment.
do_pad can go under the same loop since we're reusing the rescaled images without "reorder then group again" code in between
There was a problem hiding this comment.
Sadly not possible because of padded_size = get_max_height_width(images) which requires the first loop to be complete.
|
run-slow: conditional_detr, deformable_detr, detr, grounding_dino, rf_detr, rt_detr, yolos |
|
[For maintainers] Suggested jobs to run (before merge) run-slow: conditional_detr, deformable_detr, detr, grounding_dino, rf_detr, rt_detr, yolos |
CI recapDashboard: View test results in Grafana |
vasqu
left a comment
There was a problem hiding this comment.
Imo just one design question but if you feel like it's not really appropriate feel free to ignore
|
run-slow: conditional_detr |
Nvidia CIThis comment contains models: ["models/conditional_detr"] |
AMD CIThis comment contains models: ["models/conditional_detr"] |
What does this PR do?
Speeds up preprocessing on GPU for all detr models by using
group_images_by_shape. With batch size 32 and ragged inputs between 512px to 2048px I got 27-38% speed up on an H100:Other minor changes:
group_images_by_shapenow allows passingNoneaspaired_inputwhich simplifies annotation handlingLooks like a lot of changes but only detr, rt-detr, and rf-detr changed. The rest is auto-generated.
cc @molbap @zucchini-nlp