mattmacy / vnet.pytorch

A PyTorch implementation for V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation
https://mattmacy.github.io/vnet.pytorch
BSD 3-Clause "New" or "Revised" License
693 stars 200 forks source link

no gpu run #4

Closed AIAdventures closed 7 years ago

AIAdventures commented 7 years ago

hi , I was wondering if the code can be run without a gpu?

build vnet Traceback (most recent call last): File "train.py", line 384, in main() File "train.py", line 145, in main model = nn.parallel.DataParallel(model, device_ids=gpu_ids) File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/nn/parallel/data_parallel.py", line 58, in init self.module.cuda(device_ids[0]) File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 143, in cuda return self._apply(lambda t: t.cuda(device_id)) File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 114, in _apply module._apply(fn) File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 114, in _apply module._apply(fn) File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 120, in _apply param.data = fn(param.data) File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 143, in return self._apply(lambda t: t.cuda(device_id)) File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/_utils.py", line 56, in _cuda with torch.cuda.device(device): File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/cuda/init.py", line 136, in enter _lazy_init() File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/cuda/init.py", line 96, in _lazy_init _check_driver() File "/home/andrewcz/miniconda3/lib/python3.5/site-packages/torch/cuda/init.py", line 70, in _check_driver http://www.nvidia.com/Download/index.aspx""") AssertionError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver

Can it just be used with cpu. Many thanks, Best, Andrew

mattmacy commented 7 years ago

Yes, it can (albeit slowly). Make sure cuda() doesn't get called and if that doesn't fix it then remove the call to DataParallel.

AIAdventures commented 7 years ago

Ah excellent! Where in the code do I take that out? Many thanks, Best, Andrew

mattmacy commented 7 years ago

Grep for references to cuda() in train.py - change the code to make sure that path is not run.