diff --git a/src/cloudcasting/cli.py b/src/cloudcasting/cli.py index 599b0be..67fa2f0 100644 --- a/src/cloudcasting/cli.py +++ b/src/cloudcasting/cli.py @@ -1,8 +1,9 @@ import typer from cloudcasting.download import download_satellite_data +from cloudcasting.validation import validate # typer app code app = typer.Typer() app.command("download")(download_satellite_data) -app.command("validate")(lambda x: x) # placeholder +app.command("validate")(validate) diff --git a/src/cloudcasting/validation.py b/src/cloudcasting/validation.py index 30e1418..115f11a 100644 --- a/src/cloudcasting/validation.py +++ b/src/cloudcasting/validation.py @@ -7,8 +7,10 @@ from collections.abc import Callable +from typing import Annotated import numpy as np +import typer import wandb # type: ignore[import-not-found] from torch.utils.data import DataLoader from tqdm import tqdm @@ -262,14 +264,23 @@ def calc_mean_metrics_per_channel(metrics_dict: dict[str, MetricArray]) -> dict[ def validate( - model: AbstractModel, - data_path: list[str] | str, - wandb_project_name: str, - wandb_run_name: str, - nan_to_num: bool = False, - batch_size: int = 1, - num_workers: int = 0, - batch_limit: int | None = None, + model: Annotated[AbstractModel, typer.Argument(help="Model class object to validate.")], + data_path: Annotated[list[str] | str, typer.Argument(help="Path to the validation data.")], + wandb_project_name: Annotated[ + str, + typer.Argument( + help="The folder to store results on wandb - 'cloudcasting' is the main one." + ), + ], + wandb_run_name: Annotated[str, typer.Argument(help="Unique name for logging your run")], + nan_to_num: Annotated[ + bool, typer.Option(help="Whether to convert NaNs to -1. Defaults to False.") + ] = False, + batch_size: Annotated[int, typer.Option(help="Defaults to 1.")] = 1, + num_workers: Annotated[int, typer.Option(help="Defaults to 0.")] = 0, + batch_limit: Annotated[ + int | None, typer.Option(help="Defaults to None. For testing purposes only.") + ] = None, ) -> None: """Run the full validation procedure on the model and log the results to wandb.