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

Could you make the code non-CUDA compliant? #4

Closed
Horace89 opened this issue Jan 14, 2019 · 7 comments
Closed

Could you make the code non-CUDA compliant? #4

Horace89 opened this issue Jan 14, 2019 · 7 comments

Comments

@Horace89
Copy link

Hi. It seems that the code is only working with a GPU. I get an error when I try to lauch the demo:

 1  $  python demo.py
Traceback (most recent call last):
File "demo.py", line 14, in
MORAN = MORAN(1, len(alphabet.split(':')), 256, 32, 100, BidirDecoder=True)
File "/Users/sebastienvincent/serjee/scene_text/MORAN_v2/models/moran.py", line 11, in init
self.MORN = MORN(nc, targetH, targetW, inputDataType, maxBatch)
File "/Users/sebastienvincent/serjee/scene_text/MORAN_v2/models/morn.py", line 37, in init
grid = torch.from_numpy(grid).type(self.inputDataType).cuda()
File "/Users/sebastienvincent/.virtualenvs/moran/lib/python2.7/site-packages/torch/_utils.py", line 38, in type
return new_type(self.size()).copy
(self, async)
File "/Users/sebastienvincent/.virtualenvs/moran/lib/python2.7/site-packages/torch/cuda/init.py", line 384, in _lazy_new
_lazy_init()
File "/Users/sebastienvincent/.virtualenvs/moran/lib/python2.7/site-packages/torch/cuda/init.py", line 141, in _lazy_init
_check_driver()
File "/Users/sebastienvincent/.virtualenvs/moran/lib/python2.7/site-packages/torch/cuda/init.py", line 55, in _check_driver
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Indeed, the file L37 of MORAN_v2/models/morn.py mentions
grid = torch.from_numpy(grid).type(self.inputDataType).cuda()
which works only if you have a CUDA system with a GPU.

@Canjie-Luo
Copy link
Owner

Sorry, I don't have a non-CUDA device. Please delete all the .cuda(). That should work.

@Horace89
Copy link
Author

Ok I'll try that. Thank you.

@Horace89
Copy link
Author

Unfortunately it does not seem to work. I get the same "AssertionError: Torch not compiled with CUDA enabled". Too bad...

@Canjie-Luo
Copy link
Owner

Sorry, I am too busy now. I'll help you later.

@happog
Copy link

happog commented Jan 17, 2019

I have adjusted the code to support cpu inferece, you can ref to:
https://github.com/happog/object_rect_attention.git

@Canjie-Luo
Copy link
Owner

My teammate found an non-GPU device and developed an non-CUDA demo for you. https://github.com/Canjie-Luo/MORAN_v2/tree/demo_cpu

@Horace89
Copy link
Author

Thank you both @Canjie-Luo and @happog! I managed to get MORAN_v2/tree/demo_cpu working. You've been really helpful.

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