Code Monkey home page Code Monkey logo

sd_civitai_extension's Introduction

Civitai Extension for Automatic 1111 Stable Diffusion Web UI

Manage and interact with your Automatic 1111 SD instance right from Civitai

Civitai.Link.-.March.2023.Alpha.mp4

Features

  • Automatically download preview images for all models, LORAs, hypernetworks, and embeds
  • Automatically download a model based on the model hash upon applying pasted generation params
  • Resources in Metadata: Include the SHA256 hash of all resources used in an image to be able to automatically link to corresponding resources on Civitai
  • Flexible Resource Naming in Metadata: Hashify the names of resources in prompts to avoid issues with resource renaming and make prompts more portable
  • Civitai Link (Alpha): Optional websocket connection to be able to add/remove resources and more in your SD instance while browsing Civitai or other Civitai Link enabled sites.

Installation

Through the Extensions UI (Recommended)

  1. Open the Extensions Tab in Automatic1111 SD Web UI
  2. In the Extension Tab Open the "Instal from URL" tab
  3. Paste https://github.com/civitai/sd_civitai_extension.git into the URL input
  4. Press install and wait for it to complete
  5. Restart Automatic1111 (Reloading the UI will not install the necessary requirements)

note: for the correct usage of this extension, make sure to remove the --no-hashing launch option from Automatic 1111 (if you are using it) as this extension relies on hash information provided it.

Manually

  1. Download the repo using any method (zip download or cloning)
git clone https://github.com/civitai/sd_civitai_extension.git
  1. After downloading the repo, open a command prompt in that location
cd C:\path\to\sd_civitai_extension
  1. Then run the included install.py script
py install.py
# OR
python install.py

note: for the correct usage of this extension, make sure to remove the --no-hashing launch option from Automatic 1111 (if you are using it) as this extension relies on hash information provided it.

Frequently Asked Questions

What the Civitai Link Key? Where do I get it?

The Civitai Link Key is a short 6 character token that you'll receive when setting up your Civitai Link instance (you can see it referenced here in this Civitai Link installation video). The Link Key acts as a temporary secret key to connect your Stable Diffusion instance to your Civitai Account inside our link service.

Since Civitai Link is still in alpha, it is currently only available to Supporters as part of the Civitai Early Access program. You can get access to Civitai Link today by becoming a supporter ๐Ÿฅฐ or you can wait until we've gotten it to a state that we're ready for a full release.

Contribute

Hop into the development channel in our Discord server and let's chat!

sd_civitai_extension's People

Contributors

ad-daniel avatar cmoody avatar jiveabillion avatar ju1-js avatar justmaier avatar koenbeuk avatar rockerboo avatar sir-digsbey avatar ss18 avatar stdkoehler avatar tsubashi avatar wkpark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sd_civitai_extension's Issues

You are making this extension to the wrong way

The feature list of Readme.md is a terrible choice.

You are making a desktop client tool into SD webui. Which includes all features of the website. That's really a terrible choice.

Here is how this should be done:

If you want to offer a desktop client, you create it with Electron, package your website into it. Easy to create, easy to maintain. And with full feature of the website.

For this extension. You only make it can:

  • Having a button to Open civitai's web page
  • View downloaded model as cards
  • Add url/model id, version id to a downloaded model, so those model already downloaded, can be linked to a civitai model.
  • Download preview image for already downloaded model
  • Open model's webpage by click a button
  • VIew model's trigger words and add them to prompt
  • Remind new version for a downloaded model.
  • Download a new model by filling a civitai's url.

That's all for this extension. Easy to install, easy to use, easy to maintain. And its first version can be done in 2 days.

This extension should only focus on 3 things:

  • Link and manage those already downloaded model
  • Download a new model
  • Remind new version of a downloaded model.

Nothing more.

Do not put the whole destop client's feature into an extension. It is not necessary and users won't get good experience for an extension like that. And it gonna be hard to develop and hard to maintain

Operation error

Using automatic mode, clone it on github, and when running python install.py on the terminal, an error will be prompted

image

Flickering between connected and disconected non stop

Everything was working fine 2 days ago when I first installed the extension and followed the steps, its been stuck like this since.
2023-03-16 12_59_04- Sidebery  Civitai โ€” Mozilla Firefox

I have SD up to date, I installed python-socketio 5.7.2 as instructed I have no errors on the cmd console when I start up SD.
2023-03-16 13_19_11-webui-user bat - Shortcut
2023-03-16 13_33_03-webui-user bat - Shortcut

