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

grounding_dino_model.predict_with_classes 'NameError: name '_C' is not defined' #450

Open
Greg7000 opened this issue Feb 13, 2024 · 4 comments

Comments

@Greg7000
Copy link

Greg7000 commented Feb 13, 2024

I am currently trying the following note book from colab (https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/automated-dataset-annotation-and-evaluation-with-grounding-dino-and-sam.ipynb#scrollTo=LoD2bIptG-qO) but in local (linux container).

I can do all the steps until :
# detect objects detections = grounding_dino_model.predict_with_classes( image=image, classes=enhance_class_name(class_names=CLASSES), box_threshold=BOX_TRESHOLD, text_threshold=TEXT_TRESHOLD )

However I get 'NameError: name '_C' is not defined', I do have cython in my environement.

Please note that my 'torch.cuda.is_available()' does return true.

Did anyone face that issue with grounding_dino_model.predict_with_classe?

@rentainhe
Copy link
Collaborator

hello, maybe you should try to set CUDA Runtime before compiling the environment, could you check the env param CUDA_HOME and if it is None, you should set it to the CUDA Runtime

@JohanHuynh0130
Copy link

thanks for the quick response. I really appreciate ;) I fixed this by having to cd to Grounding Dino and build it again and afterwards it works :)

@Greg7000
Copy link
Author

Greg7000 commented Feb 16, 2024

hello, maybe you should try to set CUDA Runtime before compiling the environment, could you check the env param CUDA_HOME and if it is None, you should set it to the CUDA Runtime

Already done (maybe should double check again...). If I manage to find the time I will retest the build and keep you posted. I think I builded with CUDA_HOME but maybe I did not have cython when I first build.

@bowen-upenn
Copy link

I have encountered this issue while using Docker, but not otherwise. However, I have managed to fix it on my end.

When the script is trying to run Grounded-Segment-Anything/GroundingDINO/setup.py to compile the custom C++ operations, there was an error:

[Errno 2] No such file or directory: '/usr/local/cuda/bin/nvcc'

so I checked ls /usr/local/ in my Docker container and found there was no cuda directory at all

bin etc games include lib man sbin share src

even though running the same command outside the container showed additional directories, including

bin cuda cuda-12 cuda-12.2 cuda-9.0 dcgm etc games include lib man sbin share src

Solution: add the line -v /usr/local/cuda-12.2:/usr/local/cuda:ro \ to the run command in Makefile, as shown below

docker run --gpus all -it --rm --net=host --privileged \
	-v /tmp/.X11-unix:/tmp/.X11-unix \
	-v "${PWD}":/home/appuser/working_dir \
        -v /usr/local/cuda-12.2:/usr/local/cuda:ro \
	-e DISPLAY=$DISPLAY \
	--name=gsa \
	--ipc=host -it gsa:v0

and don't forget to set your ENV CUDA_HOME /usr/local/cuda/ correctly in Dockerfile.

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

4 participants