Skip to content

Commit

Permalink
Merge pull request #134 from Haidra-Org/flux
Browse files Browse the repository at this point in the history
feat: Adds support for extra slow workers and flux
  • Loading branch information
db0 authored Sep 15, 2024
2 parents 2c9d1be + 3396d9f commit 51956cb
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 10 deletions.
26 changes: 17 additions & 9 deletions LucidCreations.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ size_flags_vertical = 3
custom_styles/panel = ExtResource( 39 )

[node name="Prompt" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls"]
visible = false
margin_left = 10.0
margin_top = 10.0
margin_right = 330.0
Expand Down Expand Up @@ -515,6 +516,7 @@ text = "Image is control"

[node name="Basic" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls"]
unique_name_in_owner = true
visible = false
margin_left = 10.0
margin_top = 10.0
margin_right = 330.0
Expand Down Expand Up @@ -1232,17 +1234,16 @@ margin_bottom = 400.0

[node name="Options" type="MarginContainer" parent="Margin/Panel/Display/Panels/Controls"]
unique_name_in_owner = true
visible = false
margin_left = 10.0
margin_top = 10.0
margin_right = 330.0
margin_bottom = 450.0
margin_bottom = 486.0
rect_min_size = Vector2( 320, 0 )
script = ExtResource( 11 )

[node name="VBC" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls/Options"]
margin_right = 320.0
margin_bottom = 440.0
margin_bottom = 476.0
custom_constants/separation = 8

[node name="VBCRight" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls/Options/VBC"]
Expand Down Expand Up @@ -1298,7 +1299,7 @@ selection_enabled = true
[node name="VBCLeft" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls/Options/VBC"]
margin_top = 103.0
margin_right = 320.0
margin_bottom = 440.0
margin_bottom = 476.0
size_flags_horizontal = 3
custom_constants/separation = 8

Expand Down Expand Up @@ -1401,19 +1402,26 @@ margin_right = 320.0
margin_bottom = 301.0
text = "Recover Saved Seeds"

[node name="ExtraSlowWorkers" type="CheckButton" parent="Margin/Panel/Display/Panels/Controls/Options/VBC/VBCLeft"]
unique_name_in_owner = true
margin_top = 309.0
margin_right = 320.0
margin_bottom = 337.0
text = "Extra Slow Workers"

[node name="Shared" type="CheckButton" parent="Margin/Panel/Display/Panels/Controls/Options/VBC/VBCLeft"]
unique_name_in_owner = true
visible = false
margin_top = 325.0
margin_right = 507.0
margin_bottom = 385.251
margin_top = 309.0
margin_right = 320.0
margin_bottom = 337.0
text = "Share Images"

[node name="WipeCache" type="Button" parent="Margin/Panel/Display/Panels/Controls/Options/VBC/VBCLeft"]
unique_name_in_owner = true
margin_top = 309.0
margin_top = 345.0
margin_right = 320.0
margin_bottom = 337.0
margin_bottom = 373.0
text = "Wipe CivitAI Cache"

[node name="Information" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls"]
Expand Down
6 changes: 6 additions & 0 deletions Options.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ onready var load_seed_from_disk = $"%LoadSeedFromDisk"
onready var wipe_cache = $"%WipeCache"
onready var allow_downgrade = $"%AllowDowngrade"
onready var use_godot_browse = $"%UseGodotBrowse"
onready var extra_slow_workers = $"%ExtraSlowWorkers"

func _ready():
remember_prompt.pressed = globals.config.get_value("Options", "remember_prompt", false)
Expand All @@ -21,6 +22,8 @@ func _ready():
larger_values.connect("toggled",self,"_on_larger_values_pressed")
allow_downgrade.pressed = globals.config.get_value("Options", "allow_downgrade", true)
allow_downgrade.connect("toggled",self,"_on_allow_downgrade_pressed")
extra_slow_workers.pressed = globals.config.get_value("Options", "extra_slow_workers", false)
extra_slow_workers.connect("toggled",self,"_on_extra_slow_workers_pressed")
load_seed_from_disk.pressed = globals.config.get_value("Options", "load_seed_from_disk", false)
load_seed_from_disk.connect("toggled",self,"_on_load_seed_from_disk_pressed")
use_godot_browse.pressed = globals.config.get_value("Options", "use_godot_browse", false)
Expand Down Expand Up @@ -63,6 +66,9 @@ func _on_larger_values_pressed(pressed: bool) -> void:
func _on_allow_downgrade_pressed(pressed: bool) -> void:
globals.set_setting("allow_downgrade", pressed, "Options")

func _on_extra_slow_workers_pressed(pressed: bool) -> void:
globals.set_setting("extra_slow_workers", pressed, "Options")

func _on_load_seed_from_disk_pressed(pressed: bool) -> void:
globals.set_setting("load_seed_from_disk", pressed, "Options")

Expand Down
1 change: 1 addition & 0 deletions PopupInfoPanel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const DESCRIPTIONS = {
"WorkerAutoComplete": "Specify workers to use for this generation. Use the toggle below to specify using them as an allowlist or a blocklist. When models are selected, only workers which can generate any of those models will be shown.",
"ShowAllWorkers": "Press this button to display and select available workers for your selected model.",
"AllowDowngrade": "When enabled and your account doesn't have enough kudos to generate the image, it will be downgraded in resolution and steps, so that it does not need upfront kudos, instead of failing.",
"ExtraSlowWorkers": "When enabled, the horde will also allow your request to be picked up by workers which have self-labeled as extra slow and might take up to 3 times as usual to complete the request. Use this option if you're not in a rush for the images.",
"UseGodotBrowse": "When enabled instead of using your OS' native browse dialog, it will use Godot Engine's built-in node.",
# Control Buttons
"Prompt": "Prompt: This tab allows you to specify the prompt which will generate the image",
Expand Down
2 changes: 2 additions & 0 deletions StableHordeClient.gd
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ func _connect_hover_signals() -> void:
$"%WorkerAutoComplete",
$"%ShowAllWorkers",
$"%AllowDowngrade",
$"%ExtraSlowWorkers",
$"%GenerateButton",
$"%GenerateFooterButton",
$"%CancelButton",
Expand Down Expand Up @@ -706,6 +707,7 @@ func _accept_settings() -> void:
globals.set_setting("trusted_workers", trusted_workers.pressed)
stable_horde_client.set("shared", globals.config.get_value("Options", "share", true))
stable_horde_client.set("allow_downgrade", globals.config.get_value("Options", "allow_downgrade", true))
stable_horde_client.set("extra_slow_workers", globals.config.get_value("Options", "extra_slow_workers", true))
stable_horde_client.set("gen_seed", seed_edit.text)
stable_horde_client.set("post_processing", globals.config.get_value("Parameters", "post_processing", stable_horde_client.post_processing))
stable_horde_client.set("lora", globals.config.get_value("Parameters", "loras", stable_horde_client.lora))
Expand Down
2 changes: 2 additions & 0 deletions addons/stable_horde_client/stable_horde_client.gd
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export(bool) var replacement_filter := true
export(Array) var workers := []
export(bool) var worker_blacklist := false
export(bool) var allow_downgrade := false
export(bool) var extra_slow_workers := false
export(bool) var transparent := false
export(String, "auto-detect", "qr_code") var workflow := "auto-detect"
export(Array) var extra_texts = []
Expand Down Expand Up @@ -172,6 +173,7 @@ func generate(replacement_prompt := '', replacement_params := {}) -> void:
"workers": workers,
"worker_blacklist": worker_blacklist,
"allow_downgrade": allow_downgrade,
"extra_slow_workers": extra_slow_workers,
"replacement_filter": replacement_filter
# "workers": [
# "dc0704ab-5b42-4c65-8471-561be16ad696", #portal
Expand Down
2 changes: 1 addition & 1 deletion addons/stable_horde_client/stable_horde_model_reference.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends StableHordeHTTPRequest

signal reference_retrieved(models_list)

export(String) var compvis_refence_url := "https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/stable_diffusion.json"
export(String) var compvis_refence_url := "https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/flux/stable_diffusion.json"
export(String) var diffusers_refence_url := "https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/diffusers.json"

var model_reference := {}
Expand Down
2 changes: 2 additions & 0 deletions src/Lora/Lora.gd
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ func check_baseline_compatibility(version_id: String) -> int:
"SD 1.5": "stable diffusion 1",
"SD 2.1 768": "stable diffusion 2",
"SD 2.1 512": "stable diffusion 2",
"Flux.1 D": "flux_1",
"Flux.1 S": "flux_1",
"Other": null,
}
var lora_details := lora_reference_node.get_lora_info(version_id, true)
Expand Down
2 changes: 2 additions & 0 deletions src/Lora/TextualInversion.gd
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ func check_baseline_compatibility(ti_name) -> int:
"SD 1.5": "stable diffusion 1",
"SD 2.1 768": "stable diffusion 2",
"SD 2.1 512": "stable diffusion 2",
"Flux.1 D": "flux_1",
"Flux.1 S": "flux_1",
"Other": null,
}
var ti_baseline = ti_to_model_baseline_map[ti_reference_node.get_ti_info(ti_name)["base_model"]]
Expand Down

0 comments on commit 51956cb

Please sign in to comment.