Sometimes it actually stay connected for a min or two but when I click to download something from civitai it intermediately disconnects and starts re-connecting and disconnecting non stop,
2023-03-16 13_43_16-Select webui-user bat - Shortcut

I tried to generate new keys and apply on SD settings, just keeps re-connecting and disconnecting non stop, tried reinstalling the extension and same deal.
2023-03-16 13_22_17- Sidebery  Civitai โ€” Mozilla Firefox

Also tried and deleted my instance to try with a new one and same deal,
2023-03-16 13_46_36- Sidebery  Civitai โ€” Mozilla Firefox

I'm also using citivai helper extension but I don't see any indication that they conflict, so not sure if this is a bug or something on my end.

#######################################################################################################
Initializing Civitai Link
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.9 (tags/v3.10.9:1dd9be6, Dec 6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Civitai Link revision: c4d4b2e
SD-WebUI revision: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2

Checking Civitai Link requirements...
[+] python-socketio[client] version 5.7.2 installed.

#######################################################################################################

Civitai tag problem!

To create a public link, set share=True in launch().
Civitai: Check resources for missing preview images
Civitai: Found 2 resources missing preview images
Civitai: Failed to fetch preview images from Civitai

I don't know why when I install the civitai extension successful,but it still can not appear the tag in the front page,Is there anyone could help me?Many thanks!

Custom dir for models (just like it's done for LoRA)

The preview images are downloaded only if custom models are inside the default directory in A1111 (it works with symlinks, BTW).
But I have a custom folder with many subfolders that I specify at launch with the flag --ckpt-dir.

Same for LoRA, Hypernetworks, Embeddings, etc.

It would be easier, if possible, if the extension would read the values of those flags. But even if not possible, I'd like to have a field where to specify the custom dir.

Renaming resources

The features page states that there is a feature "Flexible Resource Naming in Metadata: Hashify the names of resources in prompts to avoid issues with resource renaming and make prompts more portable"

How to make it actually works like that? Right now when I want resource to be embedded, I have to redownload models so that I have matching filenames, otherwise hashes just won't be included. Even through they clearly match cause extension downloads images for them.

Edit: I think acutally problem is worse now that it was some time ago when I last tried. Now files downloaded from Civitai are named differently and even if use original names they are not embedded. I'll try to experiment and figure something out something more.

Edit2: I figured out that the problem is that the regex pattern used in gen_hashing.py is too restrictive. It looks like this right now:
additional_network_pattern = r'<(lora|hypernet):([a-zA-Z0-9_\.]+):([0-9.]+)>'
Prompt in my image looked like this:

((masterpiece,best quality, detailed)), 1girl, solo, cowboy shot, hands on own hips, outdoors, night, cityscape, starry sky,
<lora:AsukaV1-000016:0.5>, souryuu asuka langley, red bodysuit, interface headset,
<lora:A-Mecha-REN[color_theme,mecha musume, mechanical parts, robot joints,headgear,full armor]:1.5>, (mecha musume, mechanical parts, robot joints, full armor)

The lora names used there were an actual names of files as they download from Civitai. I changed my regex pattern to:
additional_network_pattern = r'<(lora|hypernet):([a-zA-Z0-9_\.\-,\[\]\s]+):([0-9.]+)>'
This allowed them to be hashed properly and website now identify them as resources.
This is by no means a complete solution - I only allowed symbols that were missing in this example. I feel pattern should allow all symbol that filenames allow, or at least whatever Civitai allows to be put in filenames for download. If I'll have more time, maybe I can make better suggestion.

WebUI civitai tab is gone?

i updated to the newest automatic1111 webui (5 days ago). but now the civitai tab is missing, did something change?
Strange also just noticed the buttons seem to be gone on the images (the lightbulb and links to the model

This extension makes SD webui keeps reloading if " --theme=dark" is set to startup parameter

So, in SD webui's "webui-user.bat" file, if we set " --theme=dark" into it, to force it uses dark theme, this extension gonna keep reloading webui's tab forever.

When " --theme=dark" is used, webui will always redirect to "http://127.0.0.1:7860/?__theme=dark".
And seems this addon, want to make it back to "http://127.0.0.1:7860/".

Then, webui's webpage gonna keep redirecting between this 2 addresses forever.

Seems to ignore path options set via command line for Automatic1111.

Automic1111 allows you to set command line options to set your model paths and such. I have noticed when using sd_civitai_extension download, it uses the default directories, ignoring the paths options set.

For example, I have Automatic111 installed in "/home/art/SD_Automatic1111/ " and use "--ckpt-dir /home/art/SD_models" to set my central ckpt model locations.

when downloading using the sd_civit_extension the files are dropped in the default directories for Automatic1111, for me it's /home/art/SD_Automatic1111/stable-diffusion-webui/models/Stable-diffusion.

Hash matching relies on unchanged filenames

I'm looking through the code so I could query the API for my own purposes and I noticed the hashing mechanism relies on the filename being exactly the same as what the asset uploader used. This means if I rename any of my files they will no longer have matching hashes.

This seems like bad behavior and partly defeats the purpose of using hashes

Error loading script: api.py

Error loading script: api.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/civitai/scripts/api.py", line 7, in
import extensions.sd_civitai_extension.civitai.lib as civitai
ModuleNotFoundError: No module named 'extensions.sd_civitai_extension'

Error loading script: gen_hashing.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/civitai/scripts/gen_hashing.py", line 5, in
import extensions.sd_civitai_extension.civitai.lib as civitai
ModuleNotFoundError: No module named 'extensions.sd_civitai_extension'

Error loading script: link.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/civitai/scripts/link.py", line 9, in
import extensions.sd_civitai_extension.civitai.lib as civitai
ModuleNotFoundError: No module named 'extensions.sd_civitai_extension'

Error loading script: pasted.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/civitai/scripts/pasted.py", line 1, in
import extensions.sd_civitai_extension.civitai.lib as civitai
ModuleNotFoundError: No module named 'extensions.sd_civitai_extension'

Error loading script: previews.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/civitai/scripts/previews.py", line 5, in
import extensions.sd_civitai_extension.civitai.lib as civitai
ModuleNotFoundError: No module named 'extensions.sd_civitai_extension'

Error loading script: settings.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/civitai/scripts/settings.py", line 1, in
import extensions.sd_civitai_extension.civitai.lib as civitai
ModuleNotFoundError: No module named 'extensions.sd_civitai_extension'

Auto-detection of python-socketio[client] returns a false negative

Initializing Civitai Link
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]
Civitai Link revision: b72f6d93ec8441d8f73345d8f072c05f24620190
SD-WebUI revision: 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

Checking Civitai Link requirements...
[!] python-socketio[client] version 5.7.2 NOT installed.
stable-diffusion-webui\venv\Scripts\python.exe -m pip install python-socketio[client]==5.7.2
Requirement already satisfied: python-socketio[client]==5.7.2 in e:\stable-diffusion-webui\venv\lib\site-packages (5.7.2)
Requirement already satisfied: bidict>=0.21.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from python-socketio[client]==5.7.2) (0.22.1)
Requirement already satisfied: python-engineio>=4.3.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from python-socketio[client]==5.7.2) (4.3.4)
Requirement already satisfied: requests>=2.21.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from python-socketio[client]==5.7.2) (2.28.2)
Requirement already satisfied: websocket-client>=0.54.0 in e:\stable-diffusion-webui\venv\lib\site-packages (from python-socketio[client]==5.7.2) (1.5.1)
Requirement already satisfied: certifi>=2017.4.17 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests>=2.21.0->python-socketio[client]==5.7.2) (2022.12.7)
Requirement already satisfied: idna<4,>=2.5 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests>=2.21.0->python-socketio[client]==5.7.2) (2.10)
Requirement already satisfied: charset-normalizer<4,>=2 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests>=2.21.0->python-socketio[client]==5.7.2) (3.0.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in e:\stable-diffusion-webui\venv\lib\site-packages (from requests>=2.21.0->python-socketio[client]==5.7.2) (1.26.14)

Still Report this [!] python-socketio[client] version 5.7.2 NOT installed.

excute "python install.py", "ModuleNotFoundError: No module named 'launch'" happen

PS D:\stable-diffusion-webui\extensions> git clone [email protected]:civitai/sd_civitai_extension.git
Cloning into 'sd_civitai_extension'...
remote: Enumerating objects: 274, done.
remote: Counting objects: 100% (129/129), done.
remote: Compressing objects: 100% (83/83), done.
Receiving objects: 100% (274/274), 69.99 KiB | 286.00 KiB/s, done.5

Resolving deltas: 100% (139/139), done.
PS D:\stable-diffusion-webui\extensions> dir

็›ฎๅฝ•: D:\stable-diffusion-webui\extensions

Mode LastWriteTime Length Name


d----- 2023/4/27 20:13 sd-webui-additional-networks
d----- 2023/4/27 20:22 sd_civitai_extension
d----- 2023/4/27 18:42 stable-diffusion-webui-chinese
-a---- 2023/4/27 12:00 0 put extensions here.txt

PS D:\stable-diffusion-webui\extensions> cd .\sd_civitai_extension
PS D:\stable-diffusion-webui\extensions\sd_civitai_extension> dir

็›ฎๅฝ•: D:\stable-diffusion-webui\extensions\sd_civitai_extension

Mode LastWriteTime Length Name


d----- 2023/4/27 20:22 civitai
d----- 2023/4/27 20:22 javascript
d----- 2023/4/27 20:22 scripts
-a---- 2023/4/27 20:22 125 .gitignore
-a---- 2023/4/27 20:22 257 DEVELOPING.md
-a---- 2023/4/27 20:22 2709 install.py
-a---- 2023/4/27 20:22 429 preload.py
-a---- 2023/4/27 20:22 1857 README.md
-a---- 2023/4/27 20:22 30 requirements.txt
-a---- 2023/4/27 20:22 1594 style.css

PS D:\stable-diffusion-webui\extensions\sd_civitai_extension> python install.py
Traceback (most recent call last):
File "D:\stable-diffusion-webui\extensions\sd_civitai_extension\install.py", line 7, in
from launch import run
ModuleNotFoundError: No module named 'launch'
PS D:\stable-diffusion-webui\extensions\sd_civitai_extension>

Installed via Extensions Tab, but no tab appeared.

I'm on Windows.
Other extensions (ex. Image browser) work just fine.

Console says:

Civitai: Check resources for missing preview images
Civitai: Found 1 resources missing preview images
Civitai: No preview images found on Civitai

Maybe that's the case?

Initializing Civitai Link
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]
Civitai Link revision: 579d6940168230daf0d32a1c936c0dd0ba27b433
SD-WebUI revision: 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

