Update sd-webui-progressive-growing/scripts/progressive_growing_always.py
Browse files
sd-webui-progressive-growing/scripts/progressive_growing_always.py
CHANGED
|
@@ -655,7 +655,17 @@ def _stage_sample_txt2img(p, x, conditioning, unconditional_conditioning,
|
|
| 655 |
_call_script_hooks(p, x)
|
| 656 |
_rewrap_scheduler_override_for_stage(p, stage_w, stage_h)
|
| 657 |
try:
|
| 658 |
-
getattr(p.sampler, 'sampler_extra_args', {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 659 |
except Exception:
|
| 660 |
pass
|
| 661 |
_patch_sampler_func_sigmas_to_1d(p)
|
|
@@ -676,6 +686,18 @@ def _stage_sample_txt2img(p, x, conditioning, unconditional_conditioning,
|
|
| 676 |
with _stage_sampler_context(p, stage_w, stage_h):
|
| 677 |
p.sampler_noise_scheduler_override = None
|
| 678 |
_call_script_hooks(p, x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 679 |
return p.sampler.sample(
|
| 680 |
p, x, conditioning, unconditional_conditioning,
|
| 681 |
image_conditioning=image_cond,
|
|
@@ -697,7 +719,10 @@ def _stage_sample_img2img(p, samples, noise, conditioning, unconditional_conditi
|
|
| 697 |
_call_script_hooks(p, samples)
|
| 698 |
_rewrap_scheduler_override_for_stage(p, stage_w, stage_h)
|
| 699 |
try:
|
| 700 |
-
getattr(p.sampler, 'sampler_extra_args', {})
|
|
|
|
|
|
|
|
|
|
| 701 |
except Exception:
|
| 702 |
pass
|
| 703 |
_patch_sampler_func_sigmas_to_1d(p)
|
|
@@ -713,6 +738,13 @@ def _stage_sample_img2img(p, samples, noise, conditioning, unconditional_conditi
|
|
| 713 |
with _stage_sampler_context(p, stage_w, stage_h):
|
| 714 |
p.sampler_noise_scheduler_override = None
|
| 715 |
_call_script_hooks(p, samples)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 716 |
return p.sampler.sample_img2img(
|
| 717 |
p, samples, noise,
|
| 718 |
conditioning, unconditional_conditioning,
|
|
|
|
| 655 |
_call_script_hooks(p, x)
|
| 656 |
_rewrap_scheduler_override_for_stage(p, stage_w, stage_h)
|
| 657 |
try:
|
| 658 |
+
extra = getattr(p.sampler, 'sampler_extra_args', {})
|
| 659 |
+
if isinstance(extra, dict):
|
| 660 |
+
extra.pop('sigmas', None)
|
| 661 |
+
# noise_sampler may have been built from full-size p.x by
|
| 662 |
+
# a previous initialize() call (e.g. adept-sampler-v5 stores
|
| 663 |
+
# the original and passes it through). Removing it here
|
| 664 |
+
# forces A1111's initialize() to recreate it from the
|
| 665 |
+
# stage-sized p.x that _stage_sampler_context set up,
|
| 666 |
+
# preventing "size of tensor a (26) must match tensor b (104)"
|
| 667 |
+
# in ancestral / TCD steps.
|
| 668 |
+
extra.pop('noise_sampler', None)
|
| 669 |
except Exception:
|
| 670 |
pass
|
| 671 |
_patch_sampler_func_sigmas_to_1d(p)
|
|
|
|
| 686 |
with _stage_sampler_context(p, stage_w, stage_h):
|
| 687 |
p.sampler_noise_scheduler_override = None
|
| 688 |
_call_script_hooks(p, x)
|
| 689 |
+
# For standard samplers the sampler object is reused across stages.
|
| 690 |
+
# A1111's initialize() may skip recreating noise_sampler if it is
|
| 691 |
+
# already present in sampler_extra_args (built from full-size p.x
|
| 692 |
+
# on the first call). Drop it here so initialize() always builds a
|
| 693 |
+
# fresh one from the stage-sized p.x set by _stage_sampler_context.
|
| 694 |
+
try:
|
| 695 |
+
extra = getattr(p.sampler, 'sampler_extra_args', {})
|
| 696 |
+
if isinstance(extra, dict):
|
| 697 |
+
extra.pop('sigmas', None)
|
| 698 |
+
extra.pop('noise_sampler', None)
|
| 699 |
+
except Exception:
|
| 700 |
+
pass
|
| 701 |
return p.sampler.sample(
|
| 702 |
p, x, conditioning, unconditional_conditioning,
|
| 703 |
image_conditioning=image_cond,
|
|
|
|
| 719 |
_call_script_hooks(p, samples)
|
| 720 |
_rewrap_scheduler_override_for_stage(p, stage_w, stage_h)
|
| 721 |
try:
|
| 722 |
+
extra = getattr(p.sampler, 'sampler_extra_args', {})
|
| 723 |
+
if isinstance(extra, dict):
|
| 724 |
+
extra.pop('sigmas', None)
|
| 725 |
+
extra.pop('noise_sampler', None)
|
| 726 |
except Exception:
|
| 727 |
pass
|
| 728 |
_patch_sampler_func_sigmas_to_1d(p)
|
|
|
|
| 738 |
with _stage_sampler_context(p, stage_w, stage_h):
|
| 739 |
p.sampler_noise_scheduler_override = None
|
| 740 |
_call_script_hooks(p, samples)
|
| 741 |
+
try:
|
| 742 |
+
extra = getattr(p.sampler, 'sampler_extra_args', {})
|
| 743 |
+
if isinstance(extra, dict):
|
| 744 |
+
extra.pop('sigmas', None)
|
| 745 |
+
extra.pop('noise_sampler', None)
|
| 746 |
+
except Exception:
|
| 747 |
+
pass
|
| 748 |
return p.sampler.sample_img2img(
|
| 749 |
p, samples, noise,
|
| 750 |
conditioning, unconditional_conditioning,
|