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: Torch not compiled with CUDA enabled #6

Closed
geledek opened this issue Sep 21, 2017 · 2 comments
Closed

AssertionError: Torch not compiled with CUDA enabled #6

geledek opened this issue Sep 21, 2017 · 2 comments

Comments

@geledek
Copy link

geledek commented Sep 21, 2017

I was testing ./courses/dl1/lesson1.ipynb on macOS 10.12.6, Python 3.6, torch 0.2.0

while running learn = ConvLearner.pretrained(resnet34, data, precompute=True)

AssertionError Traceback (most recent call last)
in ()
1 data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(resnet34, 299))
----> 2 learn = ConvLearner.pretrained(resnet34, data, precompute=True)
3 # learn.fit(0.01, 2)
/Users/user/fastai/courses/dl1/fastai/conv_learner.py in pretrained(self, f, data, ps, xtra_fc, xtra_cut, **kwargs)
87 @classmethod
88 def pretrained(self, f, data, ps=None, xtra_fc=None, xtra_cut=0, **kwargs):
---> 89 models = ConvnetBuilder(f, data.c, data.is_multi, data.is_reg, ps=ps, xtra_fc=xtra_fc, xtra_cut=xtra_cut)
90 return self(data, models, **kwargs)
91
/Users/user/fastai/courses/dl1/fastai/conv_learner.py in init(self, f, c, is_multi, is_reg, ps, xtra_fc, xtra_cut)
40 fc_layers = self.get_fc_layers()
41 self.n_fc = len(fc_layers)
---> 42 self.fc_model = nn.Sequential(fc_layers).cuda()
43 apply_init(self.fc_model, kaiming_normal)
44 self.model=nn.Sequential(
(layers+fc_layers)).cuda()
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/nn/modules/module.py in cuda(self, device_id)
145 copied to that device
146 """
--> 147 return self._apply(lambda t: t.cuda(device_id))
148
149 def cpu(self):
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/nn/modules/module.py in _apply(self, fn)
116 def _apply(self, fn):
117 for module in self.children():
--> 118 module._apply(fn)
119
120 for param in self._parameters.values():
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/nn/modules/module.py in _apply(self, fn)
122 # Variables stored in modules are graph leaves, and we don't
123 # want to create copy nodes, so we have to unpack the data.
--> 124 param.data = fn(param.data)
125 if param._grad is not None:
126 param._grad.data = fn(param._grad.data)
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/nn/modules/module.py in (t)
145 copied to that device
146 """
--> 147 return self._apply(lambda t: t.cuda(device_id))
148
149 def cpu(self):
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/_utils.py in cuda(self, device, async)
64 else:
65 new_type = getattr(torch.cuda, self.class.name)
---> 66 return new_type(self.size()).copy
(self, async)
67
68
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/cuda/init.py in _lazy_new(cls, *args, **kwargs)
264 @staticmethod
265 def _lazy_new(cls, *args, **kwargs):
--> 266 _lazy_init()
267 # We need this method only for lazy init, so we can remove it
268 del _CudaBase.new
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/cuda/init.py in _lazy_init()
82 raise RuntimeError(
83 "Cannot re-initialize CUDA in forked subprocess. " + msg)
---> 84 _check_driver()
85 torch._C._cuda_init()
86 torch._C._cuda_sparse_init()
/Users/user/anaconda2/envs/py3/lib/python3.6/site-packages/torch/cuda/init.py in _check_driver()
49 def _check_driver():
50 if not hasattr(torch._C, '_cuda_isDriverSufficient'):
---> 51 raise AssertionError("Torch not compiled with CUDA enabled")
52 if not torch._C._cuda_isDriverSufficient():
53 if torch._C._cuda_getDriverVersion() == 0:
AssertionError: Torch not compiled with CUDA enabled

@tensorcopy
Copy link

Did you install pytorch with cuda?

@trusty
Copy link

trusty commented Nov 4, 2017

@sampathweb you changes which were merged yesterday fixes this?

@jph00 jph00 closed this as completed Nov 11, 2017
jph00 pushed a commit that referenced this issue May 13, 2018
stas00 added a commit that referenced this issue Nov 27, 2018
koyo922 pushed a commit to koyo922/fastai that referenced this issue Nov 7, 2019
Undefined name: searching_all_files() --> cls.searching_all_files()
yao-eastside pushed a commit to yao-eastside/fastai-intro-ml-2020 that referenced this issue Dec 30, 2019
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

4 participants