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

Running the code with GPU #16

Open
DaneshShokri94 opened this issue Jun 21, 2024 · 6 comments
Open

Running the code with GPU #16

DaneshShokri94 opened this issue Jun 21, 2024 · 6 comments

Comments

@DaneshShokri94
Copy link

Dear

First of all, I appreciate your work, that's awsome

I am running masa on the anaconda - windows. The code use almost all 32G RAM of my computer. it took around 45 minutes for analysing a 90 second video.

I would like to use 8g GPU of my computer for accelerating the computation time

Could you please help me how can I do this?

Sincerely

@siyuanliii
Copy link
Owner

Thanks for your question! If you run the default GoundingDINO model with a SwinB backbone on a CPU, it can be very inefficient. Our code, by default, supports inference with GPU. Make sure you have the GPU correctly installed and select the corresponding inference device.

@DaneshShokri94
Copy link
Author

Dear Siyuanliii

Thanks for your respone. Actually, I tried my best to run the code under GPU, but it is not working unforetunatelly. All of needed steps to install GPU on my Anaconda (Windows version) have been done correctly.

Sincerely

@siyuanliii
Copy link
Owner

I need more information to help you with this question. Have you installed the correct torch version for GPU? Have you done the check, for example, whether your GPU is available by torch.cuda.is_available()

@DaneshShokri94
Copy link
Author

Dear @siyuanliii

Thank you for your response, After running this code "torch.cuda.is_available()", I get True. Also by running this code "torch.cuda.get_device_name()", I get the name of my gpu "NVIDIA RTX A2000 8GB Laptop GPU"

When I run the following code from your code "python demo/video_demo_with_text.py demo/driving_10s.mp4 --out demo_outputs/driving_10s_outputs.mp4 --det_config projects/CO-DETR/configs/codino/co_dino_5scale_r50_lsj_8xb2_3x_coco.py --det_checkpoint saved_models/pretrain_weights/co_dino_5scale_lsj_r50_3x_coco-fe5a6829.pth --masa_config configs/masa-one/masa_r50_plug_and_play.py --masa_checkpoint saved_models/masa_models/masa_r50.pth --score-thr 0.3 --show_fps"

The code is run like the below image on my Anaconda (Windows version). some warnings are appears. maybe this wrning are the cause of this gpu issue.

Screenshot 2024-06-29 170152

@RecardoLyu
Copy link

Hi @DaneshShokri94
I'm trying ro run the demo, too. But I'm facing anothor issue, that is, some packages used in the code (import resource) is only effective in linux environment. It seems you could run the demo, have you encountered this problem? If yes, how did you solve the problem?
Sincerely

Dear @siyuanliii

Thank you for your response, After running this code "torch.cuda.is_available()", I get True. Also by running this code "torch.cuda.get_device_name()", I get the name of my gpu "NVIDIA RTX A2000 8GB Laptop GPU"

When I run the following code from your code "python demo/video_demo_with_text.py demo/driving_10s.mp4 --out demo_outputs/driving_10s_outputs.mp4 --det_config projects/CO-DETR/configs/codino/co_dino_5scale_r50_lsj_8xb2_3x_coco.py --det_checkpoint saved_models/pretrain_weights/co_dino_5scale_lsj_r50_3x_coco-fe5a6829.pth --masa_config configs/masa-one/masa_r50_plug_and_play.py --masa_checkpoint saved_models/masa_models/masa_r50.pth --score-thr 0.3 --show_fps"

The code is run like the below image on my Anaconda (Windows version). some warnings are appears. maybe this wrning are the cause of this gpu issue.

Screenshot 2024-06-29 170152

@DaneshShokri94
Copy link
Author

Dear @RecardoLyu

Simply you can solve this problem.

Firstly open the code of "video_demo_with_text.py" at the folder of "demo".

Next, delete or comment the lines code of 8, 37,38,39,40,41,42 (actually this is a function).

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

3 participants