Skip to content

Commit

Permalink
feat: support new api models as of sept 13 2024
Browse files Browse the repository at this point in the history
This includes:
- `active_generations` for user details (see also the new object `ActiveGenerations`)
- `hires_fix_denoising_strength` for image gen payload
- `transparent` for image gen payload
- `extra_slow_workers` for generation payloads
- `limit_max_steps` for image worker pop payloads
- `validated_backends` for generation payloads
  • Loading branch information
tazlin committed Sep 13, 2024
1 parent e0e2f34 commit 372400b
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 14 deletions.
42 changes: 34 additions & 8 deletions docs/request_field_names_and_descriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@
"types": [
"bool"
]
},
"extra_slow_workers": {
"description": "Whether to use the super slow workers.",
"types": [
"bool"
]
}
},
"AlchemyDeleteRequest": {
Expand Down Expand Up @@ -443,6 +449,12 @@
"bool"
]
},
"extra_slow_workers": {
"description": "When True, allows extra slow workers to pick up this request.",
"types": [
"bool"
]
},
"workers": {
"description": "A list of worker IDs to use for this request. If empty, any worker can pick up the request. Using this incurs\nand extra kudos cost.",
"types": [
Expand Down Expand Up @@ -596,15 +608,13 @@
"models": {
"description": "The models this worker can generate.",
"types": [
"list[str]",
"None"
"list[str]"
]
},
"name": {
"description": "The Name of the Worker.",
"types": [
"str",
"None"
"str"
]
},
"nsfw": {
Expand Down Expand Up @@ -714,6 +724,18 @@
"types": [
"bool"
]
},
"extra_slow_worker": {
"description": "Marks the worker as extra slow.",
"types": [
"bool"
]
},
"limit_max_steps": {
"description": "Prevents the worker picking up jobs with more steps than the model average.",
"types": [
"bool"
]
}
},
"ImageGenerateStatusRequest": {
Expand Down Expand Up @@ -1192,6 +1214,12 @@
"bool"
]
},
"extra_slow_workers": {
"description": "When True, allows extra slow workers to pick up this request.",
"types": [
"bool"
]
},
"workers": {
"description": "A list of worker IDs to use for this request. If empty, any worker can pick up the request. Using this incurs\nand extra kudos cost.",
"types": [
Expand Down Expand Up @@ -1310,15 +1338,13 @@
"models": {
"description": "The models this worker can generate.",
"types": [
"list[str]",
"None"
"list[str]"
]
},
"name": {
"description": "The Name of the Worker.",
"types": [
"str",
"None"
"str"
]
},
"nsfw": {
Expand Down
7 changes: 7 additions & 0 deletions docs/response_field_names_and_descriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@
}
},
"UserDetailsResponse": {
"active_generations": {
"description": "The active generations this user has requested.",
"types": [
"horde_sdk.ai_horde_api.apimodels._users.ActiveGenerations",
"None"
]
},
"admin_comment": {
"description": "(Privileged) Comments from the horde admins about this user.",
"types": [
Expand Down
2 changes: 2 additions & 0 deletions horde_sdk/ai_horde_api/apimodels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
NewsResponse,
)
from horde_sdk.ai_horde_api.apimodels._users import (
ActiveGenerations,
ContributionsDetails,
ListUsersDetailsRequest,
ListUsersDetailsResponse,
Expand Down Expand Up @@ -181,6 +182,7 @@
"AIHordeGetTermsRequest",
"DocumentFormat",
"HordeDocument",
"ActiveGenerations",
"ContributionsDetails",
"FindUserRequest",
"KudosTransferRequest",
Expand Down
19 changes: 19 additions & 0 deletions horde_sdk/ai_horde_api/apimodels/_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from horde_sdk.ai_horde_api.apimodels.base import BaseAIHordeRequest
from horde_sdk.ai_horde_api.endpoints import AI_HORDE_API_ENDPOINT_SUBPATH
from horde_sdk.ai_horde_api.fields import UUID_Identifier
from horde_sdk.consts import _ANONYMOUS_MODEL, HTTPMethod
from horde_sdk.generic_api.apimodels import (
APIKeyAllowedInRequestMixin,
Expand Down Expand Up @@ -94,6 +95,21 @@ class UsageDetails(HordeAPIDataObject):
"""How many images this user has requested."""


@Unhashable
@Unequatable
class ActiveGenerations(HordeAPIDataObject):
"""A list of generations that are currently active for this user."""

text: list[UUID_Identifier] | None = None
"""The IDs of the text generations that are currently active for this user."""

image: list[UUID_Identifier] | None = None
"""The IDs of the image generations that are currently active for this user."""

alchemy: list[UUID_Identifier] | None = None
"""The IDs of the alchemy generations that are currently active for this user."""


@Unhashable
@Unequatable
class UserDetailsResponse(HordeResponseBaseModel):
Expand All @@ -102,6 +118,9 @@ class UserDetailsResponse(HordeResponseBaseModel):
def get_api_model_name(cls) -> str | None:
return "UserDetails"

active_generations: ActiveGenerations | None = None
"""The active generations this user has requested."""

admin_comment: str | None = Field(
default=None,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"prompt": "a",
"params": {
"sampler_name": "k_dpm_fast",
"sampler_name": "dpmsolver",
"cfg_scale": 7.5,
"denoising_strength": 0.75,
"hires_fix_denoising_strength": 0.75,
"seed": "The little seed that could",
"height": 512,
"width": 512,
Expand Down Expand Up @@ -47,12 +48,15 @@
}
],
"workflow": "qr_code",
"transparent": false,
"steps": 30,
"n": 1
},
"nsfw": false,
"trusted_workers": false,
"validated_backends": true,
"slow_workers": true,
"extra_slow_workers": false,
"censor_nsfw": false,
"workers": [
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"threads": 1,
"require_upfront_kudos": false,
"amount": 1,
"extra_slow_worker": true,
"max_pixels": 262144,
"blacklist": [
""
Expand All @@ -21,5 +22,6 @@
"allow_post_processing": true,
"allow_controlnet": true,
"allow_sdxl_controlnet": true,
"allow_lora": true
"allow_lora": true,
"limit_max_steps": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"softprompt": "a",
"trusted_workers": false,
"validated_backends": true,
"slow_workers": true,
"workers": [
""
Expand All @@ -50,5 +51,6 @@
],
"disable_batching": false,
"allow_downgrade": false,
"webhook": ""
"webhook": "",
"extra_slow_workers": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"threads": 1,
"require_upfront_kudos": false,
"amount": 1,
"extra_slow_worker": true,
"max_length": 512,
"max_context_length": 2048,
"softprompts": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
"sharedkey_ids": [
"00000000-0000-0000-0000-000000000000"
],
"active_generations": {
"text": [
"00000000-0000-0000-0000-000000000000"
],
"image": [
"00000000-0000-0000-0000-000000000000"
],
"alchemy": [
"00000000-0000-0000-0000-000000000000"
]
},
"monthly_kudos": {
"amount": 0,
"last_received": "2021-01-01T00:00:00Z"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"payload": {
"sampler_name": "k_dpmpp_2m",
"sampler_name": "k_dpm_adaptive",
"cfg_scale": 7.5,
"denoising_strength": 0.75,
"hires_fix_denoising_strength": 0.75,
"seed": "The little seed that could",
"height": 512,
"width": 512,
Expand Down Expand Up @@ -46,6 +47,7 @@
}
],
"workflow": "qr_code",
"transparent": false,
"prompt": "",
"ddim_steps": 30,
"n_iter": 1,
Expand All @@ -65,6 +67,7 @@
"bridge_version": 0,
"kudos": 0,
"max_pixels": 0,
"step_count": 0,
"unsafe_ip": 0,
"img2img": 0,
"painting": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
{
"date_published": "",
"newspiece": "",
"importance": "Information"
"importance": "Information",
"tags": [
""
],
"title": "",
"more_info_urls": [
""
]
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
{
{
"username": "",
"id": 0,
"kudos": 0.0,
Expand All @@ -23,6 +23,17 @@
"sharedkey_ids": [
"00000000-0000-0000-0000-000000000000"
],
"active_generations": {
"text": [
"00000000-0000-0000-0000-000000000000"
],
"image": [
"00000000-0000-0000-0000-000000000000"
],
"alchemy": [
"00000000-0000-0000-0000-000000000000"
]
},
"monthly_kudos": {
"amount": 0,
"last_received": "2021-01-01T00:00:00Z"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
"sharedkey_ids": [
"00000000-0000-0000-0000-000000000000"
],
"active_generations": {
"text": [
"00000000-0000-0000-0000-000000000000"
],
"image": [
"00000000-0000-0000-0000-000000000000"
],
"alchemy": [
"00000000-0000-0000-0000-000000000000"
]
},
"monthly_kudos": {
"amount": 0,
"last_received": "2021-01-01T00:00:00Z"
Expand Down

0 comments on commit 372400b

Please sign in to comment.