in models/framework.py [0:0]
def create_model_commands(model: Type[Vocoder]) -> click.Group:
"""
Create a 'create' command.
"""
name: str = model.command
if not name:
raise ValueError(f"Missing 'command' attribute on model '{model.__class__}'")
def group() -> None:
pass
group.__doc__ = f"Create, train, or use {name} models."
group = click.group(name)(group)
@group.command("train")
@click.option("--path", required=True, help="Directory for the model")
@click.option("--dataset", required=True, help="Name of the dataset to use")
@click.option(
"--config", "config_file", default=None, help="Name of the configuration file"
)
@click.argument("config_updates", nargs=-1)
def train(
path: str, dataset: str, config_file: str, config_updates: List[str]
) -> None:
"""
Train the model.
"""
cli_train(name, model, path, dataset, config_file, config_updates)
@group.command("synthesize")
@click.option("--path", required=True, help="Directory for the model")
@click.option(
"--length",
default=None,
help="The length of the output sample in seconds",
)
@click.option("--offset", default=0.0, help="Offset in seconds of the sample")
@click.argument("input_file")
@click.argument("output_file")
def synthesize(
path: str, length: float, offset: float, input_file: str, output_file: str
) -> None:
"""
Synthesize with the model.
"""
cli_synthesize(name, model, path, length, offset, input_file, output_file)
@group.command("evaluate")
@click.option("--path", required=True, help="Directory for the model")
@click.option("--dataset", required=True, help="Name of the dataset to use")
@click.option(
"--checkpoint",
default=None,
help="Checkpoint path (default: load latest checkpoint)",
)
def evaluate(path: str, dataset: str, checkpoint: str) -> None:
"""
Evaluate a given vocoder.
"""
cli_evaluate(name, model, path, dataset, checkpoint)
return group