forked from vocalpy/vak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.py
33 lines (28 loc) · 867 Bytes
/
cli.py
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
from .eval import eval
from .train import train
from .learncurve import learning_curve
from .predict import predict
from .prep import prep
from .train_checkpoint import train_checkpoint
COMMAND_FUNCTION_MAP = {
"prep": prep,
"train": train,
"eval": eval,
"predict": predict,
"learncurve": learning_curve,
"train_checkpoint": train_checkpoint,
}
CLI_COMMANDS = tuple(COMMAND_FUNCTION_MAP.keys())
def cli(command, config_file):
"""command-line interface
Parameters
----------
command : string
One of {'prep', 'train', 'eval', 'predict', 'learncurve', 'train_checkpoint'}
config_file : str, Path
path to a config.toml file
"""
if command in COMMAND_FUNCTION_MAP:
COMMAND_FUNCTION_MAP[command](toml_path=config_file)
else:
raise ValueError(f"command not recognized: {command}")