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

reactivated the old hashing that work for civitai #1647

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trunksn1
Copy link

@trunksn1 trunksn1 commented Sep 1, 2024

This pull request reactivates existing code in _hashes.py that was previously commented out or disabled.

Issue

The current hashing function does not correctly identify resources on Civitai. As a result, checkpoints (both Stable Diffusion and Flux) and Loras (only Stable Diffusion) are not recognized.

Fix:

By reactivating the original hashing function, the recognition of these resources is restored:

  1. Flux Checkpoints: Now recognized correctly.

  2. Stable Diffusion Models: Both checkpoints and Loras are correctly recognized.

Impact

Before the Fix:
Using the current fake hashing function, no resources are recognized.
fake_hash

After the Fix:

  1. The Flux checkpoint is recognized, though Loras for Flux models are still not recognized.

good old hash

  1. For Stable Diffusion models, both checkpoints and Loras are correctly recognized.
    pony

@Hapseleg
Copy link

bump since this is obviously a PR that should get added

@devilkad
Copy link

devilkad commented Oct 18, 2024

thanks i tested it like this:
1- deleting hashes folder inside cache folder
2- replaced hashes.py inside modules Folder
3- inside webui go to settings> actions> calculate hash for all checkpoint

@devilkad
Copy link

devilkad commented Oct 29, 2024

and there is another fix more user friendly 😊
you can setup civitai extension if you don't wanna bother yourself a lot coding
https://github.com/civitai/sd_civitai_extension

@Hapseleg
Copy link

and there is another fix more user friendly 😊 you can setup civitai extension if you don't wanna bother yourself a lot coding https://github.com/civitai/sd_civitai_extension

Afaik that doesn't help since it uses the hash forge generates, it doesn't work for me at least..

@RalFingerLP
Copy link

thanks i tested it like this: 1- deleting hashes folder inside cache folder 2- replaced hashes.py inside modules Folder 3- inside webui go to settings> actions> calculate hash for all checkpoint

thanks!

@devilkad
Copy link

devilkad commented Nov 3, 2024

and there is another fix more user friendly 😊 you can setup civitai extension if you don't wanna bother yourself a lot coding https://github.com/civitai/sd_civitai_extension

Afaik that doesn't help since it uses the hash forge generates, it doesn't work for me at least..

for me both methods worked and civitai extension took like 10 minutes to load all the correct hashes from civitai and worked

@UnconnectedBedna
Copy link

UnconnectedBedna commented Nov 4, 2024

and there is another fix more user friendly 😊 you can setup civitai extension if you don't wanna bother yourself a lot coding https://github.com/civitai/sd_civitai_extension

Afaik that doesn't help since it uses the hash forge generates, it doesn't work for me at least..

for me both methods worked and civitai extension took like 10 minutes to load all the correct hashes from civitai and worked

I'm no expert, but I am pretty sure the civitai extension does not change the hashes in the local database, only add civitai description and other info, and dowload pictures etc.

I have used that plugin since forever when I started using forge, still had the incorrect hashes, I just did not realize until very recently. (for me, LORA:s were detected, but not SD 1.5 (I think) or SDXL models)

Applying this patch worked for me and civitai now recognizes my models from the meta tags after removing the database and recalculating them in settings > actions > calculate hashes.... Took a few seconds to calculate.
Thank you @devilkad for debugging and finding a fix for this issue.
Would be great if it was reviewed and accepted...

@SpaceShogox
Copy link

I wonder if there is any reason this change in the new forge isn't reverted or fixed yet. Hashing is a fundamental part of any software and it does break the use of Forge. @lllyasviel please take time to review the change needed. I don't know what this affects in the code but if not fixed it does affect the working of plugins.

@IrineSistiana
Copy link

IrineSistiana commented Dec 26, 2024

bump

I saw users complaining about strange hashing issues in a web community today, so I thought of this PR again.

Fake hash not just breaking Civitai but also many other AI image viewing tools that relay on hash to sort images. Silently using fake hashes can cause great confusion to end users who are not aware of the situation. (It's not just lack of hash in the metadata, it's a fake hash... "Is my checkpoint/SSD/memory broken?", "Why the hash changed?"...)

Normally hashing a checkpoint takes 5~20s depends what checkpoint and computer. It's a bit long but is totally fine I guess. There is a hash cache, so as long as the checkpoint path does not change, the hash will just calculate once.

I'm using forge on local computer, not sure about other env, like on Colab.

From I saw today, "fake hash" bring way more confusion to normal users than benefits. My suggestion is to add a new startup parameter, such as "--fake-hash", to "explicitly" disable hashing. Or just "--no-hash", dont include hash info in metadata (which needs to changes more code). If users know that they do not need hash and want to speed up the first time running, they can add this startup parameter.

@Cranbert
Copy link

It's utterly baffling that this is still an issue. Saving a few seconds the first time you use a model is so insignificant compared to the annoyance it causes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants