tensorflow / tensorflow/datasets
mock_data fails for "coco_captions" dataset
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 1.6k
- Avg merge
- 3h 54m
- Merged PRs (30d)
- 1
Description
Short description
tfds.testing.mock_data fails for "coco_captions" dataset due to the Sequence features.
Environment information
Google internal test infra running code synched to Sep 8, 4:35 PM PDT.
Reproduction instructions
This runs as expected
builder = tfds.builder("coco_captions")
dataset = builder.as_dataset(split="train", decoders={"image": tfds.decode.SkipDecoding()})
x = next(iter(dataset))
As does this
with tfds.testing.mock_data(num_examples=50):
builder = tfds.builder('mnist')
dataset = builder.as_dataset(
split='train', decoders={'image': tfds.decode.SkipDecoding()})
x = next(iter(dataset))
However, this fails
with tfds.testing.mock_data(num_examples=50):
builder = tfds.builder("coco_captions")
dataset = builder.as_dataset(split="train", decoders={"image": tfds.decode.SkipDecoding()})
x = next(iter(dataset))
With
deterministic_test.py:63 in test_deterministic_script
x = next(iter(train_ds))
tensorflow/python/data/ops/iterator_ops.py:787 in __next__
return self._next_internal()
tensorflow/python/data/ops/iterator_ops.py:770 in _next_internal
ret = gen_dataset_ops.iterator_get_next(
tensorflow/python/ops/gen_dataset_ops.py:3017 in iterator_get_next
_ops.raise_from_not_ok_status(e, name)
tensorflow/python/framework/ops.py:7215 in raise_from_not_ok_status
raise core._status_to_exception(e) from None # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node __wrapped__IteratorGetNext_output_types_11_device_/job:localhost/replica:0/task:0/device:CPU:0}} ValueError: In <Sequence> with name "objects":
The length of all elements of one sequence should be the same. Got 5 != 7
Sometimes (seemingly non-deterministically) the error is
ValueError: In <Sequence> with name "captions":
The length of all elements of one sequence should be the same. Got 49 != 37
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 with the reported reproduction using tfds.testing.mock_data and the coco_captions builder, then inspect how mock_data handles Sequence features such as objects and captions. Done means the reproduction can iterate deterministically without inconsistent sequence-length errors, while the existing mnist behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- data, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100