Skip to content

fix refiner switching issues - #2165

Merged
mashb1t merged 6 commits into
lllyasviel:developfrom
xhoxye:patch-2
Mar 10, 2024
Merged

mashb1t merged 6 commits into
lllyasviel:developfrom
xhoxye:patch-2

Conversation

@xhoxye

@xhoxye xhoxye commented Feb 5, 2024 •

Copy link
Copy Markdown
Contributor

#2131

  1. In inpaint, when refiner is None, enable use_synthetic_refiner. The default switching timing of 0.5 is too early, which is now modified to SDXL default of 0.8.
  2. When using custom steps, the calculation of switching timing is wrong. Now it is modified to calculate "steps x timing" after custom steps are used.

1. In partial redrawing, when refiner is empty, enable use_synthetic_refiner. The default switching timing of 0.5 is too early, which is now modified to SDXL default of 0.8.
2. When using custom steps, the calculation of switching timing is wrong. Now it is modified to calculate "steps x timing" after custom steps are used.
@xhoxye
xhoxye requested a review from lllyasviel as a code owner February 5, 2024 04:11
@mashb1t mashb1t linked an issue Feb 5, 2024 that may be closed by this pull request
@mashb1t mashb1t changed the title fix problem fix refiner switching issues Feb 5, 2024
@mashb1t mashb1t added the Size S small change, basically no testing needed label Feb 8, 2024
Comment thread modules/async_worker.py
if refiner_model_name == 'None':
use_synthetic_refiner = True
refiner_switch = 0.5
refiner_switch = 0.8

@mashb1t mashb1t Feb 10, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xhoxye can you please elaborate why exactly 0.8 should be the new value here? (relates to #2131 (comment))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.8 is the default switching timing value for SDXL refiner, which reduces the loss of control of the picture to a small effect, of course 1.0 is OK, but 1.0 will turn off use_synthetic_refiner

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm uncertain what the purpose of using use_synthetic_refiner is. Does it allow for more unguided steps? But this is what the ControlNet stop at is for anyways, right?

@mashb1t mashb1t Feb 11, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: i was wrong, indeed works better with 0.8, even better with 1 (forgot the mix inpaint with image prompt).
I'm not certain if there is any reason why this is currently set to 0.5 and not 1 in the first place if no refiner is set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you get another Asian face. Try it.
it becomes a European after 0.5 or 0.7.
QQ截图20240211214143

image

@xhoxye

xhoxye commented Feb 11, 2024 •

Copy link
Copy Markdown
Contributor Author

Could it be that Asians face and models didn't match?

@mashb1t

mashb1t commented Feb 11, 2024

Copy link
Copy Markdown
Collaborator

yes, got it. Updated comment #2165 (comment)

@mashb1t

mashb1t commented Feb 11, 2024

Copy link
Copy Markdown
Collaborator

Could it be that Asians face and models didn't match?

This could be possible, still switching to refiner, even synthetic one, will again introduce noise depending on switch step and cause the result to not apply faceswap / inpaint correctly

@mashb1t

mashb1t commented Feb 11, 2024

Copy link
Copy Markdown
Collaborator

@lllyasviel IMHO this is a non-intended side-effect but it's also possible that we're not getting the full picture here.
Is it intended that refiner_switch is 0.5 and not 1 when no refiner is set and if yes, what are the reasons?

https://github.com/lllyasviel/Fooocus/blob/2.1.864/modules/async_worker.py#L307

mashb1t added a commit that referenced this pull request Feb 11, 2024
…2165)

When using custom steps, the calculation of switching timing is wrong. Now it is modified to calculate "steps x timing" after custom steps are used.
By @xhoxye
@mashb1t

mashb1t commented Feb 22, 2024

Copy link
Copy Markdown
Collaborator

@lllyasviel your feedback would be highly appreciated here to identify a potential bug and to understand the implementation better.

mashb1t and others added 4 commits March 5, 2024 18:18
…#2452)

fixes an issue with A1111 metadata scheme where width and height are strings after splitting resolution
…l#2456)

image grid is actually not an image here but a numpy array, as the grid isn't saved by default
# Conflicts:
#	modules/async_worker.py
@mashb1t
mashb1t changed the base branch from main to develop March 10, 2024 13:39
@mashb1t
mashb1t merged commit db7d201 into lllyasviel:develop Mar 10, 2024
@ChineseNorris

ChineseNorris commented Mar 21, 2024 •

Copy link
Copy Markdown

I've checked a few things with the refiner_switch = 0.8 and here are some issues I have found:

  • With refiner_switch = 0.8 the image gets more saturated and looks a little bit "better" but the inpaint(masked) creates a thin white line that looks like it's glowing
  • With refiner_switch = 0.5 the image looks more natural and the inpaint doesn't do weird things
  • With refiner_switch = 1 the saturation is more clear and doesn't look as natural as 0.5

Maybe change refiner_switch to be altered in profiles and change this setting if anyone needs it?
refiner_switch = 0.8
2024-03-21_23-34-35_3213
refiner_switch = 0.5
2024-03-21_23-27-50_3213

@mashb1t @xhoxye

@xhoxye
xhoxye deleted the patch-2 branch May 9, 2024 01:29
asahiruyoru pushed a commit to asahiruyoru/Fooocus that referenced this pull request Apr 16, 2026
…llyasviel#2165)

When using custom steps, the calculation of switching timing is wrong. Now it is modified to calculate "steps x timing" after custom steps are used.
By @xhoxye
asahiruyoru pushed a commit to asahiruyoru/Fooocus that referenced this pull request Apr 16, 2026
* fix problem

1. In partial redrawing, when refiner is empty, enable use_synthetic_refiner. The default switching timing of 0.5 is too early, which is now modified to SDXL default of 0.8.
2. When using custom steps, the calculation of switching timing is wrong. Now it is modified to calculate "steps x timing" after custom steps are used.

* fix: parse width and height as int when applying metadata (lllyasviel#2452)

fixes an issue with A1111 metadata scheme where width and height are strings after splitting resolution

* fix: do not attempt to remove non-existing image grid file (lllyasviel#2456)

image grid is actually not an image here but a numpy array, as the grid isn't saved by default

* feat: add troubleshooting guide to bug report template again (lllyasviel#2489)

---------

Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com>
Co-authored-by: Manuel Schmid <manuel.schmid@odt.net>
Wontfallo added a commit to Wontfallo/Fooocus that referenced this pull request Jul 11, 2026
…llyasviel#2165)

When using custom steps, the calculation of switching timing is wrong. Now it is modified to calculate "steps x timing" after custom steps are used.
By @xhoxye
Wontfallo added a commit to Wontfallo/Fooocus that referenced this pull request Jul 11, 2026
* fix problem

1. In partial redrawing, when refiner is empty, enable use_synthetic_refiner. The default switching timing of 0.5 is too early, which is now modified to SDXL default of 0.8.
2. When using custom steps, the calculation of switching timing is wrong. Now it is modified to calculate "steps x timing" after custom steps are used.

* fix: parse width and height as int when applying metadata (lllyasviel#2452)

fixes an issue with A1111 metadata scheme where width and height are strings after splitting resolution

* fix: do not attempt to remove non-existing image grid file (lllyasviel#2456)

image grid is actually not an image here but a numpy array, as the grid isn't saved by default

* feat: add troubleshooting guide to bug report template again (lllyasviel#2489)

---------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size S small change, basically no testing needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The bug in the FaceSwap feature.

5 participants