in dynalab_cli/init.py [0:0]
def add_args(parser):
init_parser = parser.add_parser(
"init", help="Create a starter folder for model upload"
)
def model_name_type(name):
check_model_name(name)
return str(name)
init_parser.add_argument(
"-n",
"--name",
type=model_name_type,
required=True,
help=(
"Name of the model, used as a unique identifier, "
"must be of the pattern ^[a-zA-Z0-9-]+$"
),
)
_, task_codes = get_tasks()
init_parser.add_argument(
"-t", "--task", type=str, choices=task_codes, help="Name of the task"
)
init_parser.add_argument(
"-d",
"--root-dir",
type=str,
default=".",
help="Root directory to your project folder",
)
init_parser.add_argument(
"--model-checkpoint",
type=str,
default=f"./{default_filename('checkpoint')}",
help="Path to the model checkpoint file",
)
init_parser.add_argument(
"--handler",
type=str,
default=f"./{default_filename('handler')}",
help="Path to the handler file",
)
init_parser.add_argument(
"-r",
"--install-requirements",
action="store_true",
help=(
"If a requirements.txt file exists, and this flag is true, "
"we will run pip install -r requirements.txt in the docker"
),
)
init_parser.add_argument(
"--run-setup",
action="store_true",
help=(
"If a setup.py file exists and this flag is "
"true, we will run pip install -e . in the docker"
),
)
init_parser.add_argument(
"--model-files",
type=str,
default="",
help=(
"Comma separated list of files that defines the model, "
"e.g. vocabulary, config. Once added here, you can directly "
"import or read these files by name in your handler file "
"without specifying paths. "
),
)
init_parser.add_argument(
"--exclude",
type=str,
default="",
help=(
"Comma separated list of files or folders to be excluded, e.g. "
"unnecessary large folders or files like checkpoints"
),
)
init_parser.add_argument(
"--amend", action="store_true", help="Update the config"
)
init_parser.add_argument(
"--rename",
type=model_name_type,
help="Rename an existing model to a new name",
)