forked from huggingface/datasets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datasets-cli
36 lines (30 loc) · 1.29 KB
/
datasets-cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
from argparse import ArgumentParser
from datasets.commands.convert import ConvertCommand
from datasets.commands.download import DownloadCommand
from datasets.commands.env import EnvironmentCommand
from datasets.commands.user import UserCommands
from datasets.commands.test import TestCommand
from datasets.commands.run_beam import RunBeamCommand
from datasets.commands.dummy_data import DummyDataCommand
from datasets.utils.logging import set_verbosity_info
if __name__ == '__main__':
parser = ArgumentParser('HuggingFace Datasets CLI tool', usage='datasets-cli <command> [<args>]')
commands_parser = parser.add_subparsers(help='datasets-cli command helpers')
set_verbosity_info()
# Register commands
ConvertCommand.register_subcommand(commands_parser)
DownloadCommand.register_subcommand(commands_parser)
EnvironmentCommand.register_subcommand(commands_parser)
UserCommands.register_subcommand(commands_parser)
TestCommand.register_subcommand(commands_parser)
RunBeamCommand.register_subcommand(commands_parser)
DummyDataCommand.register_subcommand(commands_parser)
# Let's go
args = parser.parse_args()
if not hasattr(args, 'func'):
parser.print_help()
exit(1)
# Run
service = args.func(args)
service.run()