Skip to content

Commit

Permalink
limit max steps for empty model lists
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Sep 22, 2024
1 parent 26392f6 commit 1e54dfc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later

# Changelog

# 4.43.1

* Fix to prevent limit_max_steps picking up WPs with empty model lists

# 4.43.0

* Adjused TTL formula to be algorithmic
Expand Down
31 changes: 22 additions & 9 deletions horde/classes/stable/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,29 @@ def can_generate(self, waiting_prompt):
if not waiting_prompt.safe_ip and not self.allow_unsafe_ipaddr:
return [False, "unsafe_ip"]
if self.limit_max_steps:
for mn in waiting_prompt.get_model_names():
avg_steps = (
int(
model_reference.get_model_requirements(mn).get("min_steps", 20)
+ model_reference.get_model_requirements(mn).get("max_steps", 40),
if len (waiting_prompt.get_model_names()) > 1:
for mn in waiting_prompt.get_model_names():
avg_steps = (
int(
model_reference.get_model_requirements(mn).get("min_steps", 20)
+ model_reference.get_model_requirements(mn).get("max_steps", 40),
)
/ 2
)
/ 2
)
if waiting_prompt.get_accurate_steps() > avg_steps:
return [False, "step_count"]
if waiting_prompt.get_accurate_steps() > avg_steps:
return [False, "step_count"]
else:
# If the request has an empty model list, we compare instead to the worker's model list
for mn in self.get_model_names():
avg_steps = (
int(
model_reference.get_model_requirements(mn).get("min_steps", 20)
+ model_reference.get_model_requirements(mn).get("max_steps", 40),
)
/ 2
)
if waiting_prompt.get_accurate_steps() > avg_steps:
return [False, "step_count"]
# We do not give untrusted workers anon or VPN generations, to avoid anything slipping by and spooking them.
# logger.warning(datetime.utcnow())
if not self.user.trusted: # FIXME #noqa SIM102
Expand Down
2 changes: 1 addition & 1 deletion horde/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later

HORDE_VERSION = "4.43.0 "
HORDE_VERSION = "4.43.1 "

WHITELISTED_SERVICE_IPS = {
"212.227.227.178", # Turing Bot
Expand Down

0 comments on commit 1e54dfc

Please sign in to comment.