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

AssertionError: Invalid device id #47

Open
Adesoji1 opened this issue Jan 19, 2022 · 2 comments
Open

AssertionError: Invalid device id #47

Adesoji1 opened this issue Jan 19, 2022 · 2 comments

Comments

@Adesoji1
Copy link

Traceback (most recent call last):
File "/home/adesoji/MLOPS/MegaDepth/demo.py", line 18, in
model = create_model(opt)
File "/home/adesoji/MLOPS/MegaDepth/models/models.py", line 5, in create_model
model = HGModel(opt)
File "/home/adesoji/MLOPS/MegaDepth/models/HG_model.py", line 18, in init
model= torch.nn.parallel.DataParallel(model, device_ids = [0,1])
File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 142, in init
_check_balance(self.device_ids)
File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 23, in _check_balance
dev_props = _get_devices_properties(device_ids)
File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 455, in _get_devices_properties
return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 455, in
return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 438, in _get_device_attr
return get_member(torch.cuda)
File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 455, in
return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids]
File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/cuda/init.py", line 312, in get_device_properties
raise AssertionError("Invalid device id")
AssertionError: Invalid device id

@huacong
Copy link

huacong commented Apr 5, 2022

Traceback (most recent call last): File "/home/adesoji/MLOPS/MegaDepth/demo.py", line 18, in model = create_model(opt) File "/home/adesoji/MLOPS/MegaDepth/models/models.py", line 5, in create_model model = HGModel(opt) File "/home/adesoji/MLOPS/MegaDepth/models/HG_model.py", line 18, in init model= torch.nn.parallel.DataParallel(model, device_ids = [0,1]) File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 142, in init _check_balance(self.device_ids) File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 23, in _check_balance dev_props = _get_devices_properties(device_ids) File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 455, in _get_devices_properties return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids] File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 455, in return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids] File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 438, in _get_device_attr return get_member(torch.cuda) File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/_utils.py", line 455, in return [_get_device_attr(lambda m: m.get_device_properties(i)) for i in device_ids] File "/home/adesoji/Videos/ENTER/lib/python3.8/site-packages/torch/cuda/init.py", line 312, in get_device_properties raise AssertionError("Invalid device id") AssertionError: Invalid device id

It seems your cuda issue.

@eb-art
Copy link

eb-art commented May 27, 2022

You have to change line 18 in HG_model.py up to you, for eg. device_ids = [0]

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