lmoroney/dlaicourse

Loading the dataset throws an error

pdubz-sudo opened this issue · 2 comments

Thanks for the notebook.

I'm not sure if something has updated and making the notebook not work in colab but when I try to load the dataset it will not load and throws this error.

AssertionError                            Traceback (most recent call last)
<ipython-input-6-852afec717c3> in <module>()
      1 splits = tfds.Split.ALL.subsplit(weighted=(80, 10, 10))
      2 
----> 3 splits, info = tfds.load('cats_vs_dogs', with_info=True, as_supervised=True, split = splits)
      4 
      5 (train_examples, validation_examples, test_examples) = splits

15 frames
/usr/local/lib/python3.6/dist-packages/tensorflow_datasets/core/tfrecords_reader.py in _str_to_relative_instruction(spec)
    354   res = _SUB_SPEC_RE.match(spec)
    355   if not res:
--> 356     raise AssertionError('Unrecognized instruction format: %s' % spec)
    357   unit = '%' if res.group('from_pct') or res.group('to_pct') else 'abs'
    358   return ReadInstruction(

AssertionError: Unrecognized instruction format: NamedSplitAll()(tfds.percent[0:80])

Please try comment out the 2 lines of code below, and replace with the 3rd line.
The original "tfds.Split.ALL.subsplit" does not work well with the current version of tfds.

# splits = tfds.Split.ALL.subsplit(weighted=(80, 10, 10))
# splits, info = tfds.load('cats_vs_dogs', with_info=True, as_supervised=True, split = splits)
splits, info = tfds.load('cats_vs_dogs', with_info=True, as_supervised=True, split=['train[:80%]', 'train[80%:90%]', 'train[90%:100%]'])

Thanks for the fix and making the PR's so all the students coming in from the coursera course can easily focus on the exercise.