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

Is possible to run ModelZoo models without GPU? #987

Open
jrobador opened this issue May 25, 2022 · 1 comment
Open

Is possible to run ModelZoo models without GPU? #987

jrobador opened this issue May 25, 2022 · 1 comment

Comments

@jrobador
Copy link

Hi everyone, I followed the correct steps to run the demo.
However, I got the following error:
python demo.py multi_pose --demo 3.mp4 --load_model ../models/multi_pose_dla_3x.pth

Fix size testing.
training chunk_sizes: [32]
The output will be saved to /home/jrobador/CIII/CenterNet/CenterNet/src/lib/../../exp/multi_pose/default
heads {'hm': 1, 'wh': 2, 'hps': 34, 'reg': 2, 'hm_hp': 17, 'hp_offset': 2}
Creating model...
loaded ../models/multi_pose_dla_3x.pth, epoch 320
Traceback (most recent call last):
File "demo.py", line 56, in
demo(opt)
File "demo.py", line 21, in demo
detector = Detector(opt)
File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/multi_pose.py", line 26, in init
super(MultiPoseDetector, self).init(opt)
File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/base_detector.py", line 26, in init
self.model = self.model.to(opt.device)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 386, in to
return self._apply(convert)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 193, in _apply
module._apply(fn)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 193, in _apply
module._apply(fn)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 193, in _apply
module._apply(fn)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 199, in _apply
param.data = fn(param.data)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 384, in convert
return t.to(device, dtype if t.is_floating_point() else None, non_blocking)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/cuda/init.py", line 162, in _lazy_init
_check_driver()
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/cuda/init.py", line 75, in _check_driver
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

I also tried using a tutorial that i founded on internet, (https://programmerclick.com/article/43101758055/) and i got the following error:
python demo.py multi_pose --demo 3.mp4 --load_model multi_pose_dla_3x.pth
Fix size testing.
training chunk_sizes: [32]
The output will be saved to /home/jrobador/CIII/CenterNet/CenterNet/src/lib/../../exp/multi_pose/default
heads {'hm': 1, 'wh': 2, 'hps': 34, 'reg': 2, 'hm_hp': 17, 'hp_offset': 2}
Creating model...
Downloading: "http://dl.yf.io/dla/models/imagenet/dla34-ba72cf86.pth" to /home/jrobador/.cache/torch/checkpoints/dla34-ba72cf86.pth
100.0%
Traceback (most recent call last):
File "demo.py", line 56, in
demo(opt)
File "demo.py", line 21, in demo
detector = Detector(opt)
File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/multi_pose.py", line 26, in init
super(MultiPoseDetector, self).init(opt)
File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/base_detector.py", line 25, in init
self.model = load_model(self.model, opt.load_model)
File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/models/model.py", line 34, in load_model
checkpoint = torch.load(model_path, map_location=lambda storage, loc: storage)
File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/serialization.py", line 382, in load
f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'multi_pose_dla_3x.pth'

@BinhPQ2
Copy link

BinhPQ2 commented Sep 13, 2022

You have to go to the 'CenterNet/src/lib/detectors/base_detector.py' file and replace if opt.gpus[0] >= 0: opt.device = torch.device('cuda') else: opt.device = torch.device('cpu') with opt.device = torch.device('cpu') only. Also delete (or uncomment) any line that is torch.cuda.synchronize() in 'CenterNet/src/lib/detectors/base_detector.py', 'CenterNet/src/lib/detectors/ctdet.py', 'CenterNet/src/lib/detectors/exdet.py', 'CenterNet/src/lib/detectors/ddd.py', 'CenterNet/src/lib/detectors/multi_pose.py'

I might be missing something but basically just delete any line which contain .cuda

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

2 participants