From a1c754aea1be3ba3bbd068230e4b82d32a96c9e7 Mon Sep 17 00:00:00 2001 From: db0 Date: Sat, 16 Mar 2024 23:38:34 +0100 Subject: [PATCH] fix: added sampler and scheduler warnings --- horde/apis/v2/stable.py | 8 ++++++++ horde/enums.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/horde/apis/v2/stable.py b/horde/apis/v2/stable.py index 35f89ec0..775606a0 100644 --- a/horde/apis/v2/stable.py +++ b/horde/apis/v2/stable.py @@ -148,6 +148,14 @@ def validate(self): self.warnings.add(WarningMessage.CfgScaleTooSmall) if "max_cfg_scale" in model_req_dict and model_req_dict["max_cfg_scale"] < self.params.get("cfg_scale", 7.5): self.warnings.add(WarningMessage.CfgScaleTooLarge) + if "samplers" in model_req_dict and self.params.get("sampler_name", "k_euler_a") not in model_req_dict["samplers"]: + self.warnings.add(WarningMessage.SamplerMismatch) + # FIXME: Scheduler workaround until we support multiple schedulers + scheduler = 'karras' + if not self.params.get("karras", True): + scheduler = 'simple' + if "schedulers" in model_req_dict and scheduler not in model_req_dict["schedulers"]: + self.warnings.add(WarningMessage.SchedulerMismatch) if "control_type" in self.params and any(model_name in ["pix2pix"] for model_name in self.args.models): raise e.UnsupportedModel("You cannot use ControlNet with these models.", rc="ControlNetUnsupported") # if self.params.get("image_is_control"): diff --git a/horde/enums.py b/horde/enums.py index 944a2f24..c396667f 100644 --- a/horde/enums.py +++ b/horde/enums.py @@ -57,3 +57,5 @@ class WarningMessage(ReturnedEnum): CfgScaleMismatch = "The cfg scale specified for this generation does not match the requirements of one of the requested models." CfgScaleTooSmall = "The cfg_scale specified for this generation is too small for this model." CfgScaleTooLarge = "The cfg_scale specified for this generation is too large for this model." + SamplerMismatch = "The requested sampler does not match the requirements for one of the requested models." + SchedulerMismatch = "The requested scheduler does not match the requirements for one of the requested models."