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

cd oneformer/modeling/pixel_decoder/ops sh make.sh #4

Closed
lucasjinreal opened this issue Nov 16, 2022 · 10 comments
Closed

cd oneformer/modeling/pixel_decoder/ops sh make.sh #4

lucasjinreal opened this issue Nov 16, 2022 · 10 comments
Labels
question Further information is requested

Comments

@lucasjinreal
Copy link

cd oneformer/modeling/pixel_decoder/ops
sh make.sh

got

/OneFormer/oneformer/modeling/pixel_decoder/ops/setup.py", line 52, in get_extensions
    raise NotImplementedError('CUDA_HOME is None. Please set environment variable CUDA_HOME.')
NotImplementedError: CUDA_HOME is None. Please set environment variable CUDA_HOME.

\how to run on CPU?

@praeclarumjj3 praeclarumjj3 added the question Further information is requested label Nov 16, 2022
@praeclarumjj3
Copy link
Member

Hi @jinfagang, thanks for your interest in our work. By default, we compile the code on a GPU machine. If you want to run on a CPU, you will need to make changes to two files:

  • oneformer/modeling/pixel_decoder/ops/functions/ms_deform_attn_func.py: find the changed file here

  • oneformer/modeling/pixel_decoder/ops/modules/ms_deform_attn.py: find the changed file here

After you change these two files, don't run sh make.sh as the CPU kernel uses pure PyTorch code. That should solve your issue.

@lucasjinreal
Copy link
Author

@praeclarumjj3 hello, why not just make it support out-ofbox? by simply judge on if torch.cuda.is_avaiable()?

@praeclarumjj3
Copy link
Member

Thanks for your suggestion. I plan on doing that in a future commit.

@praeclarumjj3
Copy link
Member

Hi @jinfagang, I have made the changes in the most recent commit. It should work for you now.

@lucasjinreal
Copy link
Author

@praeclarumjj3 hello, cpu got some error:

[11/16 12:55:08 detectron2]: ../../../images/COCO_val2014_000000001856.jpg: detected 1 instances in 15.87s
Traceback (most recent call last):
  File "/Ux/OneFormer/demo/demo.py", line 138, in <module>
    cv2.imshow(WINDOW_NAME, visualized_output.get_image()[:, :, ::-1])
AttributeError: 'dict' object has no attribute 'get_image'

@lucasjinreal
Copy link
Author

btw, 15s generated an image on CPU is quite slow..

@praeclarumjj3
Copy link
Member

Can you try saving the output instead by specifying the --output path?

@praeclarumjj3
Copy link
Member

praeclarumjj3 commented Nov 16, 2022

btw, 15s generated an image on CPU is quite slow..

You are free to optimize the method. 15s seems fair to me, considering it's a large model, and I assume you must be running for the panoptic task. If yes, that gives you all three predictions, so it's 5 seconds per output.

@praeclarumjj3
Copy link
Member

Feel free to re-open if you face any issues.

@hamedsteiner
Copy link

Hi @praeclarumjj3 , about the changes to ms_deform_attn file to run on the CPU, can you share the links? They are not available.

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

No branches or pull requests

3 participants