butaixianran / Stable-Diffusion-Webui-Civitai-Helper

Stable Diffusion Webui Extension for Civitai, to manage your model much more easily.
2.37k stars 286 forks source link

Language

中文
日本語
한국어(ChatGPT)

About Civitai Helper2: Model Info Helper

check here for Civitai Helper 2's update: about_version2

Notice

This extension request latest SD webui v1.6.x, update it before using this extension. And also re-lanuch SD webui after installing(not just reload UI). If you have an issue, check console log window's detail and read common issue part

You can also try following forks of this project, which is updating when I'm busy on other projects.
https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper
or
https://github.com/blue-pen5805/Stable-Diffusion-Webui-Civitai-Helper

Also, invokeAI 3.x and ComfyUI are wonderful choices for SD. Try them.

Civitai Helper

Stable Diffusion Webui Extension for Civitai, to handle your models much more easily.

Civitai: Civitai Url

Features

Install

Go to SD webui's extension tab, go to Install from url sub-tab. Copy this project's url into it, click install.

Alternatively, download this project as a zip file, and unzip it to Your SD webui folder/extensions.

Everytime you install or update this extension, you need to shutdown SD Webui and Relaunch it. Just "Reload UI" won't work for this extension.

Done.

How to Use

Update Your SD Webui

Update SD webui before using this extension!

Scanning Models

Go to extension tab "Civitai Helper". There is a button called "Scan model".

Click it and the extension will scan all your models to generate SHA256 hashes, using them to retreive model information and preview images from Civitai.

Scanning takes time, just wait it finish

For each model, it will create a json file to save all model info from Civitai. This model info file will be "Your_model_name.civitai.info" in your model folder.

If a model info file already exists, it will be skipped. If a model cannot be found in Civitai, it will create an empty model info file, so the model won't be scanned twice.

Adding New Models

When you have some new models, just click scan button again, to get new model's information and preview images. It won't scan the same model twice.

Model Card

(Use this only after scanning finished)
Go to a Model's tab to show model cards.

Move your mouse on to the Top of a model card. It will show 3 additional icon buttons:

If these additional buttons are not there, click the Refresh Civitai Helper button to bring them back.


Everytime after Extra Network tab refreshed, it will remove all these additional buttons. So, you need to click Refresh Civitai Helper button to bring them back.

Download

To download a model by Civitai Model Page's Url, you need 3 steps:

Detail will be displayed on console log, with a progress bar.
Downloading can resume from break-point, so no fear for large file.

Checking Model's New Version

You can checking your local model's new version from civitai by model types. You can select multiple model types.

The checking process has a "1 second delay" after each model's new version checking request. So it is a little slow.

This is to protect Civitai from issue like DDos from this extension. Some cloud service provider has a rule as "no more than 1 API request in a second for free user". Civitai doesn't have this rule yet, but we still need to protect it. There is no good for us if it is down.

After checking process done, it will display all new version's information on UI.

There are 3 urls for each new version.

Get Model Info By Url

This is used to force a local model links to a Civitai model. For example, you converted a model's format or pruned it. Then it can not be found on civitai when scanning.

In that case, if you still want to link it to a civitai model. You can use this funcion.

Choose this model from list, then offer a civitai model page's url.

After clicking button, extension will download that civitai model's info and preview image for the local file you picked.

Settings

Now all settings are moved into Setting tab->civitai helper section.

Proxy

For some sock5 proxy, need to be used as "socks5h://127.0.0.1:port".

Civitai API Key

You need to login civitai to download some models. To do this with Civitai API, you need to create an API Key in your account settings on Civitai's website.

zixaphir created a detailed tutorial for this: wiki.

Here is a simple tutorial:

Content Setting of Civitai

On your civitai account's setting page, there are sections for "Content Controls" and "Content Moderation".

If you hide some content types there, then you won't be able to get those models with this extension.

To get all kinds of models, you need to

Preview Image

Extra network uses both model_file.png and model_file.preview.png as preview image. But model_file.png has higher priority, because it is created by yourself.

When you don't have the higher priority one, it will use the other automatically.

Prompt

When you click the button "Use prompt from preview image", it does not use the prompt from your own preview image. It uses the one from civitai's preview image.

On civitai, a model's preview images may not has prompt. This extension will check this model's all civitai preview images' information and use the first one has prompt in it.

SHA256

To create a file SHA256, it need to read the whole file to generate a hash code. It gonna be slow for large files.

Also, extension uses Memory Optimized SHA256, which won't stuck your system and works with colab.

There are 2 cases this hash code can not find the model on civitai:

In these cases, you can always link a model to civitai by filling its URL in this extension.

Feature Request

No new feature for v1.x after v1.5. All new feature will go to 2.x.

2.x will focus on custom model information and may change name to "Model Info Helper", because it is not just focus on Civitai anymore.

From v1.5, v1.x goes into maintenance phase.

Enjoy!

Common Issue

4 Buttons on card didn't show

Using cloud based localization extension

Turn off cloud based localization extension, use normal localization extension.

Other case

First of all, make sure you clicked "Refresh Civitai Helper" button.

If issue is still there, then only reason is you are not using the latest SD webui. So, Make sure you updated it.

Your update could be failed if you have modified SD webui's file. You need to check git command's console log to make sure it is updated.

In many cases, git will just refuse to update and tell you there are some conflicts need you to handle manually. If you don't check the consloe log, you will think your SD webui is updated, but it is not.

Request, Scan or Get model info failed

This extension is stable. So, the reason for this most likely is your internet connection to Civitai API service.

Civitai is not as stable as those rich websites, it can be down or refuse your API connection.

Civitai has a connection pool setting. Basicly, it's a max connection number that civitai can have at the same time. So, if there are already too manny connections on civitai, it will refuse your API connection.

In those cases, the only thing you can do is just wait a while then try again.

Get Wrong model info and preview images from civitai

A bad news is, some models are saved with a wrong sha256 in civitai's database. Check here for more detail:
https://github.com/civitai/civitai/issues/426

So, for those models, this extension can not get the right model info or preview images.

In this case, you have to remove the model info file and get the right model info by a civitai url on this extension's tab page.

Also, you can report those models with wrong sha256 to civitai at following page:
https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100

Please report that model to civitai, so they can fix it.

Scanning fail when using colab

First of, search your error message with google. Most likely, it will be a colab issue.

If you are sure it is a out of memory issue when scanning models, and you are using this extension's latest version, then there is nothing we can do.

Since v1.5.5, we've already optimized the SHA256 function to the top. So the only 2 choices for you are:

Change Log

v1.10.4

v1.10.2

v1.10.1

v1.10.0

v1.9.1

v1.9.0

v1.8.3

v1.8.2

v1.8.1

v1.8.0

v1.7.0

v1.6.4

v1.6.3

v1.6.2.1

v1.6.2

v1.6.1.1

v1.6.1

v1.6.0

v1.5.7

v1.5.6

v1.5.5

v1.5.4

v1.5.0

v1.4.2

v1.4.1

v1.4

v1.3

v1.2.1

v1.2

v1.1