Checking Civitai Link requirements...
[+] python-socketio[client] version 5.7.2 installed.

UPD Deleted/reinstalled/restarted Automatic several times, but no joy.

"replace preview" doesn't do anything.

If I use the "replace preview" button on a TI, checkpoint, or LORA, then the screen flashes for a second but the preview image never actually changes. I don't get any errors in the console. Restarting doesn't help.

I get a "There is no image in gallery to save as a preview" error if I don't have a generated image selected. Selecting an image prevents this error, but it doesn't actually update the preview image.

Any ideas?

ERROR: Cannot install launch==0.1.0, launch==0.1.1, launch==0.1.2 and launch==0.1.3 because these package versions have conflicting dependencies.

  1. python install.py

Traceback (most recent call last): File "/root/soft/sd_civitai_extension/install.py", line 7, in <module> from launch import run ModuleNotFoundError: No module named 'launch'

  1. pip install launch
(py310) root@ubuntu20:~/soft/sd_civitai_extension# python install.py
Traceback (most recent call last):
  File "/root/soft/sd_civitai_extension/install.py", line 7, in <module>
    from launch import run
ModuleNotFoundError: No module named 'launch'
(py310) root@ubuntu20:~/soft/sd_civitai_extension# pip install launch
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting launch
  Using cached http://mirrors.cloud.aliyuncs.com/pypi/packages/a9/c1/793768c803a25e2e101ed88fe3979f17d4d67d160aedb3c3bd143653f068/launch-0.1.3.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
  Using cached http://mirrors.cloud.aliyuncs.com/pypi/packages/4a/cd/ba5ade0b40ce222d49d25aa22c6741e5de4a3ce89a5d7db507c749144137/launch-0.1.2.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
  Using cached http://mirrors.cloud.aliyuncs.com/pypi/packages/02/ea/f08cc7605f62868c5bc8ba7d64a7292ea58739696f0d8016a264daeca186/launch-0.1.1.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
  Using cached http://mirrors.cloud.aliyuncs.com/pypi/packages/b0/ef/1b1bca20ef3a088dd6475d9733ef58fcc4db2ab34a19003063d931dc9a28/launch-0.1.0.tar.gz (7.2 kB)
  Preparing metadata (setup.py) ... done
ERROR: Cannot install launch==0.1.0, launch==0.1.1, launch==0.1.2 and launch==0.1.3 because these package versions have conflicting dependencies.

The conflict is caused by:
    launch 0.1.3 depends on flowdas-meta<1.1 and >=1.0.1
    launch 0.1.2 depends on flowdas-meta<1.1 and >=1.0.1
    launch 0.1.1 depends on flowdas-meta<1.1 and >=1.0.1
    launch 0.1.0 depends on flowdas-meta<1.1 and >=1.0.1

To fix this you could try to:
1. loosen the range of package versions you've specified
3. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

system info:
ubuntu 20.04
python 3.10
pip 22.3.1

`Namespace` object has no attribute `lora_dir`

Tried installing into SD Webui using the install from repo URL option, then when restarting it, the below was reported:

Exception in thread Thread-48 (load_previews):
Traceback (most recent call last):
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\alpac\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "F:\StableDiffusion\stable-diffusion-webui\extensions\sd_civitai_extension\scripts\previews.py", line 15, in load_previews
    resources = civitai.load_resource_list()
  File "F:\StableDiffusion\stable-diffusion-webui\extensions\sd_civitai_extension\civitai\lib.py", line 189, in load_resource_list
    resources += get_resources_in_folder('LORA', shared.cmd_opts.lora_dir, ['pt', 'safetensors', 'ckpt'])
