I don’t know what might be wrong there, I’d need more details to help. Were you able to solve it?
Our conda and pip packages are always updated at the same time, FYI.
And have you tried it? I just tried it again on the imdb notebook to no avail. I even removed the device IDs argument and it still does not work for me:
learn = language_model_learner(data_lm, pretrained_model=URLs.WT103, drop_mult=0.3)
learn.model = torch.nn.DataParallel(learn.model)
learn.lr_find()
then craps out…
~/anaconda3/envs/course1018/lib/python3.6/site-packages/fastai/callbacks/rnn.py in on_epoch_begin(self, **kwargs)
16
17 def on_epoch_begin(self, **kwargs):
—> 18 self.learn.model.reset()
19
20 def on_loss_begin(self, last_output:Tuple[Tensor,Tensor,Tensor], **kwargs):
~/anaconda3/envs/course1018/lib/python3.6/site-packages/torch/nn/modules/module.py in __getattr__(self, name)
516 return modules[name]
517 raise AttributeError("'{}' object has no attribute '{}'".format(
--> 518 type(self).__name__, name))
519
520 def __setattr__(self, name, value):
AttributeError: 'DataParallel' object has no attribute 'reset'
Sorry to hear what has happened in your country. Social media, fake news, and recommendation system really feel like a mass psychic controller to me; people with no sense of morality and malicious intent can now go low and get what they want. It is simply not enough to combat fake news with good news. I don’t know what we need to do, but it will be one of the biggest problems we need to face this century.
Hello, is there a forum to discuss the changes in the fastai library?
Have you found any solution for this? I am also having same issue.
Nope, waiting for a fix myself.
hello! did you find any solution to that issue?
Here’s an article that I found super helpful in my Vim journey.
I’m trying to follow the lesson4-collab notebook and having trouble getting the data downloaded properly. I downloaded the data from http://files.grouplens.org/datasets/movielens/ml-100k.zip to my local machine, then uploaded to my Gradient server using the upload button. I then did “unzip ‘http://files.grouplens.org/datasets/movielens/ml-100k.zip’” in the terminal. But when I run
ratings = pd.read_csv(path/‘u.data’, delimiter=’\t’, header=None,
names=[user,item,‘rating’,‘timestamp’])
I get an error
FileNotFoundError: File b’data/ml-100k/u.data’ does not exist
But I can definitely see a ‘u.data’ file in data/ml-100k.
I am having the same issue too. Were you successful in resolving it?
My notes about lesson 4. I hope people will find these useful.
not yet, I can’t find any solution till now. If you have any progress please share it.
same problem here
I am struggling to make the connection from collaborative filtering to a simple neural net model.
Can I get an explanation how each component of the collaborative filtering example translate to components in a neural network? Are the users or movie the training sample?
same issues.
On Gradient we have to put the data in the storage folder, then unzip, then use
path=Path(’/storage/ml-100k/’)
torch 1.0.0.dev20181120
fastai 1.0.28
data: dataframe with two columns (one text and other multi-labels)
Learner was able to train and but while validating it is throwing the error
Trying to do Text classification: I am getting this Error:
TypeError: list indices must be integers or slices, not NoneType
dc = TextDataBunch.from_df(path = path, train_df = train_df, valid_df = valid_df,
text_cols = ['title'], label_cols = ['labels'], label_delim = '|')
learn.fit_one_cycle(5, slice(0.01))
TypeError Traceback (most recent call last)
<ipython-input-37-9c1fbaf9d6de> in <module>()
----> 1 learn.fit_one_cycle(5, slice(0.01))
/opt/anaconda3/lib/python3.6/site-packages/fastai/train.py in fit_one_cycle(learn, cyc_len, max_lr, moms, div_factor, pct_start, wd, callbacks, **kwargs)
18 callbacks.append(OneCycleScheduler(learn, max_lr, moms=moms, div_factor=div_factor,
19 pct_start=pct_start, **kwargs))
---> 20 learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks)
21
22 def lr_find(learn:Learner, start_lr:Floats=1e-7, end_lr:Floats=10, num_it:int=100, stop_div:bool=True, **kwargs:Any):
/opt/anaconda3/lib/python3.6/site-packages/fastai/basic_train.py in fit(self, epochs, lr, wd, callbacks)
160 callbacks = [cb(self) for cb in self.callback_fns] + listify(callbacks)
161 fit(epochs, self.model, self.loss_func, opt=self.opt, data=self.data, metrics=self.metrics,
--> 162 callbacks=self.callbacks+callbacks)
163
164 def create_opt(self, lr:Floats, wd:Floats=0.)->None:
/opt/anaconda3/lib/python3.6/site-packages/fastai/basic_train.py in fit(epochs, model, loss_func, opt, data, callbacks, metrics)
92 except Exception as e:
93 exception = e
---> 94 raise e
95 finally: cb_handler.on_train_end(exception)
96
/opt/anaconda3/lib/python3.6/site-packages/fastai/basic_train.py in fit(epochs, model, loss_func, opt, data, callbacks, metrics)
87 if hasattr(data,'valid_dl') and data.valid_dl is not None:
88 val_loss = validate(model, data.valid_dl, loss_func=loss_func,
---> 89 cb_handler=cb_handler, pbar=pbar)
90 else: val_loss=None
91 if cb_handler.on_epoch_end(val_loss): break
/opt/anaconda3/lib/python3.6/site-packages/fastai/basic_train.py in validate(model, dl, loss_func, cb_handler, pbar, average, n_batch)
47 with torch.no_grad():
48 val_losses,nums = [],[]
---> 49 for xb,yb in progress_bar(dl, parent=pbar, leave=(pbar is not None)):
50 if cb_handler: xb, yb = cb_handler.on_batch_begin(xb, yb, train=False)
51 val_losses.append(loss_batch(model, xb, yb, loss_func, cb_handler=cb_handler))
/opt/anaconda3/lib/python3.6/site-packages/fastprogress/fastprogress.py in __iter__(self)
63 self.update(0)
64 try:
---> 65 for i,o in enumerate(self._gen):
66 yield o
67 if self.auto_update: self.update(i+1)
/opt/anaconda3/lib/python3.6/site-packages/fastai/basic_data.py in __iter__(self)
45 def __iter__(self):
46 "Process and returns items from `DataLoader`."
---> 47 for b in self.dl:
48 y = b[1][0] if is_listy(b[1]) else b[1]
49 if not self.skip_size1 or y.size(0) != 1: yield self.proc_batch(b)
/opt/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py in __next__(self)
612 def __next__(self):
613 if self.num_workers == 0: # same-process loading
--> 614 indices = next(self.sample_iter) # may raise StopIteration
615 batch = self.collate_fn([self.dataset[i] for i in indices])
616 if self.pin_memory:
/opt/anaconda3/lib/python3.6/site-packages/torch/utils/data/sampler.py in __iter__(self)
158 def __iter__(self):
159 batch = []
--> 160 for idx in self.sampler:
161 batch.append(idx)
162 if len(batch) == self.batch_size:
/opt/anaconda3/lib/python3.6/site-packages/fastai/text/data.py in __iter__(self)
59 def __len__(self) -> int: return len(self.data_source)
60 def __iter__(self):
---> 61 return iter(sorted(range_of(self.data_source), key=self.key, reverse=True))
62
63 class SortishSampler(Sampler):
/opt/anaconda3/lib/python3.6/site-packages/fastai/text/data.py in <lambda>(t)
244 dataloaders = [train_dl]
245 for ds in datasets[1:]:
--> 246 sampler = SortSampler(ds.x, key=lambda t: len(ds[t][0].data))
247 dataloaders.append(DataLoader(ds, batch_size=bs, sampler=sampler, **kwargs))
248 return cls(*dataloaders, path=path, collate_fn=collate_fn)
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in __getitem__(self, idxs)
413 def __getitem__(self,idxs:Union[int,np.ndarray])->'LabelList':
414 if isinstance(try_int(idxs), int):
--> 415 if self.item is None: x,y = self.x[idxs],self.y[idxs]
416 else: x,y = self.item ,0
417 if self.tfms:
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in __getitem__(self, idxs)
80
81 def __getitem__(self,idxs:int)->Any:
---> 82 if isinstance(try_int(idxs), int): return self.get(idxs)
83 else: return self.new(self.items[idxs], xtra=index_row(self.xtra, idxs))
84
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in get(self, i)
276 o = self.items[i]
277 if o is None: return None
--> 278 return self._item_cls(one_hot(o, self.c), [self.classes[p] for p in o], o)
279
280 def reconstruct(self, t):
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in <listcomp>(.0)
276 o = self.items[i]
277 if o is None: return None
--> 278 return self._item_cls(one_hot(o, self.c), [self.classes[p] for p in o], o)
279
280 def reconstruct(self, t):
TypeError: list indices must be integers or slices, not NoneType
From the stack trace it looks like it’s taken None
as a label. Does every row of your validation set have a value for labels
?
I’d first try with just the head of the data frames (checking the validation set before you pass them in).
If that works then I’d try either searching through the labels
or bisecting the validation dataset to find the issue.