Skip to content

Commit

Permalink
feat: worker allow_sdxl_controlnet bridge data option
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 authored and tazlin committed May 22, 2024
1 parent 48f3d6e commit 6a636a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions horde_sdk/ai_horde_api/apimodels/generate/_pop.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ class ImageGenerateJobPopRequest(BaseAIHordeRequest, APIKeyAllowedInRequestMixin
allow_unsafe_ipaddr: bool = True
allow_post_processing: bool = True
allow_controlnet: bool = False
allow_sdxl_controlnet: bool = False
allow_lora: bool = False

@override
Expand Down
12 changes: 12 additions & 0 deletions horde_sdk/ai_horde_worker/bridge_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class ImageWorkerBridgeData(SharedHordeBridgeData):
allow_controlnet: bool = False
"""Whether to allow the use of ControlNet. This requires img2img to be enabled."""

allow_sdxl_controlnet: bool = False
"""Whether to allow the use of SDXL ControlNet. This requires controlnet to be enabled."""

allow_img2img: bool = True
"""Whether to allow the use of img2img."""

Expand Down Expand Up @@ -298,6 +301,15 @@ def validate_model(self) -> ImageWorkerBridgeData:
)
self.allow_controlnet = False

if not self.allow_controlnet and self.allow_sdxl_controlnet:
logger.warning(
(
"allow_sdxl_controlnet is set to True, but allow_controlnet is set to False. "
"SDXL ControlNet requires allow_controlnet to be enabled. Setting allow_sdxl_controlnet to false."
),
)
self.allow_sdxl_controlnet = False

self.image_models_to_skip.append("SDXL_beta::stability.ai#6901") # FIXME: no magic strings

return self
Expand Down

0 comments on commit 6a636a8

Please sign in to comment.