AttributeError: 'Namespace' object has no attribute 'lora_dir'

I am running in an anacaonda env

Exception error

Installed via "Install from URL" Commit version 579d694.

[โœ…] Hashed all my models
[๐Ÿšซ] Downloaded preview images for models
[๐Ÿšซ] Able to start Web Browser despite the error
[๐Ÿšซ] Extension tab visible

100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 12.3k/12.3k [00:00<?, ?B/s]
Exception in thread Thread-73 (load_previews):
Traceback (most recent call last):
File "C:\Users\medle\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\medle\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "G:\stable-diffusion-webui-current\extensions\sd_civitai_extension\scripts\previews.py", line 46, in load_previews
hash = file['hashes']['SHA256']
KeyError: 'SHA256'

Where is the tab? How do I make api function work?

For some reason I can't get this extension to actually do anything. I won't connect to the api if I save, relaunch, or restart auto1111.

Is there a tab or way to interact with extension that I'm missing. Is there documentation anywhere?

Civitai plugin does not work concurrent in runpod FSD

After linking my civitai key in a runpod instance, the web interface completely stalled. I had a second instance running, locally that kept working, but my remote web stable-diffusuin-webui interface kept stuck on a load screen, with no tabs, only the five buttons, top right displayed. It was unclear what it was doing so I tried removing the extension and restarting the ui, but it stayed stuck.

I tried restarting, then resetting and reinstalling the pod but nothing seemed to work. The problem was persistent even, after stopping and removing the pod and starting and installing an entirely new pod. I now suspect, through browser cache (chromium), somehow, because what finally did work was running the third pod, in a private instance.

It maybe cost me a dollar, but was a very unpleasant experience.

The image I started was RunPod Fast Stable Diffusion, the simplest europe RTX 4090 on secure cloud. I had about 5 extensions installed beside civitai and uploaded One Checkpoint, one LoRA. I had started txt2img, before installing the civitai plugin, which was running normally.
the plugins were kitchen theme. catpuchino theme, dynamic prompts, one for Lycoris, and civitai extension. The exact moment I linked my civitai key, the interface became stuck.

civitai extension downloads JPEG preview images and calls them PNG

Description

When the extension downloads a preview image for a civitai hosted model, it downloads a JPEG version of the preview image and saves it in a file whose filename ends with .png. Although the automatic1111 can handle such a PNG pretended JPEG file, it confuses users (including me) and many other tools. It could also lead to malfunctioning of some programs.

Proposed solution

civitai extension should save the downloaded JPEG preview files with the suffix .jpg.

Please note that automatic1111 recognizes a file whose name ends with .preview.jpg as a preview image just like .preview.png, as you may already know.

Reproduction steps of the issue

  1. Download your favorite model into the folder models/Stable-diffusion/ in your automatic1111 install.
  2. Make sure there is no preview image file in the same folder.
  3. Enalbe Download missing preview images on startup option and restart automatic1111 web UI. A preview image for the new model is downloaded into the models/Stable-diffusion/ folder with a name *.preview.png.
  4. Use your favorite binary dump tool to see the first 10 bytes of the file. It should be FF D8 FF E0 00 10 4A 46 49 46. It means the file is JPEG rather than PNG.

auto download model failed

