google / RB-Modulation

Official code for "RB-Modulation: Training-Free Personalization of Diffusion Models using Stochastic Optimal Control"
https://rb-modulation.github.io/
Apache License 2.0
336 stars 26 forks source link

GroundingDINO NameError: name '_C' is not defined #2

Closed SkylerZheng closed 2 months ago

SkylerZheng commented 2 months ago

Hi, when I was trying to run the jupyter notebook script, I met this issue, this happened in the composition stage. Wondering if you have seen this before. If so, could you share how you resolved the issue? Many thanks!

File /opt/conda/envs/rbm/lib/python3.9/site-packages/groundingdino/models/GroundingDINO/ms_deform_attn.py:53, in MultiScaleDeformableAttnFunction.forward(ctx, value, value_spatial_shapes, value_level_start_index, sampling_locations, attention_weights, im2col_step) 42 @staticmethod 43 def forward( 44 ctx, (...) 50 im2col_step, 51 ): 52 ctx.im2col_step = im2col_step ---> 53 output = _C.ms_deform_attn_forward( 54 value, 55 value_spatial_shapes, 56 value_level_start_index, 57 sampling_locations, 58 attention_weights, 59 ctx.im2col_step, 60 ) 61 ctx.save_for_backward( 62 value, 63 value_spatial_shapes, (...) 66 attention_weights, 67 ) 68 return output

NameError: name '_C' is not defined

LituRout commented 2 months ago

Yes, this is a standard issue in GroundingDINO. This happens if your $CUDA_HOME environment variable is not set properly. Please follow the steps here: https://github.com/IDEA-Research/GroundingDINO to resolve this issue.

SkylerZheng commented 2 months ago

Yes, this is a standard issue in GroundingDINO. This happens if your $CUDA_HOME environment variable is not set properly. Please follow the steps here: https://github.com/IDEA-Research/GroundingDINO to resolve this issue.

Hey, thank you so much for the quick reply! Many thanks!

SkylerZheng commented 2 months ago

I tried my best, I followed the instructions with the link, but I still see the same error. Do you have a docker file for this by any chance? I'm able to do inference with GroundingDINO locally, but cannot use lang_sam for composition purpose. lang_sam will re-install GroundingDINO and SAM, I removed them from the installation config, but still facing the same issue.

LituRout commented 2 months ago

Sorry, I do not have a docker for this. You can either disable lang_sam in the code or refer to the web demo we support on Hugging Face that contains a docker file (https://huggingface.co/spaces/fffiloni/RB-Modulation/tree/main).

SkylerZheng commented 2 months ago

Hey LituRout, thanks so much!

SkylerZheng commented 2 months ago

Hi LituRout, I was able to installed the environment successfully with the huggingface docker. But when I was trying to test the gradio demo, this happened, did you see this before?

image
LituRout commented 2 months ago

This error is due to data type mismatch. Check the dtype of your pipe and the inputs to the denoising network.