tensorflow / tensorflow/datasets

Trying to access splits inside the ds-info, which is an empty dict

Open
#4,769 3 comments 0 reactions 1 assignee View on GitHub

@tomvdw is already working on this.

Since Mar 23, 2023.

bug
Dominant language
Python
Stars
4.6k
Forks
1.6k
Avg merge
3h 54m
Merged PRs (30d)
1

Description

/!\ PLEASE INCLUDE THE FULL STACKTRACE AND CODE SNIPPET

Short description
Description of the bug.

The Splits dictionary coming as empty when you use the latest version of the tensorflow-datasets =4.8.3 ,but if you use the tensorflow-datasets=4.8.2 version, its working fine.

Environment information

  • Operating System:

  • Python version:

  • tensorflow-datasets/tfds-nightly version:

  • tensorflow/tf-nightly version:

  • Does the issue still exists with the last tfds-nightly package (pip install --upgrade tfds-nightly) ?

Reproduction instructions

Use the latest version of the `pip install tensorflow-datasets =4.8.3' ,you will see the error.

tfds_name = 'cifar10'
ds_info = tfds.builder(tfds_name ).info
ds_info.splits['test'].num_examples

Link to logs

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[<ipython-input-6-08c8a6b834e3>](https://localhost:8080/#) in <module>
     21 exp_config.trainer.checkpoint_interval = train_steps
     22 exp_config.trainer.validation_interval = 1000
---> 23 exp_config.trainer.validation_steps =  ds_info.splits['test'].num_examples // batch_size
     24 exp_config.trainer.train_steps = train_steps
     25 exp_config.trainer.optimizer_config.learning_rate.type = 'cosine'

[/usr/local/lib/python3.8/dist-packages/tensorflow_datasets/core/splits.py](https://localhost:8080/#) in __getitem__(self, key)
    389   def __getitem__(self, key):
    390     if not self:
--> 391       raise KeyError(
    392           f'Trying to access `splits[{key!r}]` but `splits` is empty. '
    393           'This likely indicate the dataset has not been generated yet.'

KeyError: "Trying to access `splits['test']` but `splits` is empty. This likely indicate the dataset has not been generated yet."

Expected behavior
The Splits dictionary should not come as empty

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.