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

42 lines
1.1 KiB
Python
Raw Permalink Normal View History

2024-04-06 13:02:31 -07:00
import click
@click.group()
@click.version_option()
def cli():
"""
build, train and run machine learning models.
2024-04-06 13:02:31 -07:00
"""
@cli.command("pipeline:train")
def pipeline_train():
"""run the training pipeline with train data"""
from {{cookiecutter.module_name}}.training import pipeline
2024-04-06 13:02:31 -07:00
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
2024-04-06 13:02:31 -07:00
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
2024-04-06 13:02:31 -07:00
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
2024-04-06 13:02:31 -07:00
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
2024-04-06 13:02:31 -07:00
dataset.debug()