AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
141.4k stars 26.72k forks source link

[Bug]: Checkpoint in X/Y/Z plot is not properly represented in filename and metadata of subgrids when many checkpoints are used #7526

Open przemoc opened 1 year ago

przemoc commented 1 year ago

Is there an existing issue for this?

What happened?

Used X/Y/Z plot with different checkpoints for Z values while having filename pattern set to [model_hash]-[seed]-[steps]-[cfg]-[sampler]-[width]x[height]-[job_timestamp]-[datetime]-[prompt_words].

Metadata of all subgrids have Model and Model hash corresponding to the first checkpoint in Z values (which is valid only for the first subgrid).

Filenames of all subgrids have model_name and model_hash corresponding to the last checkpoint in Z values (which is valid only for the last subgrid).

(Metadata and filenames of all single images in txt2img-images are proper, though.)

Steps to reproduce the problem

  1. In Settings set filename pattern with [model_name] and/or [model_hash].
  2. Choose script: X/Y/Z plot, X type set to whatever, Y type set to whatever, Z type set to Checkpoint name, Z value set to at least 2 different checkpoints, or even better to at least 3 different checkponts.
  3. Generate
  4. Inspect subgrids in txt2img-grids. Look for model and model hash in filenames and metadata (both .png and .txt).

What should have happened?

Metadata of all subgrids should have proper Model and Model hash.

Filenames of all subgrids should have proper model_name and model_hash.

Commit where the problem happens

226d840e84c5f306350b0681945989b86760e616

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

No

List of extensions

ABG_extension openOutpaint-webUI-extension sd-dynamic-thresholding stable-diffusion-webui-aesthetic-gradients stable-diffusion-webui-images-browser

Console logs

(automatic) (miniconda3-latest) przemoc@NUC11PHKi7C002:~/python/stable-diffusion-workspace/AUTOMATIC1111/stable-diffusion-webui$ python launch.py --api
Python 3.10.6 (main, Oct  7 2022, 20:19:58) [GCC 11.2.0]
Commit hash: 3e0f9a75438fa815429b5530261bcf7d80f3f101
Installing requirements for Web UI
Installing None
Installing onnxruntime-gpu...
Installing None
Installing opencv-python...
Installing None
Installing Pillow...

Launching Web UI with arguments: --api
No module 'xformers'. Proceeding without it.
Loading weights [43147e5dbf] from /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/any57f40s3-fp32.ckpt
Creating model from config: /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights found near the checkpoint: /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/any57f40s3-fp32.vae.pt
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(1): bad_prompt
Model loaded in 12.0s (load weights from disk: 5.1s, create model: 0.8s, apply weights to model: 1.3s, apply half(): 0.6s, load VAE: 2.6s, move model to device: 1.5s).
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 12 images on 3 2x2 grids. (Total steps to process: 240)
                                  Loading weights [67a115286b] from /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0-pruned-fp32.ckpt
Loading VAE weights found near the checkpoint: /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0-pruned-fp32.vae.pt
Applying cross attention optimization (Doggettx).
Weights loaded in 30.5s (load weights from disk: 23.0s, apply weights to model: 0.7s, load VAE: 5.5s, move model to device: 1.2s).
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:07<00:00,  2.66it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.54it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.08it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.14it/s]
Loading weights [fe4efff1e1] from /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt                                                                                                      | 80/240 [00:57<00:35,  4.50it/s]
Applying cross attention optimization (Doggettx).
Weights loaded in 7.1s (load weights from disk: 5.4s, apply weights to model: 0.5s, move model to device: 1.2s).
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:05<00:00,  3.39it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.33it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.55it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.68it/s]
Loading weights [cc6cb27103] from /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.ckpt█████████████████                                                                        | 160/240 [01:26<00:16,  4.72it/s]
Loading VAE weights found near the checkpoint: /home/przemoc/git/github.com/AUTOMATIC1111/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.vae.pt
Applying cross attention optimization (Doggettx).
Weights loaded in 22.2s (load weights from disk: 19.8s, apply weights to model: 0.5s, load VAE: 0.7s, move model to device: 1.1s).
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.70it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.38it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.57it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.70it/s]
Total progress: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 240/240 [02:10<00:00,  1.84it/s]
{"prompt": "tergiversation", "all_prompts": ["tergiversation"], "negative_prompt": "", "all_negative_prompts": [""], "seed": 1, "all_seeds": [1], "subseed": 3611226547, "all_subseeds": [3611226547], "subseed_strength": 0, "width": 512, "height": 512, "sampler_name": "Euler a", "cfg_scale": 7, "steps": 20, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "67a115286b", "seed_resize_from_w": 0, "seed_resize_from_h": 0, "denoising_strength": null, "extra_generation_params": {}, "index_of_first_image": 0, "infotexts": ["tergiversation\nSteps: 20, Sampler: Euler a, CFG scale: 7, Seed: 1, Size: 512x512, Model hash: 67a115286b, Model: Anything-V3.0-pruned-fp32, ENSD: 31337"], "styles": [], "job_timestamp": "20230204155210", "clip_skip": 1, "is_using_inpainting_conditioning": false}

Additional information

No response

DejitaruJin commented 1 year ago

I'm looking into this now, I may have accidentally fixed it while refactoring a bunch of that script.

DejitaruJin commented 1 year ago

It looks like I had already fixed the metadata issue, but the file name issue comes from processing after that object is returned. A quick bit more refactoring and I should have this handled.