[tfds] Fix tfds.as_numpy which now returns a reusable iterable.
`next(ds)` -> `next(iter(ds))` Context: https://github.com/tensorflow/datasets/issues/2270 PiperOrigin-RevId: 324951455
This commit is contained in:
parent
29651216cd
commit
191f2461c5
1 changed files with 2 additions and 2 deletions
|
@ -139,8 +139,8 @@ def load_data():
|
||||||
test_dataset = tfds.load(name='lm1b/subwords8k',
|
test_dataset = tfds.load(name='lm1b/subwords8k',
|
||||||
split=tfds.Split.TEST,
|
split=tfds.Split.TEST,
|
||||||
batch_size=10000)
|
batch_size=10000)
|
||||||
train_data = next(tfds.as_numpy(train_dataset))
|
train_data = next(iter(tfds.as_numpy(train_dataset)))
|
||||||
test_data = next(tfds.as_numpy(test_dataset))
|
test_data = next(iter(tfds.as_numpy(test_dataset)))
|
||||||
train_data = train_data['text'].flatten()
|
train_data = train_data['text'].flatten()
|
||||||
test_data = test_data['text'].flatten()
|
test_data = test_data['text'].flatten()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue