Skip to content

Commit

Permalink
fix: added sampler and scheduler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Mar 16, 2024
1 parent 1131b29 commit a1c754a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions horde/apis/v2/stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
2 changes: 2 additions & 0 deletions horde/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."

0 comments on commit a1c754a

Please sign in to comment.