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

[Bug]: X/Y/Z result metadata off by one #7804

Closed
1 task done
DejitaruJin opened this issue Feb 13, 2023 · 2 comments
Closed
1 task done

[Bug]: X/Y/Z result metadata off by one #7804

DejitaruJin opened this issue Feb 13, 2023 · 2 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@DejitaruJin
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

When using the X/Y/Z plot, and "Include Sub Images" is selected, the first two generated images (after the plot its self) share identical metadata, causing all further images to have metadata attached that belongs to the previous image. This affects both the representation in the UI, and the data saved in/alongside the image on the drive.

I have tested and observed this issue with X, X/Y, and X/Y/Z modes, multiple models, and the types of Seed, Steps, and Sampler, which is enough for me to confidently assume it affects all scenarios.

(The plot also generates images in Z/Y/X order, which makes previewing in the web UI a PITA, but I assume that was deliberate so I'll file a change request for that.)

Steps to reproduce the problem

  1. Set txt2img generation data to your liking
  2. Set Script to X/Y/Z plot
  3. Check "Include Sub Images"
  4. Configure plot as desired
  5. Generate

What should have happened?

Not having the metadata lag behind one image lol

Commit where the problem happens

ea9bd9f

What platforms do you use to access the UI ?

Linux

What browsers do you use to access the UI ?

Mozilla Firefox, Google Chrome

Command Line Arguments

No

List of extensions

a1111-sd-webui-tagcomplete
embedding-inspector
stable-diffusion-webui-tokenizer

Console logs

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on digitalman user
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Python 3.8.10 (default, Nov 14 2022, 12:59:47) 
[GCC 9.4.0]
Commit hash: ea9bd9fc7409109adcd61b897abc2c8881161256
Installing requirements for Web UI
Installing None
Installing onnxruntime-gpu...
Installing None
Installing opencv-python...
Installing None
Installing Pillow...

Launching Web UI with arguments: --medvram --precision full --no-half --xformers
Loading weights [812cd9f9d9] from /media/digitalman/AI/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0-pruned-fp16.ckpt
Creating model from config: /media/digitalman/AI/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: /media/digitalman/AI/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0): 
Model loaded in 2.2s (load weights from disk: 0.9s, create model: 0.5s, apply weights to model: 0.3s, load VAE: 0.4s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
X/Y/Z plot will create 3 images on 1 3x1 grid. (Total steps to process: 60)
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:12<00:00,  1.63it/s]
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:10<00:00,  1.82it/s]
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:10<00:00,  1.82it/s]
Total progress: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 60/60 [00:43<00:00,  1.40it/s]

Additional information

No response

@DejitaruJin DejitaruJin added the bug-report Report of a bug, yet to be confirmed label Feb 13, 2023
@DejitaruJin
Copy link
Contributor Author

DejitaruJin commented Feb 17, 2023

Presently working to fix this myself, already found the issue causing Z/Y/X ordering so that'll be a separate PR.

If 'Include Sub Grids' is checked, it also features an off-by-one issue within the grids as a group, in addition to the error repeating once it gets to the individual images. I think I see approximately where the issue is...

Edit: Scratch that, the sub-grids don't repeat the error, they just exacerbate it. I assume this is because the inclusion of sub-grids injects to processed_result.images without affecting any of the other associated image data arrays. How this runs at all without going out-of-bounds is a mystery.

@DejitaruJin
Copy link
Contributor Author

Think I got it; when it hits processed_result = copy(processed) to create the initial list of processed images, that processed object contains two sets of data. A few lines later, it nukes processed_result.images to a list with a single blank image (that gets replaced with the main grid later) and immediately after that it begins appending individual images. Because the respective info lists were not likewise nuked, all appended info is one element after its related entry in the image list.

I'll perform a couple more tests to verify it's fixed and then submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants