Error in Snake jupiter notebook

sample_data = get_data(128, (2048//128))
sample_data.show_batch(3, 3)

got an error:

IndexError Traceback (most recent call last)

/usr/local/lib/python3.6/dist-packages/fastai/data_block.py in get_label_cls(self, labels, label_cls, label_delim, **kwargs)
264 if label_delim is not None: return MultiCategoryList
–> 265 try: it = index_row(labels,0)
266 except: raise Exception("""Can’t infer the type of your targets.

7 frames

IndexError: index 0 is out of bounds for axis 0 with size 0

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last)

/usr/local/lib/python3.6/dist-packages/fastai/data_block.py in get_label_cls(self, labels, label_cls, label_delim, **kwargs)
265 try: it = index_row(labels,0)
266 except: raise Exception(""“Can’t infer the type of your targets.
–> 267 It’s either because your data source is empty or because your labelling function raised an error.”"")
268 if isinstance(it, (float, np.float32)): return FloatList
269 if isinstance(try_int(it), (str, Integral)): return CategoryList

Exception: Can’t infer the type of your targets.
It’s either because your data source is empty or because your labelling function raised an error.

regards,
Sh

Hi I got the same error as you! But I managed to resolve it by changing the following in the get_data(size, batch_size) function code block, in lines 8, 9 and 11 of that code block: change all the “data/train” and “data/val” and “data/test” to “data/content/data/train” and “data/content/data/val” and “data/content/data/test” respectively.

Hey,

The error is fixed in the baseline now.

Regards
Ayush

Thank you all.

Regards,
Sh

Hey Ayush,

Another fix is required in the baseline. the name of downloaded file is not correct.

Regards,
Sh

1 Like