Hi all, I am a beginner for deeplearning and this forum. I followed Installation-on-windows/ and successfully loaded jupyter notebook and fastAI. torch.cuda.is_available()
also returns True. However, when I followed lesson 1 (dogs-and-cats) and run learn = ConvLearner.pretrained(arch, data, precompute=True)
, error popped up as following:
TypeError Traceback (most recent call last)
in
1 arch=resnet34
2 data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
----> 3 learn = ConvLearner.pretrained(arch, data, precompute=True)
4 learn.fit(0.01, 2)
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\conv_learner.py in pretrained(cls, f, data, ps, xtra_fc, xtra_cut, custom_head, precompute, pretrained, **kwargs)
112 models = ConvnetBuilder(f, data.c, data.is_multi, data.is_reg,
113 ps=ps, xtra_fc=xtra_fc, xtra_cut=xtra_cut, custom_head=custom_head, pretrained=pretrained)
→ 114 return cls(data, models, precompute, **kwargs)
115
116 @classmethod
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\conv_learner.py in init(self, data, models, precompute, **kwargs)
98 if hasattr(data, ‘is_multi’) and not data.is_reg and self.metrics is None:
99 self.metrics = [accuracy_thresh(0.5)] if self.data.is_multi else [accuracy]
→ 100 if precompute: self.save_fc1()
101 self.freeze()
102 self.precompute = precompute
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\conv_learner.py in save_fc1(self)
177 m=self.models.top_model
178 if len(self.activations[0])!=len(self.data.trn_ds):
→ 179 predict_to_bcolz(m, self.data.fix_dl, act)
180 if len(self.activations[1])!=len(self.data.val_ds):
181 predict_to_bcolz(m, self.data.val_dl, val_act)
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\model.py in predict_to_bcolz(m, gen, arr, workers)
16 m.eval()
17 for x,*_ in tqdm(gen):
—> 18 y = to_np(m(VV(x)).data)
19 with lock:
20 arr.append(y)
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\core.py in VV(x)
67 def VV(x):
68 ‘’‘creates a single or a list of pytorch tensors, depending on input x. ‘’’
—> 69 return map_over(x, VV_)
70
71 def to_np(v):
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\core.py in map_over(x, f)
6 def is_listy(x): return isinstance(x, (list,tuple))
7 def is_iter(x): return isinstance(x, collections.Iterable)
----> 8 def map_over(x, f): return [f(o) for o in x] if is_listy(x) else f(x)
9 def map_none(x, f): return None if x is None else f(x)
10 def delistify(x): return x[0] if is_listy(x) else x
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\core.py in VV_(x)
63 def VV_(x):
64 ‘’‘creates a volatile tensor, which does not require gradients. ‘’’
—> 65 return create_variable(x, True)
66
67 def VV(x):
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\core.py in create_variable(x, volatile, requires_grad)
51 if type (x) != Variable:
52 if IS_TORCH_04: x = Variable(T(x), requires_grad=requires_grad)
—> 53 else: x = Variable(T(x), requires_grad=requires_grad, volatile=volatile)
54 return x
55
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\core.py in T(a, half, cuda)
39 a = to_half(a) if half else torch.FloatTensor(a)
40 else: raise NotImplementedError(a.dtype)
—> 41 if cuda: a = to_gpu(a, non_blocking=True)
42 return a
43
F:\deeplearning\fastAI\fastai\courses\dl1\fastai\core.py in to_gpu(x, *args, **kwargs)
88 def to_gpu(x, *args, **kwargs):
89 ‘’‘puts pytorch variable to gpu, if cuda is available and USE_GPU is set to true. ‘’’
—> 90 return x.cuda(*args, **kwargs) if USE_GPU else x
91
92 def noop(*args, **kwargs): return
TypeError: _cuda() got an unexpected keyword argument ‘non_blocking’
It seems related to the gpu function. I did some search but didn’t have a clue. Thanks in advance.