I know this isn’t covered in the course just yet, but I’m trying to use fastai for a project of mine, but I’m running into some issues.
I have followed the steps to create a databunch
tfms = [Categorify]
data = TabularDataBunch.from_df(path, train_df, valid_df, dep_var = 'Price', tfms=tfms, cat_names=cat_vars, bs = 32)
learn = get_tabular_learner(data, layers = [1000,500], emb_szs = {'Date':50, 'Month':6, 'Month_Year':34},
metrics = [exp_rmspe], ps = [0.0, 0.0])
But when I try to create the learn object I get
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-276-58cac02224e8> in <module>()
1 learn = get_tabular_learner(data, layers = [1000,500], emb_szs = {'Date':50, 'Month':6, 'Month_Year':34},
----> 2 metrics = [exp_rmspe], ps = [0.0, 0.0])
3
4 # learn = get_tabular_learner(data, layers = [1000,500])
/usr/local/lib/python3.6/dist-packages/fastai/tabular/data.py in get_tabular_learner(data, layers, emb_szs, metrics, ps, emb_drop, y_range, use_bn, **kwargs)
95 emb_szs = data.get_emb_szs(ifnone(emb_szs, {}))
96 model = TabularModel(emb_szs, len(data.cont_names), out_sz=data.c, layers=layers, ps=ps, emb_drop=emb_drop,
---> 97 y_range=y_range, use_bn=use_bn)
98 return Learner(data, model, metrics=metrics, **kwargs)
99
/usr/local/lib/python3.6/dist-packages/fastai/tabular/models.py in __init__(self, emb_szs, n_cont, out_sz, layers, ps, emb_drop, y_range, use_bn)
20 layers = []
21 for i,(n_in,n_out,dp,act) in enumerate(zip(sizes[:-1],sizes[1:],[0.]+ps,actns)):
---> 22 layers += bn_drop_lin(n_in, n_out, bn=use_bn and i!=0, p=dp, actn=act)
23 self.layers = nn.Sequential(*layers)
24
/usr/local/lib/python3.6/dist-packages/fastai/layers.py in bn_drop_lin(n_in, n_out, bn, p, actn)
31 layers = [nn.BatchNorm1d(n_in)] if bn else []
32 if p != 0: layers.append(nn.Dropout(p))
---> 33 layers.append(nn.Linear(n_in, n_out))
34 if actn is not None: layers.append(actn)
35 return layers
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/linear.py in __init__(self, in_features, out_features, bias)
46 self.in_features = in_features
47 self.out_features = out_features
---> 48 self.weight = Parameter(torch.Tensor(out_features, in_features))
49 if bias:
50 self.bias = Parameter(torch.Tensor(out_features))
TypeError: new() received an invalid combination of arguments - got (NoneType, int), but expected one of:
* (torch.device device)
* (torch.Storage storage)
* (Tensor other)
* (tuple of ints size, torch.device device)
didn't match because some of the arguments have invalid types: (!NoneType!, !int!)
* (object data, torch.device device)
didn't match because some of the arguments have invalid types: (!NoneType!, !int!)
Am I doing anything wrong, or should I revert back to the v0.7 for the time being?