Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiScaleDeformableAttention complied but ImportError undefined symbol: THPVariableClass #237

Open
RiceZ opened this issue Nov 27, 2023 · 1 comment

Comments

@RiceZ
Copy link

RiceZ commented Nov 27, 2023

MultiScaleDeformableAttention compiled success:

Installed /home/xxx/anaconda3/envs/env_DINO2/lib/python3.8/site-packages/MultiScaleDeformableAttention-1.0-py3.8-linux-x86_64.egg
Processing dependencies for MultiScaleDeformableAttention==1.0
Finished processing dependencies for MultiScaleDeformableAttention==1.0

when run:
ImportError: /home/zhangchi/anaconda3/envs/env_DINO2/lib/python3.8/site-packages/MultiScaleDeformableAttention-1.0-py3.8-linux-x86_64.egg/MultiScaleDeformableAttention.cpython-38-x86_64-linux-gnu.so: undefined symbol: THPVariableClass

thank you~

@RiceZ
Copy link
Author

RiceZ commented Nov 27, 2023

I got it!

DINO-main\models\dino\ops\modules\ms_deform_attn.py

I comment these codes next before complie MultiScaleDeformableAttention:

    # for amp
    if value.dtype == torch.float16:
        # for mixed precision
        output = MSDeformAttnFunction.apply(
        value.to(torch.float32), input_spatial_shapes, input_level_start_index, sampling_locations.to(torch.float32), attention_weights, self.im2col_step)
        output = output.to(torch.float16)
        output = self.output_proj(output)
        return output

It works, but I donot know why...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant