Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface the basic configuration with the user before proceeding with validation checking - Issue #196 #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions zamba/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def train(

If an argument is specified in both the command line and in a yaml file, the command line input will take precedence.
"""

if config is not None:
with config.open() as f:
config_dict = yaml.safe_load(f)
Expand Down Expand Up @@ -128,6 +129,27 @@ def train(
if skip_load_validation is not None:
train_dict["skip_load_validation"] = skip_load_validation

# surface the configuration before validation checking
msg = f"""Review the following configuration before proceeding with validation checking:

Config file: {config_file}
Data directory: {data_dir if data_dir is not None else config_dict["train_config"].get("data_dir")}
Labels csv: {labels if labels is not None else config_dict["train_config"].get("labels")}
Checkpoint: {checkpoint if checkpoint is not None else config_dict["train_config"].get("checkpoint")}
"""

if yes:
typer.echo(f"{msg}\n\nSkipping confirmation and proceeding to validation checking.")
else:
yes = typer.confirm(
f"{msg}\n\nIs this correct?",
abort=False,
default=True,
)
if not yes:
print("\n\nPlease review and adjust the configuration and run the command again.")
return

try:
manager = ModelManager(
ModelConfig(
Expand Down Expand Up @@ -321,6 +343,27 @@ def predict(
if overwrite is not None:
predict_dict["overwrite"] = overwrite

# surface the configuration before validation checking
msg = f"""Review the following configuration before proceeding with validation checking:

Config file: {config_file}
Data directory: {data_dir if data_dir is not None else config_dict["predict_config"].get("data_dir")}
Filepath csv: {filepaths if filepaths is not None else config_dict["predict_config"].get("filepaths")}
Checkpoint: {checkpoint if checkpoint is not None else config_dict["predict_config"].get("checkpoint")}
"""

if yes:
typer.echo(f"{msg}\n\nSkipping confirmation and proceeding to validation checking.")
else:
yes = typer.confirm(
f"{msg}\n\nIs this correct?",
abort=False,
default=True,
)
if not yes:
print("\n\nPlease review and adjust the configuration and run the command again.")
return

try:
manager = ModelManager(
ModelConfig(
Expand Down