@oguiza, I think with some changes somethings are not working with TSAI any more. You can check the 04_Intro_to_Time_Series_Regression notebook. dls.show_batch() gives below error…
tsai : 0.2.14
fastai : 2.2.5
fastcore : 1.3.20
torch : 1.7.1
IndexError Traceback (most recent call last)
in
----> 1 dls.show_batch()
d:\conda3\lib\site-packages\tsai\data\core.py in show_batch(self, b, ctxs, max_n, nrows, ncols, figsize, unique, sharex, sharey, **kwargs)
395 sharex, sharey = True, True
396 elif b is None: b = self.one_batch()
–> 397 db = self.decode_batch(b, max_n=max_n)
398 ncols = min(ncols, math.ceil(len(db) / ncols))
399 nrows = min(nrows, math.ceil(len(db) / ncols))
d:\codes\fastai_dev\fastai\fastai\data\core.py in decode_batch(self, b, max_n, full)
78
79 def decode(self, b): return to_cpu(self.after_batch.decode(self._retain_dl(b)))
—> 80 def decode_batch(self, b, max_n=9, full=True): return self._decode_batch(self.decode(b), max_n, full)
81
82 def _decode_batch(self, b, max_n=9, full=True):
d:\codes\fastai_dev\fastai\fastai\data\core.py in decode(self, b)
77 if isinstance(f,Pipeline): f.split_idx=split_idx
78
—> 79 def decode(self, b): return to_cpu(self.after_batch.decode(self._retain_dl(b)))
80 def decode_batch(self, b, max_n=9, full=True): return self._decode_batch(self.decode(b), max_n, full)
81
d:\codes\fastai_dev\fastai\fastai\data\core.py in _retain_dl(self, b)
56
57 def _retain_dl(self,b):
—> 58 if not getattr(self, ‘_types’, None): self._one_pass()
59 return retain_types(b, typs=self._types)
60
d:\codes\fastai_dev\fastai\fastai\data\core.py in _one_pass(self)
49
50 def _one_pass(self):
—> 51 b = self.do_batch([self.do_item(None)])
52 if self.device is not None: b = to_device(b, self.device)
53 its = self.after_batch(b)
d:\codes\fastai_dev\fastai\fastai\data\load.py in do_batch(self, b)
142 else: raise IndexError(“Cannot index an iterable dataset numerically - must use None
.”)
143 def create_batch(self, b): return (fa_collate,fa_convert)self.prebatched
–> 144 def do_batch(self, b): return self.retain(self.create_batch(self.before_batch(b)), b)
145 def to(self, device): self.device = device
146 def one_batch(self):
d:\conda3\lib\site-packages\tsai\data\core.py in create_batch(self, b)
358 self.idxs = L(b)
359 if hasattr(self, “split_idxs”): self.input_idxs = self.split_idxs[it]
–> 360 return self.dataset[it]
361
362 def create_item(self, s): return s
d:\conda3\lib\site-packages\tsai\data\core.py in getitem(self, it)
273
274 def getitem(self, it):
–> 275 return tuple([typ(ptl[it])[…,self.sel_vars, self.sel_steps] if i==0 else typ(ptl[it]) for i,(ptl,typ) in enumerate(zip(self.ptls,self.types))])
276
277 def subset(self, i): return type(self)(tls=L(tl.subset(i) for tl in self.tls), n_inp=self.n_inp, inplace=self.inplace, tfms=self.tfms,
d:\conda3\lib\site-packages\tsai\data\core.py in (.0)
273
274 def getitem(self, it):
–> 275 return tuple([typ(ptl[it])[…,self.sel_vars, self.sel_steps] if i==0 else typ(ptl[it]) for i,(ptl,typ) in enumerate(zip(self.ptls,self.types))])
276
277 def subset(self, i): return type(self)(tls=L(tl.subset(i) for tl in self.tls), n_inp=self.n_inp, inplace=self.inplace, tfms=self.tfms,
d:\conda3\lib\site-packages\tsai\data\core.py in new(cls, o, **kwargs)
22
23 def new(cls, o, **kwargs):
—> 24 if isinstance(o, (list, L)): o = stack(o)
25 res = cast(tensor(o), cls)
26 for k,v in kwargs.items(): setattr(res, k, v)
d:\conda3\lib\site-packages\tsai\utils.py in stack(o, axis, retain)
262 # Cell
263 def stack(o, axis=0, retain=True):
–> 264 if isinstance(o[0], torch.Tensor):
265 return retain_type(torch.stack(tuple(o), dim=axis), o[0]) if retain else torch.stack(tuple(o), dim=axis)
266 else:
d:\codes\fastai_dev\fastcore\fastcore\foundation.py in getitem(self, idx)
109 def _xtra(self): return None
110 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
–> 111 def getitem(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
112 def copy(self): return self._new(self.items.copy())
113
d:\codes\fastai_dev\fastcore\fastcore\foundation.py in _get(self, i)
113
114 def _get(self, i):
–> 115 if is_indexer(i) or isinstance(i,slice): return getattr(self.items,‘iloc’,self.items)[i]
116 i = mask2idxs(i)
117 return (self.items.iloc[list(i)] if hasattr(self.items,‘iloc’)
IndexError: list index out of range