Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advanced params refactoring + prevent users from skipping/stopping other users tasks in queue #981

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d3f9156
only make stop_button and skip_button interactive when rendering proc…
mashb1t Nov 18, 2023
617255d
use AsyncTask for last_stop handling instead of shared
mashb1t Nov 18, 2023
83efbbd
Revert "only make stop_button and skip_button interactive when render…
mashb1t Nov 18, 2023
ebad9ea
introduce state for task skipping/stopping
mashb1t Nov 18, 2023
8060e50
fix return parameters of stop_clicked
mashb1t Nov 18, 2023
4a576bf
code cleanup, do not disable skip/stop on stop_clicked
mashb1t Nov 18, 2023
d2cc9a4
reset last_stop when skipping for further processing
mashb1t Nov 19, 2023
8acb2d7
Merge branch 'main_upstream' into hotfix/prevent-skipping-and-stoppin…
mashb1t Nov 20, 2023
d2e2540
Merge branch 'lllyasviel:main' into hotfix/prevent-skipping-and-stopp…
mashb1t Nov 21, 2023
5496ec4
Merge remote-tracking branch 'upstream/main' into hotfix/prevent-skip…
mashb1t Dec 14, 2023
0ab7dd0
Merge branch 'main_upstream' into hotfix/prevent-skipping-and-stoppin…
mashb1t Dec 27, 2023
ee3d70a
fix: replace fcbh with ldm_patched
mashb1t Jan 4, 2024
e68c8aa
Merge branch 'main_upstream' into hotfix/prevent-skipping-and-stoppin…
mashb1t Jan 4, 2024
04ba160
fix: use currentTask instead of ctrls after merging upstream
mashb1t Jan 4, 2024
79a6349
feat: extract attribute disable_preview
mashb1t Jan 22, 2024
3607059
feat: extract attribute adm_scaler_positive
mashb1t Jan 22, 2024
64dcdbb
feat: extract attribute adm_scaler_negative
mashb1t Jan 22, 2024
618b017
feat: extract attribute adm_scaler_end
mashb1t Jan 22, 2024
fc3da75
feat: extract attribute adaptive_cfg
mashb1t Jan 22, 2024
e54bad8
feat: extract attribute sampler_name
mashb1t Jan 22, 2024
d72573a
feat: extract attribute scheduler_name
mashb1t Jan 22, 2024
217be19
feat: extract attribute generate_image_grid
mashb1t Jan 22, 2024
df35033
feat: extract attribute overwrite_step
mashb1t Jan 22, 2024
2b1f501
feat: extract attribute overwrite_switch
mashb1t Jan 22, 2024
2eed5a2
feat: extract attribute overwrite_width
mashb1t Jan 22, 2024
9f4a00e
feat: extract attribute overwrite_height
mashb1t Jan 22, 2024
22af976
feat: extract attribute overwrite_vary_strength
mashb1t Jan 22, 2024
2ab5593
feat: extract attribute overwrite_upscale_strength
mashb1t Jan 22, 2024
cce9871
feat: extract attribute mixing_image_prompt_and_vary_upscale
mashb1t Jan 22, 2024
6289e5d
feat: extract attribute mixing_image_prompt_and_inpaint
mashb1t Jan 22, 2024
0bf4159
feat: extract attribute debugging_cn_preprocessor
mashb1t Jan 22, 2024
9f194a9
feat: extract attribute skipping_cn_preprocessor
mashb1t Jan 22, 2024
ec48644
feat: extract attribute canny_low_threshold
mashb1t Jan 22, 2024
2d8ca41
feat: extract attribute canny_high_threshold
mashb1t Jan 22, 2024
cfb70c0
feat: extract attribute refiner_swap_method
mashb1t Jan 22, 2024
eb1d393
feat: extract freeu_ctrls attributes
mashb1t Jan 22, 2024
4ce27ae
feat: extract inpaint_ctrls attributes
mashb1t Jan 22, 2024
18446dc
wip: add TODOs
mashb1t Jan 22, 2024
78d2ec8
chore: cleanup code
mashb1t Jan 22, 2024
f3222b0
feat: extract attribute controlnet_softness
mashb1t Jan 22, 2024
177075f
feat: extract remaining attributes, do not use globals in patch
mashb1t Jan 22, 2024
21f4767
fix: resolve circular import, patch_all now in async_worker
mashb1t Jan 22, 2024
031b1f8
chore: cleanup pid code
mashb1t Jan 22, 2024
148eddf
Merge branch 'feature/extract-advanced-parameters' into hotfix/preven…
mashb1t Jan 22, 2024
7ebd2cc
Merge branch 'main_upstream' into hotfix/prevent-skipping-and-stoppin…
mashb1t Feb 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions extras/preprocessors.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import cv2
import numpy as np
import modules.advanced_parameters as advanced_parameters


def centered_canny(x: np.ndarray):
def centered_canny(x: np.ndarray, canny_low_threshold, canny_high_threshold):
assert isinstance(x, np.ndarray)
assert x.ndim == 2 and x.dtype == np.uint8

y = cv2.Canny(x, int(advanced_parameters.canny_low_threshold), int(advanced_parameters.canny_high_threshold))
y = cv2.Canny(x, int(canny_low_threshold), int(canny_high_threshold))
y = y.astype(np.float32) / 255.0
return y


def centered_canny_color(x: np.ndarray):
def centered_canny_color(x: np.ndarray, canny_low_threshold, canny_high_threshold):
assert isinstance(x, np.ndarray)
assert x.ndim == 3 and x.shape[2] == 3

result = [centered_canny(x[..., i]) for i in range(3)]
result = [centered_canny(x[..., i], canny_low_threshold, canny_high_threshold) for i in range(3)]
result = np.stack(result, axis=2)
return result


def pyramid_canny_color(x: np.ndarray):
def pyramid_canny_color(x: np.ndarray, canny_low_threshold, canny_high_threshold):
assert isinstance(x, np.ndarray)
assert x.ndim == 3 and x.shape[2] == 3

Expand All @@ -31,7 +30,7 @@ def pyramid_canny_color(x: np.ndarray):
for k in [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]:
Hs, Ws = int(H * k), int(W * k)
small = cv2.resize(x, (Ws, Hs), interpolation=cv2.INTER_AREA)
edge = centered_canny_color(small)
edge = centered_canny_color(small, canny_low_threshold, canny_high_threshold)
if acc_edge is None:
acc_edge = edge
else:
Expand All @@ -54,11 +53,11 @@ def norm255(x, low=4, high=96):
return x * 255.0


def canny_pyramid(x):
def canny_pyramid(x, canny_low_threshold, canny_high_threshold):
# For some reasons, SAI's Control-lora Canny seems to be trained on canny maps with non-standard resolutions.
# Then we use pyramid to use all resolutions to avoid missing any structure in specific resolutions.

color_canny = pyramid_canny_color(x)
color_canny = pyramid_canny_color(x, canny_low_threshold, canny_high_threshold)
result = np.sum(color_canny, axis=2)

return norm255(result, low=1, high=99).clip(0, 255).astype(np.uint8)
Expand Down
33 changes: 0 additions & 33 deletions modules/advanced_parameters.py

This file was deleted.

Loading