Error when downloading dataset with the `datasets`

#2
by 02alexander - opened

I'm not sure if this is a problem with the datasets library or this dataset, but when I try to download it with datasets version 2.19.1 I get the following error message:

Traceback (most recent call last):
  File "/home/alexander/work/python-example-huggingface/min.py", line 3, in <module>
    ds = load_dataset('lerobot/pusht')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/load.py", line 2587, in load_dataset
    builder_instance = load_dataset_builder(
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/load.py", line 2259, in load_dataset_builder
    dataset_module = dataset_module_factory(
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/load.py", line 1910, in dataset_module_factory
    raise e1 from None
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/load.py", line 1892, in dataset_module_factory
    ).get_module()
      ^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/load.py", line 1237, in get_module
    dataset_infos = DatasetInfosDict.from_dataset_card_data(dataset_card_data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/info.py", line 464, in from_dataset_card_data
    dataset_info = DatasetInfo._from_yaml_dict(dataset_card_data["dataset_info"])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/info.py", line 395, in _from_yaml_dict
    yaml_data["features"] = Features._from_yaml_list(yaml_data["features"])
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/features/features.py", line 1910, in _from_yaml_list
    return cls.from_dict(from_yaml_inner(yaml_data))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/features/features.py", line 1750, in from_dict
    obj = generate_from_dict(dic)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/features/features.py", line 1392, in generate_from_dict
    return {key: generate_from_dict(value) for key, value in obj.items()}
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/features/features.py", line 1392, in <dictcomp>
    return {key: generate_from_dict(value) for key, value in obj.items()}
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexander/work/python-example-huggingface/venv/lib/python3.11/site-packages/datasets/features/features.py", line 1398, in generate_from_dict
    raise ValueError(f"Feature type '{_type}' not found. Available feature types: {list(_FEATURE_TYPES.keys())}")
ValueError: Feature type 'VideoFrame' not found. Available feature types: ['Value', 'ClassLabel', 'Translation', 'TranslationVariableLanguages', 'Sequence', 'Array2D', 'Array3D', 'Array4D', 'Array5D', 'Audio', 'Image']

Try importing lerobot.common.datasets.video_utils. There's some code in there for a registration mechanism that I believe is required for the dataset import to work.

with warnings.catch_warnings():
    warnings.filterwarnings(
        "ignore",
        "'register_feature' is experimental and might be subject to breaking changes in the future.",
        category=UserWarning,
    )
    # to make VideoFrame available in HuggingFace `datasets`
    register_feature(VideoFrame, "VideoFrame")

cc @cadene

Edit: And thanks for taking the time to report it!

Thanks @alexandersoare , adding import lerobot.common.datasets.video_utils solved my issue.
I think it would be helpful for others if this instruction was included in the "Use in Datasets library" window.

02alexander changed discussion status to closed

Sign up or log in to comment