From 8fe3ec582efbfca2989bd1e3b95c5db34049dbd4 Mon Sep 17 00:00:00 2001 From: yonigozlan Date: Wed, 18 Sep 2024 16:06:15 +0000 Subject: [PATCH] Fix compile error when ninja not available and custon kernel activated --- src/transformers/models/rt_detr/modeling_rt_detr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/transformers/models/rt_detr/modeling_rt_detr.py b/src/transformers/models/rt_detr/modeling_rt_detr.py index d04a5bd4b91a86..4e32434901cdc7 100644 --- a/src/transformers/models/rt_detr/modeling_rt_detr.py +++ b/src/transformers/models/rt_detr/modeling_rt_detr.py @@ -899,7 +899,8 @@ def forward( else: raise ValueError(f"Last dim of reference_points must be 2 or 4, but got {reference_points.shape[-1]}") - if self.disable_custom_kernels: + # Ignore copy + if self.disable_custom_kernels or MultiScaleDeformableAttention is None: # PyTorch implementation output = multi_scale_deformable_attention( value, spatial_shapes_list, sampling_locations, attention_weights