ml_pipeline_cookiecutter/{{cookiecutter.project_name}}/{{cookiecutter.module_name}}/cli.py

42 lines
1.1 KiB
Python

import click
@click.group()
@click.version_option()
def cli():
"""
build, train and run machine learning models.
"""
@cli.command("pipeline:train")
def pipeline_train():
"""run the training pipeline with train data"""
from {{cookiecutter.module_name}}.training import pipeline
pipeline.run(evaluate=False)
@cli.command("pipeline:evaluate")
def pipeline_evaluate():
"""run the training pipeline with test data"""
from {{cookiecutter.module_name}}.training import pipeline
pipeline.run(evaluate=True)
@cli.command("app:serve")
def app_serve():
"""run the api server pipeline with pretrained model"""
from {{cookiecutter.module_name}} import app
app.run()
@cli.command("data:download")
def data_download():
"""download the train and test data"""
from {{cookiecutter.module_name}} import data
from {{cookiecutter.module_name}} import config
from pathlib import Path
data.download(Path(config.paths.data))
@cli.command("data:debug")
def data_debug():
"""debug the dataset class"""
from {{cookiecutter.module_name}}.data import dataset
dataset.debug()