Error executing callback infotext_pasted for /Users/zhoudan/work/stable-diffusion-webui/extensions/sd_civitai_extension/scripts/pasted.py
Traceback (most recent call last):
File "/Users/zhoudan/work/stable-diffusion-webui/modules/script_callbacks.py", line 201, in infotext_pasted_callback
c.callback(infotext, params)
File "/Users/zhoudan/work/stable-diffusion-webui/extensions/sd_civitai_extension/scripts/pasted.py", line 14, in on_infotext_pasted
civitai.fetch_model_by_hash(model_hash)
File "/Users/zhoudan/work/stable-diffusion-webui/extensions/sd_civitai_extension/civitai/lib.py", line 299, in fetch_model_by_hash
load_resource(resource)
File "/Users/zhoudan/work/stable-diffusion-webui/extensions/sd_civitai_extension/civitai/lib.py", line 269, in load_resource
resource['hash'] = resource['hash'].lower()
TypeError: 'ResourceRequest' object is not subscriptable

#######################################################################################################
Initializing Civitai Link
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.10 (main, Feb 16 2023, 02:49:39) [Clang 14.0.0 (clang-1400.0.29.202)]
Civitai Link revision: 04a8f49
SD-WebUI revision: 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

Checking Civitai Link requirements...
[+] python-socketio[client] version 5.7.2 installed.

#######################################################################################################

Multiple LoRA Directories

I keep my LoRAs and Lycorises in separate folders. As far as I can tell, there is no way to tell the extension to check two different directories. Is there something I'm missing?

Not working with the Last Benยดs Colab

Hi,

It has happened to me a couple of times that after installing it successfully and downloading some files, it stops working if I execute TLBยดs Colab.

This is the log code when running the last cell of TLB. Automatic1111 starts, but the link doesnยดt longer work, and even on the settings of A1111 the CivitAIยดs option is gone. But the icon on the top right is still there.

The only fix is to delete the extensionยดs folder, but it will gone again the next time.

Civitai: API loaded
Error loading script: link.py
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 248, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_civitai_extension/scripts/link.py", line 3, in <module>
    import civitai.link as link
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_civitai_extension/civitai/link.py", line 4, in <module>
    import socketio
ModuleNotFoundError: No module named 'socketio'

Error loading script: settings.py
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 248, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_civitai_extension/scripts/settings.py", line 1, in <module>
    from civitai.link import on_civitai_link_key_changed
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd_civitai_extension/civitai/link.py", line 4, in <module>
    import socketio
ModuleNotFoundError: No module named 'socketio'

plugin provides message

Initializing Civitai Link
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
Civitai Link revision: 579d694
SD-WebUI revision: 66cfd1dcfc893a9051310c208a66890b86334118

Checking Civitai Link requirements...
[!] python-socketio[client] version 5.7.2 NOT installed.

Why I have deleted this extension, still keep connecting to CIVITAI server

Why I have deleted this extension, still keep connecting to CIVITAI server๏ผŸ

To create a public link, set share=True in launch().
Startup time: 3.1s (list extensions: 0.7s, load scripts: 0.3s, create ui: 1.9s).
Civitai Link: Presence update: SD: 146, Clients: 0
Civitai Link: Presence update: SD: 146, Clients: 0
Civitai Link: Presence update: SD: 147, Clients: 0
Civitai Link: Presence update: SD: 147, Clients: 0
Civitai Link: Presence update: SD: 148, Clients: 0
Civitai Link: Presence update: SD: 149, Clients: 0
Civitai Link: Presence update: SD: 149, Clients: 0
Civitai Link: Presence update: SD: 150, Clients: 0
Civitai Link: Presence update: SD: 150, Clients: 0
Civitai Link: Presence update: SD: 150, Clients: 0
Civitai Link: Presence update: SD: 150, Clients: 0
Civitai Link: Presence update: SD: 149, Clients: 0
Civitai Link: Presence update: SD: 150, Clients: 0
Civitai Link: Presence update: SD: 151, Clients: 0
Civitai Link: Presence update: SD: 152, Clients: 0
Civitai Link: Presence update: SD: 153, Clients: 0
Civitai Link: Presence update: SD: 154, Clients: 0
Civitai Link: Presence update: SD: 155, Clients: 0
Civitai Link: Presence update: SD: 156, Clients: 0
Civitai Link: Presence update: SD: 155, Clients: 0
Civitai Link: Presence update: SD: 153, Clients: 0
Civitai Link: Presence update: SD: 151, Clients: 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.