tensorflow / tensorflow/datasets

Cannot load huggingface:imagenet-1k dataset due to parse error

Open
#5,105 5 comments 0 reactions 0 assignees View on GitHub

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
When following the instructions here, I cannot download the imagenet-1k dataset from huggingface.

Environment information

  • Operating System: macOS Sonoma 14.0 (23A344)

  • Python version: 3.10.10

  • tensorflow-datasets/tfds-nightly version: 4.9.3.dev202310060044

  • tensorflow/tf-nightly version: 2.13.0

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

Reproduction instructions

import tensorflow_datasets as tfds

if __name__ == '__main__':
    ds = tfds.load('huggingface:imagenet-1k', split='train')

Stacktrace

Traceback (most recent call last):
  File "<python_file>.py", line 4, in <module>
    ds = tfds.load('huggingface: imagenet-1k', split='train')
  File "<venv>/lib/python3.10/site-packages/tensorflow_datasets/core/logging/__init__.py", line 168, in __call__
    return function(*args, **kwargs)
  File "<venv>/lib/python3.10/site-packages/tensorflow_datasets/core/load.py", line 633, in load
    dbuilder = _fetch_builder(
  File "<venv>/lib/python3.10/site-packages/tensorflow_datasets/core/load.py", line 488, in _fetch_builder
    return builder(name, data_dir=data_dir, try_gcs=try_gcs, **builder_kwargs)
  File "<...>/.pyenv/versions/3.10.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "<venv>/lib/python3.10/site-packages/tensorflow_datasets/core/logging/__init__.py", line 168, in __call__
    return function(*args, **kwargs)
  File "<venv>/lib/python3.10/site-packages/tensorflow_datasets/core/load.py", line 171, in builder
    name, builder_kwargs = naming.parse_builder_name_kwargs(
  File "<venv>/lib/python3.10/site-packages/tensorflow_datasets/core/naming.py", line 141, in parse_builder_name_kwargs
    name, parsed_builder_kwargs = _dataset_name_and_kwargs_from_name_str(name)
  File "<venv>/lib/python3.10/site-packages/tensorflow_datasets/core/naming.py", line 173, in _dataset_name_and_kwargs_from_name_str
    raise ValueError(err_msg)
ValueError: Parsing builder name string huggingface: imagenet-1k failed.
The builder name string must be of the following format:
  dataset_name[/config_name][:version][/kwargs]

  Where:

    * dataset_name and config_name are string following python variable naming.
    * version is of the form x.y.z where {x,y,z} can be any digit or *.
    * kwargs is a comma list separated of arguments and values to pass to
      builder.

  Examples:
    my_dataset
    my_dataset:1.2.*
    my_dataset/config1
    my_dataset/config1:1.*.*
    my_dataset/config1/arg1=val1,arg2=val2
    my_dataset/config1:1.2.3/right=True,foo=bar,rate=1.2

Expected behavior
The parser properly parses the string given in the documentation and downloading the dataset succeeds.

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.

Research direction

Start with the linked Hugging Face ImageNet-1k documentation and the dataset-name parsing path shown in tensorflow_datasets/core/naming.py. Compare the documented identifier with the string passed to tfds.load and reproduce the failure using the provided Python example. Done means the documented command parses successfully and downloads the dataset.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
data, machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.