lmoroney / dlaicourse

Notebooks for learning deep learning
5.66k stars 5.36k forks source link

fixed tfds.load() error when using tensorflow 2.2 #127

Open marshallho opened 4 years ago

marshallho commented 4 years ago

This change fixes the following error, when running on TensorFlow 2.2.0.

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-4-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])