数据集文档
命令行界面 (CLI)
加入 Hugging Face 社区
并获取增强的文档体验
开始使用
命令行界面 (CLI)
🤗 Datasets 提供了一个命令行界面 (CLI),其中包含有用的 shell 命令,用于与您的数据集进行交互。
您可以查看可用的命令
>>> datasets-cli --help
usage: datasets-cli <command> [<args>]
positional arguments:
{convert,env,test,convert_to_parquet}
datasets-cli command helpers
convert Convert a TensorFlow Datasets dataset to a HuggingFace Datasets dataset.
env Print relevant system environment info.
test Test dataset implementation.
convert_to_parquet Convert dataset to Parquet
delete_from_hub Delete dataset config from the Hub
optional arguments:
-h, --help show this help message and exit
转换为 Parquet
轻松将您的 Hub 基于脚本的数据集转换为 Parquet 纯数据数据集,以便支持数据集查看器。
>>> datasets-cli convert_to_parquet --help
usage: datasets-cli <command> [<args>] convert_to_parquet [-h] [--token TOKEN] [--revision REVISION] [--trust_remote_code] dataset_id
positional arguments:
dataset_id source dataset ID, e.g. USERNAME/DATASET_NAME or ORGANIZATION/DATASET_NAME
optional arguments:
-h, --help show this help message and exit
--token TOKEN access token to the Hugging Face Hub (defaults to logged-in user's one)
--revision REVISION source revision
--trust_remote_code whether to trust the code execution of the load script
此命令
- 在“main”分支上复制脚本到一个名为“script”的专用分支中(如果尚不存在)
- 创建一个拉取请求到 Hub 数据集,以将其转换为 Parquet 文件(并从主分支中删除脚本)
如果将来您需要从“script”分支重新创建 Parquet 文件,请传递 --revision script
参数。
请注意,只有当您信任远程代码在您的机器本地执行时,才应传递 --trust_remote_code
参数。
例如
>>> datasets-cli convert_to_parquet USERNAME/DATASET_NAME
不要忘记您需要先登录您的 Hugging Face 账户
>>> huggingface-cli login
从 Hub 删除
从 Hub 上的纯数据数据集中删除数据集配置。
>>> datasets-cli delete_from_hub --help
usage: datasets-cli <command> [<args>] delete_from_hub [-h] [--token TOKEN] [--revision REVISION] dataset_id config_name
positional arguments:
dataset_id source dataset ID, e.g. USERNAME/DATASET_NAME or ORGANIZATION/DATASET_NAME
config_name config name to delete
optional arguments:
-h, --help show this help message and exit
--token TOKEN access token to the Hugging Face Hub
--revision REVISION source revision
例如
>>> datasets-cli delete_from_hub USERNAME/DATASET_NAME CONFIG_NAME
不要忘记您需要先登录您的 Hugging Face 账户
>>> huggingface-cli login