Skip to content

Commit

Permalink
fix: clarify queue_size values; coerce suboptimal ones
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Mar 4, 2024
1 parent d79faf9 commit c1c596a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bridgeData_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ priority_usernames: []
max_threads: 1

# We will keep this many requests in the queue so we can start working as soon as a thread is available
# This generally should be or 1, or 1 more the value of max_threads if max_threads is 2 or higher.
# This generally should be or 1 or 2. You should never set this higher than 2 if your max_threads is 2.
queue_size: 1

# This will try to pull these many jobs per request and perform batched inference.
Expand Down
12 changes: 12 additions & 0 deletions horde_worker_regen/bridge_data/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ class reGenBridgeData(CombinedHordeBridgeData):

@model_validator(mode="after")
def validate_performance_modes(self) -> reGenBridgeData:
if self.max_threads == 2 and self.queue_size > 2:
self.queue_size = 2
logger.warning(
"The queue_size value has been set to 2 because the max_threads value is 2.",
)

if self.max_threads > 2 and self.queue_size > 1:
self.queue_size = 1
logger.warning(
"The queue_size value has been set to 1 because the max_threads value is greater than 2.",
)

if self.high_memory_mode:
if self.max_threads != 1:
self.max_threads = 1
Expand Down

0 comments on commit c1c596a

Please sign in to comment.