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

Fix Approx NN previews changing first generation result #7151

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

brkirch
Copy link
Collaborator

@brkirch brkirch commented Jan 24, 2023

Describe what this pull request is trying to achieve.

The loading of the model for approx nn live previews can change the internal state of PyTorch (at least for MPS), resulting in a different image.

For example, here is the first generation of a image with approx nn previews:
00153-3100691432-1girl
All generations afterwards with the exact same settings result in:
00154-3100691432-1girl

If approx nn is not used, the image generated will always be the same as the second generation with approx nn turned on.

To avoid generating a different result with the first generation with approx nn turned on, this PR preloads the approx nn model before starting sampling if approx nn live previews are turned on.

Environment this was tested in

  • OS: macOS
  • Browser: Safari
  • Graphics card: M1 Max 64 GB

The loading of the model for approx nn live previews can change the internal state of PyTorch, resulting in a different image. This can be avoided by preloading the approx nn model in advance.
@AUTOMATIC1111 AUTOMATIC1111 merged commit 23dafe6 into AUTOMATIC1111:master Jan 25, 2023
@brkirch brkirch deleted the fix-approx-nn branch February 6, 2023 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants