diff --git a/src/mflux/ui/cli/parsers.py b/src/mflux/ui/cli/parsers.py index b1d3aa3..7810f5a 100644 --- a/src/mflux/ui/cli/parsers.py +++ b/src/mflux/ui/cli/parsers.py @@ -63,16 +63,15 @@ def add_controlnet_arguments(self) -> None: def add_metadata_config(self) -> None: self.supports_metadata_config = True - self.add_argument("--config-from-metadata", "-C", type=Path, required=False, default=argparse.SUPPRESS, help="Re-use the parameters from prior metadata. Params from metadata are secondary to other args you provide.") + self.add_argument("--config-from-metadata", "-C", type=Path, required=False, default=None, help="Re-use the parameters from prior metadata. Params from metadata are secondary to other args you provide.") def parse_args(self, **kwargs) -> argparse.Namespace: namespace = super().parse_args() if hasattr(namespace, "path") and namespace.path is not None and namespace.model is None: namespace.error("--model must be specified when using --path") - if getattr(namespace, "config_from_metadata", False): + if self.supports_metadata_config and namespace.config_from_metadata is not None: prior_gen_metadata = json.load(namespace.config_from_metadata.open("rt")) - if namespace.prompt is None: namespace.prompt = prior_gen_metadata.get("prompt", None) @@ -108,13 +107,13 @@ def parse_args(self, **kwargs) -> argparse.Namespace: namespace.init_image_strength = init_img_strength_from_metadata if self.supports_controlnet: + # todo: support more controlnet flags, but may require a follow-up PR + # and maybe after consolidating the flux/cnet implementations somehow if namespace.controlnet_image_path is None: namespace.controlnet_image_path = prior_gen_metadata.get("controlnet_image_path", None) if namespace.controlnet_strength == self.get_default("controlnet_strength") and (cnet_strength_from_metadata := prior_gen_metadata.get("controlnet_strength", None)): namespace.controlnet_strength = cnet_strength_from_metadata - - if namespace.prompt is None: # not supplied by CLI and not supplied by metadata config file self.error("--prompt argument required or 'prompt' required in metadata config file")