bridge_data
The bridge data file definitions and functions for any horde worker type.
ALL_DATA_FILES_TYPES
module-attribute
ALL_DATA_FILES_TYPES: list[type[BaseModel]] = [
SharedHordeBridgeData,
ImageWorkerBridgeData,
ScribeBridgeData,
CombinedHordeBridgeData,
]
MetaInstruction
Bases: StrEnum
Model load instructions which requiring further processing to resolve.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
ALL_INPAINTING_REGEX
class-attribute
instance-attribute
TOP_N_REGEX
class-attribute
instance-attribute
The regex to use to match the top N models. The number is in a capture group on its own.
BaseHordeBridgeData
Bases: BaseModel
The base bridge data file for all worker types.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_extra_params_warning
Warn on extra parameters being passed.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
SharedHordeBridgeData
Bases: BaseHordeBridgeData
The base bridge data file for all worker types.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
api_key
class-attribute
instance-attribute
The API key to use to authenticate with the Horde API. Defaults to the anonymous API key.
default_worker_name
class-attribute
instance-attribute
The default name for any worker type. This is used to easily identify the worker.
Note that if the user switches to a different worker type after having run a different worker type, the name will be rejected by the Horde API. This is because the name is unique to the worker type.
models_folder_parent
class-attribute
instance-attribute
The directories to use to store the model folders. The spirit of this derives from XDG_CACHE_HOME, but it is
not a volatile cache. It is the ordinary location for the models. Defaults to the current working directory.
temp_dir
class-attribute
instance-attribute
The directory to use for temporary files such as model caches. Defaults to ./tmp/.
allow_unsafe_ip
class-attribute
instance-attribute
Whether to allow img2img from unsafe IP addresses. This is only relevant if img2img is enabled.
priority_usernames
class-attribute
instance-attribute
A list of usernames to prioritize. The API always considers this worker's user to be on this list.
stats_output_frequency
class-attribute
instance-attribute
The frequency at which to output stats to the console, in seconds. Set to 0 to disable.
disable_terminal_ui
class-attribute
instance-attribute
Whether to disable the terminal UI. This is useful for running the worker in a container.
always_download
class-attribute
instance-attribute
Whether to always download models, without prompting for permission for each one.
suppress_speed_warnings
class-attribute
instance-attribute
Whether to suppress warnings about slower than ideal generations.
horde_url
class-attribute
instance-attribute
The URL of the Horde API to use. Defaults to the official API.
validate_url
Validate the URL is valid.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_api_key_length
Validate that the API key is the correct length.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_is_dir
Validate that the path is a directory.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_extra_params_warning
Warn on extra parameters being passed.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
ImageWorkerBridgeData
Bases: SharedHordeBridgeData
The bridge data file for a Dreamer or Alchemist worker.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
extra_stable_diffusion_models_folders
class-attribute
instance-attribute
A list of extra folders to search for stable diffusion models.
allow_controlnet
class-attribute
instance-attribute
Whether to allow the use of ControlNet. This requires img2img to be enabled.
allow_sdxl_controlnet
class-attribute
instance-attribute
Whether to allow the use of SDXL ControlNet. This requires controlnet to be enabled.
allow_img2img
class-attribute
instance-attribute
Whether to allow the use of img2img.
allow_lora
class-attribute
instance-attribute
Whether to allow the use of LoRA.
extra_slow_worker
class-attribute
instance-attribute
Marks the worker as extra slow.
limit_max_steps
class-attribute
instance-attribute
Prevents the worker picking up jobs with more steps than the model average.
max_lora_cache_size
class-attribute
instance-attribute
The maximum size of the LoRA cache, in gigabytes.
allow_inpainting
class-attribute
instance-attribute
Whether to allow the use of inpainting.
allow_post_processing
class-attribute
instance-attribute
Whether to allow the use of post-processing.
blacklist
class-attribute
instance-attribute
A list of terms or phrases to blacklist. Jobs containing these terms will be not be assigned to this worker.
censor_nsfw
class-attribute
instance-attribute
Whether to censor NSFW content.
censorlist
class-attribute
instance-attribute
A list of terms to allow through the censor. Jobs containing these terms will not be censored for those words alone.
disable_disk_cache
class-attribute
instance-attribute
Whether to disable the disk cache.
dreamer_worker_name
class-attribute
instance-attribute
dynamic_models
class-attribute
instance-attribute
Whether to dynamically switch the models loaded to correspond to the models with the longest queues.
max_dynamic_models_to_download
class-attribute
instance-attribute
max_dynamic_models_to_download: int = Field(
default=10,
ge=0,
le=_UNREASONABLE_NUMBER_OF_MODELS,
alias="max_models_to_download",
)
The maximum number of models to download.
number_of_dynamic_models_to_load
class-attribute
instance-attribute
number_of_dynamic_models_to_load: int = Field(
default=1,
ge=0,
le=_UNREASONABLE_NUMBER_OF_MODELS,
alias="number_of_dynamic_models",
)
The number of dynamic models to load at a time.
max_power
class-attribute
instance-attribute
max_power: int = Field(
default=8,
ge=1,
le=512,
json_schema_extra={"unit": "* (8 * 64 * 64) pixels"},
)
The factor in the equation max_power * (8 * 64 * 64). This will be the maximum number of pixels that can be
generated (with inference) in a single job by this worker.
max_pixels
property
Calculate the maximum number of pixels that can be generated in a single job by this worker.
image_models_to_load
class-attribute
instance-attribute
A list of models to load. This can be a list of model names, or a list of model loading instructions, such as
top 100 or all models.
image_models_to_skip
class-attribute
instance-attribute
When a meta model loading instruction is given, like top 100, models in this list will be skipped.
queue_size
class-attribute
instance-attribute
The number of jobs to queue.
max_threads
class-attribute
instance-attribute
The number of threads to use for inference.
max_batch
class-attribute
instance-attribute
The number of threads to use for inference.
require_upfront_kudos
class-attribute
instance-attribute
Whether to require upfront kudos for jobs. This effectively makes the worker reject jobs from the anonymous API key, or from keys with no kudos.
ram_to_leave_free
class-attribute
instance-attribute
ram_to_leave_free: str = Field(
default="80%",
pattern="^\\d+%$|^\\d+$",
json_schema_extra={"unit": "Percent or MB"},
)
The amount of RAM to leave free for the system to use. This is a percentage or a number in megabytes.
vram_to_leave_free
class-attribute
instance-attribute
vram_to_leave_free: str | None = Field(
default="80%",
pattern="^\\d+%$|^\\d+$",
json_schema_extra={"unit": "Percent or MB"},
)
The amount of VRAM to leave free for the system to use. This is a percentage or a number in megabytes.
alchemist_name
class-attribute
instance-attribute
The name of the worker if it is an alchemist. This is used to easily identify the worker.
forms
class-attribute
instance-attribute
The type of services or processing an alchemist worker will provide.
meta_load_instructions
property
The meta load instructions.
meta_skip_instructions
property
The meta skip instructions.
api_key
class-attribute
instance-attribute
The API key to use to authenticate with the Horde API. Defaults to the anonymous API key.
default_worker_name
class-attribute
instance-attribute
The default name for any worker type. This is used to easily identify the worker.
Note that if the user switches to a different worker type after having run a different worker type, the name will be rejected by the Horde API. This is because the name is unique to the worker type.
models_folder_parent
class-attribute
instance-attribute
The directories to use to store the model folders. The spirit of this derives from XDG_CACHE_HOME, but it is
not a volatile cache. It is the ordinary location for the models. Defaults to the current working directory.
temp_dir
class-attribute
instance-attribute
The directory to use for temporary files such as model caches. Defaults to ./tmp/.
allow_unsafe_ip
class-attribute
instance-attribute
Whether to allow img2img from unsafe IP addresses. This is only relevant if img2img is enabled.
priority_usernames
class-attribute
instance-attribute
A list of usernames to prioritize. The API always considers this worker's user to be on this list.
stats_output_frequency
class-attribute
instance-attribute
The frequency at which to output stats to the console, in seconds. Set to 0 to disable.
disable_terminal_ui
class-attribute
instance-attribute
Whether to disable the terminal UI. This is useful for running the worker in a container.
always_download
class-attribute
instance-attribute
Whether to always download models, without prompting for permission for each one.
suppress_speed_warnings
class-attribute
instance-attribute
Whether to suppress warnings about slower than ideal generations.
horde_url
class-attribute
instance-attribute
The URL of the Horde API to use. Defaults to the official API.
default_forms
Set the default forms if none are specified.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_model
Validate that the parameters are not conflicting and make any fixed adjustments.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
handle_meta_instructions
Handle the meta instructions by resolving and applying them.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
handle_meta_skip_instructions
Handle the meta skip instructions by resolving and applying them.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_models_to_load
Validate and parse the models to load.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_ram_to_leave_free
Validate VRAM/RAM to leave free.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_alchemy_forms
Validate the alchemy forms (services offered).
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_extra_params_warning
Warn on extra parameters being passed.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_url
Validate the URL is valid.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_api_key_length
Validate that the API key is the correct length.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_is_dir
Validate that the path is a directory.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
ScribeBridgeData
Bases: SharedHordeBridgeData
The bridge data file subset for a Scribe worker.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
kai_url
class-attribute
instance-attribute
The URL of the KoboldAI API to use. Defaults to the official API.
max_context_length
class-attribute
instance-attribute
max_context_length: int = Field(
default=1024,
ge=1,
le=16384,
json_schema_extra={"unit": "tokens"},
)
The maximum number of tokens to use for context with a scribe job.
max_length
class-attribute
instance-attribute
The maximum number of tokens to generate for a scribe job.
branded_model
class-attribute
instance-attribute
If true, this is a custom scribe model, and the horde API will identify uniquely to this worker's API key.
api_key
class-attribute
instance-attribute
The API key to use to authenticate with the Horde API. Defaults to the anonymous API key.
default_worker_name
class-attribute
instance-attribute
The default name for any worker type. This is used to easily identify the worker.
Note that if the user switches to a different worker type after having run a different worker type, the name will be rejected by the Horde API. This is because the name is unique to the worker type.
models_folder_parent
class-attribute
instance-attribute
The directories to use to store the model folders. The spirit of this derives from XDG_CACHE_HOME, but it is
not a volatile cache. It is the ordinary location for the models. Defaults to the current working directory.
temp_dir
class-attribute
instance-attribute
The directory to use for temporary files such as model caches. Defaults to ./tmp/.
allow_unsafe_ip
class-attribute
instance-attribute
Whether to allow img2img from unsafe IP addresses. This is only relevant if img2img is enabled.
priority_usernames
class-attribute
instance-attribute
A list of usernames to prioritize. The API always considers this worker's user to be on this list.
stats_output_frequency
class-attribute
instance-attribute
The frequency at which to output stats to the console, in seconds. Set to 0 to disable.
disable_terminal_ui
class-attribute
instance-attribute
Whether to disable the terminal UI. This is useful for running the worker in a container.
always_download
class-attribute
instance-attribute
Whether to always download models, without prompting for permission for each one.
suppress_speed_warnings
class-attribute
instance-attribute
Whether to suppress warnings about slower than ideal generations.
horde_url
class-attribute
instance-attribute
The URL of the Horde API to use. Defaults to the official API.
validate_extra_params_warning
Warn on extra parameters being passed.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_url
Validate the URL is valid.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_api_key_length
Validate that the API key is the correct length.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_is_dir
Validate that the path is a directory.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
CombinedHordeBridgeData
Bases: ImageWorkerBridgeData, ScribeBridgeData
The bridge data file for a worker bridge that supports all worker types.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
api_key
class-attribute
instance-attribute
The API key to use to authenticate with the Horde API. Defaults to the anonymous API key.
default_worker_name
class-attribute
instance-attribute
The default name for any worker type. This is used to easily identify the worker.
Note that if the user switches to a different worker type after having run a different worker type, the name will be rejected by the Horde API. This is because the name is unique to the worker type.
models_folder_parent
class-attribute
instance-attribute
The directories to use to store the model folders. The spirit of this derives from XDG_CACHE_HOME, but it is
not a volatile cache. It is the ordinary location for the models. Defaults to the current working directory.
temp_dir
class-attribute
instance-attribute
The directory to use for temporary files such as model caches. Defaults to ./tmp/.
allow_unsafe_ip
class-attribute
instance-attribute
Whether to allow img2img from unsafe IP addresses. This is only relevant if img2img is enabled.
priority_usernames
class-attribute
instance-attribute
A list of usernames to prioritize. The API always considers this worker's user to be on this list.
stats_output_frequency
class-attribute
instance-attribute
The frequency at which to output stats to the console, in seconds. Set to 0 to disable.
disable_terminal_ui
class-attribute
instance-attribute
Whether to disable the terminal UI. This is useful for running the worker in a container.
always_download
class-attribute
instance-attribute
Whether to always download models, without prompting for permission for each one.
suppress_speed_warnings
class-attribute
instance-attribute
Whether to suppress warnings about slower than ideal generations.
horde_url
class-attribute
instance-attribute
The URL of the Horde API to use. Defaults to the official API.
kai_url
class-attribute
instance-attribute
The URL of the KoboldAI API to use. Defaults to the official API.
max_context_length
class-attribute
instance-attribute
max_context_length: int = Field(
default=1024,
ge=1,
le=16384,
json_schema_extra={"unit": "tokens"},
)
The maximum number of tokens to use for context with a scribe job.
max_length
class-attribute
instance-attribute
The maximum number of tokens to generate for a scribe job.
branded_model
class-attribute
instance-attribute
If true, this is a custom scribe model, and the horde API will identify uniquely to this worker's API key.
extra_stable_diffusion_models_folders
class-attribute
instance-attribute
A list of extra folders to search for stable diffusion models.
allow_controlnet
class-attribute
instance-attribute
Whether to allow the use of ControlNet. This requires img2img to be enabled.
allow_sdxl_controlnet
class-attribute
instance-attribute
Whether to allow the use of SDXL ControlNet. This requires controlnet to be enabled.
allow_img2img
class-attribute
instance-attribute
Whether to allow the use of img2img.
allow_lora
class-attribute
instance-attribute
Whether to allow the use of LoRA.
extra_slow_worker
class-attribute
instance-attribute
Marks the worker as extra slow.
limit_max_steps
class-attribute
instance-attribute
Prevents the worker picking up jobs with more steps than the model average.
max_lora_cache_size
class-attribute
instance-attribute
The maximum size of the LoRA cache, in gigabytes.
allow_inpainting
class-attribute
instance-attribute
Whether to allow the use of inpainting.
allow_post_processing
class-attribute
instance-attribute
Whether to allow the use of post-processing.
blacklist
class-attribute
instance-attribute
A list of terms or phrases to blacklist. Jobs containing these terms will be not be assigned to this worker.
censor_nsfw
class-attribute
instance-attribute
Whether to censor NSFW content.
censorlist
class-attribute
instance-attribute
A list of terms to allow through the censor. Jobs containing these terms will not be censored for those words alone.
disable_disk_cache
class-attribute
instance-attribute
Whether to disable the disk cache.
dreamer_worker_name
class-attribute
instance-attribute
dynamic_models
class-attribute
instance-attribute
Whether to dynamically switch the models loaded to correspond to the models with the longest queues.
max_dynamic_models_to_download
class-attribute
instance-attribute
max_dynamic_models_to_download: int = Field(
default=10,
ge=0,
le=_UNREASONABLE_NUMBER_OF_MODELS,
alias="max_models_to_download",
)
The maximum number of models to download.
number_of_dynamic_models_to_load
class-attribute
instance-attribute
number_of_dynamic_models_to_load: int = Field(
default=1,
ge=0,
le=_UNREASONABLE_NUMBER_OF_MODELS,
alias="number_of_dynamic_models",
)
The number of dynamic models to load at a time.
max_power
class-attribute
instance-attribute
max_power: int = Field(
default=8,
ge=1,
le=512,
json_schema_extra={"unit": "* (8 * 64 * 64) pixels"},
)
The factor in the equation max_power * (8 * 64 * 64). This will be the maximum number of pixels that can be
generated (with inference) in a single job by this worker.
max_pixels
property
Calculate the maximum number of pixels that can be generated in a single job by this worker.
image_models_to_load
class-attribute
instance-attribute
A list of models to load. This can be a list of model names, or a list of model loading instructions, such as
top 100 or all models.
image_models_to_skip
class-attribute
instance-attribute
When a meta model loading instruction is given, like top 100, models in this list will be skipped.
queue_size
class-attribute
instance-attribute
The number of jobs to queue.
max_threads
class-attribute
instance-attribute
The number of threads to use for inference.
max_batch
class-attribute
instance-attribute
The number of threads to use for inference.
require_upfront_kudos
class-attribute
instance-attribute
Whether to require upfront kudos for jobs. This effectively makes the worker reject jobs from the anonymous API key, or from keys with no kudos.
ram_to_leave_free
class-attribute
instance-attribute
ram_to_leave_free: str = Field(
default="80%",
pattern="^\\d+%$|^\\d+$",
json_schema_extra={"unit": "Percent or MB"},
)
The amount of RAM to leave free for the system to use. This is a percentage or a number in megabytes.
vram_to_leave_free
class-attribute
instance-attribute
vram_to_leave_free: str | None = Field(
default="80%",
pattern="^\\d+%$|^\\d+$",
json_schema_extra={"unit": "Percent or MB"},
)
The amount of VRAM to leave free for the system to use. This is a percentage or a number in megabytes.
alchemist_name
class-attribute
instance-attribute
The name of the worker if it is an alchemist. This is used to easily identify the worker.
forms
class-attribute
instance-attribute
The type of services or processing an alchemist worker will provide.
meta_load_instructions
property
The meta load instructions.
meta_skip_instructions
property
The meta skip instructions.
validate_extra_params_warning
Warn on extra parameters being passed.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_url
Validate the URL is valid.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_api_key_length
Validate that the API key is the correct length.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_is_dir
Validate that the path is a directory.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
default_forms
Set the default forms if none are specified.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_model
Validate that the parameters are not conflicting and make any fixed adjustments.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
handle_meta_instructions
Handle the meta instructions by resolving and applying them.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
handle_meta_skip_instructions
Handle the meta skip instructions by resolving and applying them.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_models_to_load
Validate and parse the models to load.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_ram_to_leave_free
Validate VRAM/RAM to leave free.
Source code in horde_sdk/worker/dispatch/ai_horde/bridge_data.py
validate_alchemy_forms
Validate the alchemy forms (services offered).