Repository: stable-diffusion-webui
Issue: [Bug]:  Incorrect SHA256 Hash for LoRAs
Labels: bug-report

### Is there an existing issue for this?

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

### What happened?

When loading a new LoRA for the first time, the calculated sha256 is incorrect. I've noticed this with multiple LoRAs, the one I've recently used for testing is https://civitai.com/models/153676/colorize-slider-lora .

If a LoRA is loaded for the first time and used to generate an image, there will be a line in the console log reading: `Calculating sha256 for /home/USER/stable-diffusion-webui/models/Lora/LoRAs/colorize.safetensors: 65878cf46ab0d0e68f5658cc3f72869ca61c7b0f6b8a9f33333106d0712efeda`.

This hash value is incorrect. It does not match the sha256 listed on the civitai page. I also double checked on my own end by running `sha256sum colorize.safetensors` and I got the same hash listed in the civitai page.

Checking the "edit metadata" option in the LoRA tab reveals the shortened hash as also being the incorrect first characters of the full hash.

![Screenshot from 2023-10-24 12-54-53](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/38494293/c9fb833f-177d-4825-bfe1-6797ee6bc0e3)


At some point in the past, the correct hash used to be calculated, since I have older LoRAs with the right hash value. I get the wrong hash for every new LoRA I use now.

### Steps to reproduce the problem

1. Generate a txt2img image with a LoRA you have never used before. The LoRA needs to have never been used before so the hash value will appear in the console log.
2. Navigate to the LoRA tab to find the LoRA that you just used. Click the tool icon for the "edit metadata" window to appear. The hash listed in this window should match the beginning characters of the hash in the console log.
3. Navigate to where your LoRA is stored in your file system and perform a sha256 hash. I used `sha256sum filename`. This hash should be different than the one in the webui console logs. If the LoRA was downloaded from civitai, check the hash against the sha256 hash on their website. The one you just generated should match the one on the site.


### What should have happened?

The hash that is saved in the "edit metadata" window and the hash that appears in the console log should match the hash I calculated myself, and the hash found on the civitai website.

### Sysinfo

[sysinfo-2023-10-24-17-17.txt](https://github.com/AUTOMATIC1111/stable-diffusion-webui/files/13121902/sysinfo-2023-10-24-17-17.txt)


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

Mozilla Firefox

### Console logs

```Shell
USER@pop-os:~/stable-diffusion-webui$ ./webui.sh 

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on USER user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
Installing requirements for CivitAI Browser
#######################################################################################################
Initializing Civitai Link
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Civitai Link revision: 763e8aedfab68e8933c3efbfa568961beeaa3def
SD-WebUI revision: 5ef669de080814067961f28357256e8fe27544f4

Checking Civitai Link requirements...
[+] python-socketio[client] version 5.7.2 installed.

#######################################################################################################
Launching Web UI with arguments: 

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
For effortless bug reporting copy-paste your error into this form: https://docs.google.com/forms/d/e/1FAIpQLScPB8emS3Thkp66nvqwmjTEgxp8Y9ufuWTzFyr9kJ5AoI47dQ/viewform?usp=sf_link
================================================================================
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('local/pop-os'), PosixPath('@/tmp/.ICE-unix/3603,unix/pop-os')}
  warn(
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/etc/xdg/xdg-pop')}
  warn(
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('1'), PosixPath('0')}
  warn(
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/home/USER/Downloads/stable-diffusion-webui/venv')}
  warn(
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/org/gnome/Terminal/screen/31676fad_8b76_48d7_8e31_e45a2be885da')}
  warn(
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('tmp/restart')}
  warn(
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching /usr/local/cuda/lib64...
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cuda_setup/paths.py:27: UserWarning: WARNING: The following directories listed in your path were found to be non-existent: {PosixPath('/usr/local/cuda/lib64')}
  warn(
WARNING: No libcudart.so found! Install CUDA or the cudatoolkit package (anaconda)!
CUDA SETUP: Loading binary /home/USER/.local/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so...
/home/USER/.local/lib/python3.10/site-packages/bitsandbytes/cextension.py:48: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers and GPU quantization are unavailable.
  warn(
No SDP backend available, likely because you are running in pytorch versions < 2.0. In fact, you are using PyTorch 1.13.1+cu117. You might want to consider upgrading.
No module 'xformers'. Proceeding without it.
==============================================================================
You are running torch 1.13.1+cu117.
The program is tested to work with torch 2.0.0.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
Civitai Helper: Get Custom Model Folder
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 23.10.1, num models: 9
Aria2 RPC started
2023-10-23 23:05:08,587 - ControlNet - INFO - ControlNet v1.1.411
ControlNet preprocessor location: /home/USER/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads
2023-10-23 23:05:08,651 - ControlNet - INFO - ControlNet v1.1.411
Civitai: API loaded
Loading weights [4e9f032dcd] from /home/USER/stable-diffusion-webui/models/Stable-diffusion/arcticfowlMix_v10x0.4+galenaREDUX_v20x0.3+kizukiAnimeHentai_animeHentaiV3x0.3.safetensors
/home/USER/stable-diffusion-webui/extensions/stable-diffusion-webui-two-shot/scripts/two_shot.py:397: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  canvas_image = gr.Image(source='upload', mirror_webcam=False, type='numpy', tool='color-sketch',
/home/USER/stable-diffusion-webui/extensions/stable-diffusion-webui-two-shot/scripts/two_shot.py:471: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  visual_regions = gr.Gallery(label="Regions").style(grid=(4, 4, 4, 8), height="auto")
/home/USER/stable-diffusion-webui/extensions/stable-diffusion-webui-two-shot/scripts/two_shot.py:471: GradioDeprecationWarning: The 'grid' parameter will be deprecated. Please use 'columns' in the constructor instead.
  visual_regions = gr.Gallery(label="Regions").style(grid=(4, 4, 4, 8), height="auto")
Civitai Helper: Settings:
Civitai Helper: max_size_preview: True
Civitai Helper: skip_nsfw_preview: False
Civitai Helper: open_url_with_js: True
Civitai Helper: proxy: 
Creating model from config: /home/USER/stable-diffusion-webui/configs/v1-inference.yaml
/home/USER/stable-diffusion-webui/extensions/sd-webui-supermerger/scripts/supermerger.py:52: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row().style(equal_height=False):
/home/USER/stable-diffusion-webui/extensions/sd-webui-supermerger/scripts/mergers/pluslora.py:58: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row().style(equal_height=False):
/home/USER/stable-diffusion-webui/extensions/sd-webui-supermerger/scripts/mergers/pluslora.py:65: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row().style(equal_height=False):
/home/USER/stable-diffusion-webui/extensions/sd-webui-supermerger/scripts/mergers/pluslora.py:70: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row().style(equal_height=False):
/home/USER/stable-diffusion-webui/extensions/sd-webui-supermerger/scripts/mergers/pluslora.py:75: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  with gr.Row().style(equal_height=False):
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Civitai: Check resources for missing info files
Civitai: Check resources for missing preview images
CLIP Changer.on_app_started done.
Startup time: 15.6s (prepare environment: 6.3s, import torch: 1.6s, import gradio: 0.8s, setup paths: 0.4s, initialize shared: 0.1s, other imports: 0.5s, list SD models: 0.2s, load scripts: 3.9s, create ui: 1.2s, gradio launch: 0.4s).
Civitai: Found 274 resources missing preview images
Civitai: Found 298 resources missing info files
Civitai: Found 2 hash matches
Civitai: Updated 0 info files
Civitai: No preview images found on Civitai
Loading VAE weights specified in settings: /home/USER/stable-diffusion-webui/models/VAE/pastel-waifu-diffusion.vae.pt
Applying attention optimization: Doggettx... done.
Model loaded in 7.5s (load weights from disk: 0.8s, create model: 0.3s, apply weights to model: 5.2s, load VAE: 0.5s, calculate empty prompt: 0.7s).

### Begin trimmed section
### Deleted multiple lines of normal image generation.
They were all essentially
### 
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 36/36 [00:09<00:00,  3.72it/s]
[Tiled VAE]: input_size: torch.Size([1, 4, 96, 72]), tile_size: 64, padding: 11█████████████████████████████████████████████████████| 36/36 [00:08<00:00,  3.74it/s]
[Tiled VAE]: split to 2x1 = 2 tiles. Optimal tile size 64x64, original tile size 64x64
[Tiled VAE]: Fast mode enabled, estimating group norm parameters on 48 x 64 image
[Tiled VAE]: Executing Decoder Task Queue: 100%|█████████████████████████████████████████████████████████████████████████████████| 246/246 [00:00<00:00, 949.42it/s]
[Tiled VAE]: Done in 0.840s, max VRAM alloc 3113.821 MB
Total progress: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 36/36 [00:09<00:00,  3.66it/s]
Total progress: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 36/36 [00:09<00:00,  3.74it/s]
###
### End trimmed section

100%|███████████████████████████████████████████| 36/36 [00:08<00:00,  4.01it/s]
[Tiled VAE]: input_size: torch.Size([1, 4, 96, 72]), tile_size: 64, padding: 11]
[Tiled VAE]: split to 2x1 = 2 tiles. Optimal tile size 64x64, original tile size 64x64
[Tiled VAE]: Fast mode enabled, estimating group norm parameters on 48 x 64 image
[Tiled VAE]: Executing Decoder Task Queue: 100%|█| 246/246 [00:00<00:00, 953.62i
[Tiled VAE]: Done in 0.842s, max VRAM alloc 3108.540 MB
Total progress: 100%|███████████████████████████| 36/36 [00:09<00:00,  3.72it/s]
Calculating sha256 for /home/USER/stable-diffusion-webui/models/Lora/LoRAs/tool_colorize_(+2_-2).safetensors: 65878cf46ab0d0e68f5658cc3f72869ca61c7b0f6b8a9f33333106d0712efeda
100%|███████████████████████████████████████████| 36/36 [00:09<00:00,  3.88it/s]
[Tiled VAE]: input_size: torch.Size([1, 4, 96, 72]), tile_size: 64, padding: 11]
[Tiled VAE]: split to 2x1 = 2 tiles. Optimal tile size 64x64, original tile size 64x64
[Tiled VAE]: Fast mode enabled, estimating group norm parameters on 48 x 64 image
[Tiled VAE]: Executing Decoder Task Queue: 100%|█| 246/246 [00:00<00:00, 962.35i
[Tiled VAE]: Done in 0.853s, max VRAM alloc 3108.540 MB
Total progress: 100%|███████████████████████████| 36/36 [00:09<00:00,  3.72it/s]
```


### Additional information

I edited my console log and system information to replace all instances of my name with "USER". I also trimmed the console logs of multiple lines of normal image generation. I left one instance in just in case, and every line I removed more or less matched the example I left in.

If this behavior is actually a bug, I'd appreciate if someone could also tell me how to make my webui forget all the incorrect hashes it has saved. Or tell me what file I need to edit to change the hashes myself. It would likely be wherever the LoRA metadata is stored.