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

未关闭
#5,105 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
huggingface, python

调研方向

从链接的 Hugging Face ImageNet-1k 文档以及 tensorflow_datasets/core/naming.py 中所示的数据集名称解析路径开始。将文档中的标识符与传递给 tfds.load 的字符串进行比较,并使用提供的 Python 示例复现该失败。文档中的命令能够成功解析并下载数据集即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug

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

主要语言
Python
星标
4.6k
派生
1.6k
平均合并
14 小时 3 分钟
30 天内合并 PR
5

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

tensorflow/datasets 的其他 Issue

查看 tensorflow/datasets 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。