tensorflow / tensorflow/datasets
`shuffle_files` and `shuffle_reshuffle_each_iteration` is ignored.
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 1.6k
- Avg merge
- 3h 54m
- Merged PRs (30d)
- 1
Description
Short description
shuffle_files and shuffle_reshuffle_each_iteration parameter of tfds.load() is ignored. The result dataset never get shuffled.
Environment information
- Summary: It's Google Colab
- Operating System: Linux 1803a98d124d 4.19.112+ #1 SMP Thu Jul 23 08:00:38 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux
- Python version: Python 3.6.9
tensorflow-datasets/tfds-nightlyversion: Reproducible with 4.0.1, 4.2.0, 4.2.0+nightly (2021-02-14)tensorflow/tf-nightlyversion: 2.4.1- Does the issue still exists with the last
tfds-nightlypackage?: Yes
Reproduction instructions
import tensorflow_datasets as tfds
options = tf.data.Options()
options.experimental_deterministic = False
ds = tfds.load(
'mnist',
split='test',
batch_size=32,
shuffle_files=True,
read_config=tfds.ReadConfig(
options=options,
shuffle_seed=123,
shuffle_reshuffle_each_iteration=True,
),
)
for entry in ds.take(2):
print(entry['label'])
print()
for entry in ds.take(2):
print(entry['label'])
print()
for entry in ds.take(2):
print(entry['label'])
Actual output
tf.Tensor([2 0 4 8 7 6 0 6 3 1 8 0 7 9 8 4 5 3 4 0 6 6 3 0 2 3 6 6 7 4 9 3], shape=(32,), dtype=int64)
tf.Tensor([8 7 5 4 2 5 8 5 5 2 9 2 4 2 7 0 5 1 0 7 9 9 9 6 5 8 8 6 9 9 5 4], shape=(32,), dtype=int64)
tf.Tensor([2 0 4 8 7 6 0 6 3 1 8 0 7 9 8 4 5 3 4 0 6 6 3 0 2 3 6 6 7 4 9 3], shape=(32,), dtype=int64)
tf.Tensor([8 7 5 4 2 5 5 8 5 2 9 2 4 2 7 0 5 1 0 7 9 9 9 6 5 8 8 6 9 9 5 4], shape=(32,), dtype=int64)
tf.Tensor([2 0 4 8 7 6 0 6 3 1 8 0 7 9 8 4 5 3 4 0 6 6 3 0 2 3 6 6 7 4 9 3], shape=(32,), dtype=int64)
tf.Tensor([8 7 5 4 2 5 5 8 5 2 9 2 4 2 7 0 5 1 0 7 9 9 9 6 5 8 8 6 9 9 5 4], shape=(32,), dtype=int64)
Expected behavior
The dataset should be shuffled, and it must be reshuffled on each epoch.
Additional context
This is the 3rd day I started using Tensorflow.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided tfds.load() reproduction with MNIST, focusing on shuffle_files, shuffle_reshuffle_each_iteration, and ReadConfig. Done means the resulting dataset is shuffled and produces a different order on each epoch when reshuffling is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- data, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100