File "E:\project\Grounded-SAM-2-main_2.0\grounding_dino\groundingdino\models\GroundingDINO\ms_deform_attn.py", line 53, in forward
output = _C.ms_deform_attn_forward(
NameError: name '_C' is not defined
临时解决方法:
grounding_dino/groundingdino/models/GroundingDINO/ms_deform_attn.py
if torch.cuda.is_available() and value.is_cuda and 0:
halffloat = False
if value.dtype == torch.float16:
halffloat = True
value = value.float()
sampling_locations = sampling_locations.float()
attention_weights = attention_weights.float()
output = MultiScaleDeformableAttnFunction.apply(
value,
spatial_shapes,
level_start_index,
sampling_locations,
attention_weights,
self.im2col_step,
)
if halffloat:
output = output.half()
else:
output = multi_scale_deformable_attn_pytorch(
value, spatial_shapes, sampling_locations, attention_weights
)