Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
[Bug]: X/Y/Z plot load different model if model names are similar
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

After last update [9aba26abdf] X/Y/Z plot load different model than picked in settings.

This is generation from X/Y/Z plot

![xyz_grid-0012-1969839337](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/4281421/be06cf88-4c1a-411d-a92f-0b8935c7e1ae)

Those from normal txt2img generated one by one

deliberate_v2
![00441-1969839337](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/4281421/492c836d-e9f4-4152-93fe-89244af424c7)

hands_new2_with_multinoise
![00445-1969839337](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/4281421/c452c09e-9140-4024-8eaa-3762095b5f98)

hands_new2_with_noise
![00446-1969839337](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/4281421/ad9bde06-d20b-4350-817b-c9ce3b7da7e1)

As you can see image from hands_new2_with_noise is different than others when generated separatly but it's exactly the same as hands_new2_with_multinoise when generated with X/Y/Z plot

### Steps to reproduce the problem

1. Go to txt2img
2. Choose X/Y/Z plot
3. Pick models with similar names (same prefix?)


### What should have happened?

Each image should be different

### Commit where the problem happens

9aba26abdf

### What platforms do you use to access the UI ?

Windows

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
No
```


### List of extensions

SD-CN-Animation
clip-interrogator-ext
ddetailer
loopback_scaler
multidiffusion-upscaler-for-automatic1111
sd-dynamic-thresholding
sd-infinity-grid-generator-script
sd-webui-controlnet
sd-webui-cutoff
sd-webui-regional-prompter
sd-webui-supermerger
sd-webui-text2video
sd-webui-tome
sd_webui_SAG
seed_travel
LDSR
Lora
ScuNET
SwinIR
prompt-bracket-checker

### Console logs

```Shell
X/Y/Z plot will create 3 images on 1 3x1 grid. (Total steps to process: 60)████████████| 40/40 [00:40<00:00,  1.31it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:16<00:00,  1.24it/s]
Loading weights [9aba26abdf] from E:\stable-diffusion-webui\models\Stable-diffusion\deliberate_v2.safetensors 1.30it/s]
Loading VAE weights specified in settings: E:\stable-diffusion-webui\models\VAE\vae-ft-mse-840000-ema-pruned.ckpt
Applying cross attention optimization (Doggettx).
Weights loaded in 2.3s (load weights from disk: 0.2s, apply weights to model: 0.5s, load VAE: 0.3s, move model to device100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:16<00:00,  1.24it/s]
Loading weights [7d13449163] from E:\stable-diffusion-webui\models\Stable-diffusion\hands_new2_with_multinoise.safetensors
Loading VAE weights specified in settings: E:\stable-diffusion-webui\models\VAE\vae-ft-mse-840000-ema-pruned.ckpt
Applying cross attention optimization (Doggettx).
Weights loaded in 2.7s (load weights from disk: 0.6s, apply weights to model: 0.5s, load VAE: 0.3s, move model to device: 1.4s).
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:16<00:00,  1.25it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 60/60 [00:58<00:00,  1.03it/s]
```


### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py
--- a/scripts/xyz_grid.py
+++ b/scripts/xyz_grid.py
@@ -86,7 +86,7 @@ def apply_checkpoint(p, x, xs):
     info = modules.sd_models.get_closet_checkpoint_match(x)
     if info is None:
         raise RuntimeError(f"Unknown checkpoint: {x}")
-    p.override_settings['sd_model_checkpoint'] = info.hash
+    p.override_settings['sd_model_checkpoint'] = info.name
 
 
 def confirm_checkpoints(p, xs):


Test patch: