Unverified Commit 555203e1 authored by Yuta Hayashibe's avatar Yuta Hayashibe Committed by GitHub
Browse files

Warning for invalid options without "--with_prior_preservation" (#1065)



* Make errors for invalid options without "--with_prior_preservation"

* Make --instance_prompt required

* Removed needless check because --instance_data_dir is marked with required

* Updated messages

* Use logger.warning instead of raise errors
Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
parent 813744e5
...@@ -66,6 +66,7 @@ def parse_args(input_args=None): ...@@ -66,6 +66,7 @@ def parse_args(input_args=None):
"--instance_prompt", "--instance_prompt",
type=str, type=str,
default=None, default=None,
required=True,
help="The prompt with identifier specifying the instance", help="The prompt with identifier specifying the instance",
) )
parser.add_argument( parser.add_argument(
...@@ -205,14 +206,16 @@ def parse_args(input_args=None): ...@@ -205,14 +206,16 @@ def parse_args(input_args=None):
if env_local_rank != -1 and env_local_rank != args.local_rank: if env_local_rank != -1 and env_local_rank != args.local_rank:
args.local_rank = env_local_rank args.local_rank = env_local_rank
if args.instance_data_dir is None:
raise ValueError("You must specify a train data directory.")
if args.with_prior_preservation: if args.with_prior_preservation:
if args.class_data_dir is None: if args.class_data_dir is None:
raise ValueError("You must specify a data directory for class images.") raise ValueError("You must specify a data directory for class images.")
if args.class_prompt is None: if args.class_prompt is None:
raise ValueError("You must specify prompt for class images.") raise ValueError("You must specify prompt for class images.")
else:
if args.class_data_dir is not None:
logger.warning("You need not use --class_data_dir without --with_prior_preservation.")
if args.class_prompt is not None:
logger.warning("You need not use --class_prompt without --with_prior_preservation.")
return args return args
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment