stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Model hashes begin to repeat

Open Jonseed opened this issue 3 years ago • 7 comments

Is there an existing issue for this?

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

What happened?

I have four ckpt models that all show the very same hash. They are, of course, different files.

Steps to reproduce the problem

  1. Put several models in the SD model folder
  2. Reload models
  3. Several of the models show the same hash

What should have happened?

They should have unique hashes.

Commit where the problem happens

d61f0de

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

--xformers --autolaunch --gradio-img2img-tool color-sketch

Additional information, context and logs

How do you get the server to reassign hashes?

Jonseed avatar Nov 04 '22 19:11 Jonseed

I experience the same issue. I think becuase it only calculates model hash only from the first 0x10000 bytes at offset 0x100000, as shown here. So if two models have the same content in this region, they will show the same hash, which is quite common in merged checkpoints.

zzhongzz avatar Nov 08 '22 15:11 zzhongzz

Hmm, yeah, that's probably the reason we're seeing duplicate hashes. It needs to read more of the ckpt file or calculate the hash differently to generate a unique hash.

Jonseed avatar Nov 08 '22 19:11 Jonseed

I made a PR #2459 about that, feel free to take a look.

jn-jairo avatar Nov 09 '22 06:11 jn-jairo

Potentially related:

  • https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/2459
  • https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4478
  • https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/4546
  • https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/2180
  • https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/2468

0xdevalias avatar Nov 26 '22 06:11 0xdevalias

image

It's really a big issue here. literally 75% of my models have duplicate hashes rn

trojblue avatar Nov 26 '22 17:11 trojblue

PR #4546 would fix it.

Jonseed avatar Nov 27 '22 00:11 Jonseed

PR #4546 would fix it.

As would this one, which came first:

  • https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/2459

0xdevalias avatar Nov 27 '22 05:11 0xdevalias

Issue solved by https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/a95f1353089bdeaccd7c266b40cdd79efedfe632

jn-jairo avatar Jan 14 '23 13:01 jn-jairo