butaixianran / stable-diffusion-webui-civitai-helper Goto Github PK
View Code? Open in Web Editor NEWStable Diffusion Webui Extension for Civitai, to manage your model much more easily.
Stable Diffusion Webui Extension for Civitai, to manage your model much more easily.
does not work when using --ckpt-dir, --lora-dir command line arguments .
edit: I suggest using shared.cmd_opts.lora_dir
shared.cmd_opts.ckpt_dir
etc. to get model paths
https://github.com/mix1009/model-keyword
這似乎能夠從檔案內找出他的 trigger words
比起 Civitai 頁面上顯示的更精準(有些作者在頁面上填寫的都是錯的)
I just updated to 520128a (Sun Mar 12 15:38:57 2023).
It has been working fine since release, until I updated today.
I last updated Stable-Diffusion-Webui-Civitai-Helper on 3/11/23 and whatever that version was worked fine.
Restarting UI...
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: D:\Downloads\apps\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
Error executing callback ui_tabs_callback for D:\Downloads\apps\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\civitai_helper.py
Traceback (most recent call last):
File "D:\Downloads\apps\stable-diffusion-webui\modules\script_callbacks.py", line 125, in ui_tabs_callback
res += c.callback() or []
File "D:\Downloads\apps\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\civitai_helper.py", line 72, in on_ui_tabs
always_display = setting.data["general"]["always_display"]
KeyError: 'always_display'
Running on local URL: http://127.0.0.1:7860
I'm remote accessing webui, the plugin works but the pages opens on the host machine's browser instead of the current browser. Thinking it will be better to open at current browser.
比如某个模型下载页面,作者发布了V1 V2 V3 三个版本
本地已保存了V1 V2 V3版本,但检查还是会提示V1 和 V2 存在最新版本。
I have about 500 LoRAs and I found remembering the right keyword and weights for each one to be impossible.
So I started a spreadsheet with:
Title | Filename | Catagory | URL | Best Weight | Best Keyword Combo | List of avilable keywords.
I have it then combine the Title and Weight and create a CSV Title and then combine the Filename and weight and best keywords and make a CSV Entry. This gives me a list to import into the styles CSV .
Example
Mazda Miata | Mazda Miata | Object | https://civitai.com/models/16258/mazda-miata | 0.6 | MazdaMiata, 1car
Results in a style entry titled:
LoRA - Mazda Miata - 0.6
With the value being:
<lora:Mazda Miata:0.6>, MazdaMiata, 1car
The idea of this extension is to mitigate a lot of that by automating most of it. However, I would still like to have some creative control over the weight and which keywords it recommends. Some LoRAs only seem to work with a specific order of words or may require extra keywords.
Ideally, I would love to be able to specify the weight and prompt that goes along with each LoRA and have a button on the thumbnail to enter all of that into the prompt box.
I would love to see a metadata editor on the Civitai Helper tab, that would list out all of the models' info files and allow users to specify the best LoRA weight and keyword combo.
I could go to the Civitai Helper Tab
Select the Mazda Miata LoRA
Change the recommended weight to: 0.6
Enter the recommended keywords to be: MazdaMiata, 1car
Then when I am entering a prompt I can select a button that will add <lora:Mazda Miata:0.6>, MazdaMiata, 1car
to the prompt.
If you didn't want to do it on the tab, you could just put an edit button on the Card to edit the metadata.
I feel like this extension can be a super powerful addition to the WebUI and maybe should not be tied exclusively to Civitai. I feel like we need a metadata file next to each object regardless of the origin, and maybe importing that metadata from civitai could just be one feature of it.
There is a pull request on the A1111 repo to add an auxiliary file next to the model for titles or tagging, but it never seemed to go anywhere.
AUTOMATIC1111/stable-diffusion-webui#7953 (comment)
Maybe some collaboration could play in there.
我看英文的README有通过URL安装的。
但是安装报错
GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git fetch -v origin stderr: 'fatal: unable to access 'https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper/': OpenSSL SSL_read: Connection was reset, errno 10054'
Hey @butaixianran super happy to see this.
Lots of good stuff here, would you be interested in merging this with the official extension? It'd be great to have someone help take the lead on the extension. We're a small team and I (the lead dev for the extension), haven't worked with Python and Gradio much so there's lots of things I'm still learning.
I especially like the following functionality of the extension:
.info
store of resource dataLet me know if you're interested in collaborating :)
Hi butaixianran
Many thanks for your effort. I'm a developer myself and really like the extension you created. In our community (https://discord.com/invite/dFB7zuXyFY), we have some additional ideas to integrate into this extension.
Are you cool with it, if i implement those features and send a pull requests to you?
Best regards
jokker
Edit: guess it would be pretty much what was mentioned in #18
Hey, great extension!
Would it be possible to add a button to the Civitai Helper page to "Scan for model updates"? It would check each model page to see if there is a newer version than the current model hash, and if so it shows a notification icon on that model in the Extra Networks list.
This would make it so much easier to check which of your models have new versions available to download.
Thanks
打開 Civitai 頁面應該由目前瀏覽器開啟 而非由 API 去開啟瀏覽器
First of all, thanks for your affrod and in fact this is the most useful extension for any webui users. I do not understand why CivitAI take so long for such importent extension to be integrated into WebUI, but your afford is appreciated.
Hereby I suggest to add in a feature call "model's alternative name".
As most of CivitAI model has lengthy file name and it is sometime hard to read from the "extra cards" section. An alternative file name will also helpful for quick picking or in some occations that when the model's orignal file name might not originated from english. e.g. guofeng_v3 which user can choose to display it's alternative file name as "国风" in the extra card section.
The default filename formats in A1111 Web Ui gives
Embeddings: Filename.preview.png
Hypernetwords: Filename.png
CKPT: Filename.png
LoRAs: Filename.png
This is the format that the WebUi will create when you have it save the current image to be the thumbnail.
The Civitai Helper uses the first format for ALL 4 types. This caused it to create hundreds of redundant thumbnail images, as most of my models already had a thumbnail image but they did not include the .preview. in the name.
The option to insert the current preview image prompt often inserts the wrong prompt or no prompt at all.
I believe this is because it is grabbing the prompt from Civitai and storing it in the info file.
This fails when the image on civitas didn't display a prompt or when the user presses the button to insert a new preview image.
The reality is 99% of the time even when the metadata doesn't display on civitai.com, you can still download the image and drop it into PNG info and still display the prompt.
Example: https://civitai.com/models/16669
I recommend that the images get processed by the PNG info and that data gets stored in the info file.
Likewise, when the image is replaced with a new thumbnail the metadata should be updated to reflect this.
1.按过自带的add network刷新按钮后(且真的有内容更新的话),刷新c站助手按钮似乎无效了;
如果自带的刷新且有内容更新(无内容单纯按没事),c站助手那些按钮会消失了,点刷新c站助手按钮也无效
2有些lora作者发布了多个格式的版本,不是默认版本就不会下到预览图
比如https://civitai.com/models/13941
v2这个版本右侧下拉如果选pickleTensor就能下到预览图,如果选了不是默认的,比如safeTensor就不行
更新的时候是否可以有log,这样旧的就不用重新扫描或者跳过,不然重新加进几个后又扫描的话时间太久了,一个一个更新又麻烦 advntr.civitai.info和preview.png如果发现lora或者embedding文件旁边有这两个文件也可以直接跳过,
Google Colab crashes while scanning because RAM usage spikes. I tested if this was a model specific issue and it was not. Here is the crash log although I don't know what might provide.
Civitai Helper: Using Memory Optimized SHA256
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/scripts/lib/util.py", line 18, in gen_file_sha256
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/scripts/lib/util.py", line 18, in <lambda>
OSError: [Errno 107] Transport endpoint is not connected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/gradio/routes.py", line 337, in run_predict
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 1015, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 833, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.9/dist-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/scripts/lib/model_action_civitai.py", line 34, in scan_model
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/scripts/lib/util.py", line 19, in gen_file_sha256
OSError: [Errno 107] Transport endpoint is not connected
Interrupted with signal 2 in <frame at 0xe1091450, file '/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py', line 150, code sigint_handler>
File "C:\path\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\lib\downloader.py", line 93, in dl
sys.stdout.write("\r[%s%s] %d%%" % ('\u2588' * progress, ' ' * (50 - progress), 100 * downloaded_size / total_size))
UnicodeEncodeError: 'cp949' codec can't encode character '\u2588' in position 2: illegal multibyte sequence
I believe adding the code below will fix it.
import io
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
Hi!, ty so much for make this extensions c:, but I would like to ask for something.
Could be possible move from a tab in the main UI, to a tab in settings section? I already have a lot of tabs :<
This functionality maybe is going to be used around once a week.
Ty so much.
When using Scan Models for Civitai there's a few behavioral quirks that are annoying - not a big deal, and there are workarounds, they're just time consuming.
Scan will overwrite images that I've changed in photoshop, back to the replaced main image, but it WONT replace ones I saved and generated directly in A1111 (!??). Its annoying but work-around-able, as my ideal is actually the reverse situation for most models!
---->I'd greatly prefer to be able to choose to replace (or not) the info/images for models that already have info/images on a per model basis, and have the option to scan only models that have no info/images, like the "only show models have no info" toggle under "Get Model Info from Civitai by URL"
It would also be nice to be able to be able to choose which of the demo images would be best, on a per model basis if the default one is less than helpful after cropping.
When "skip NSFW Preview images" is ticked, it does not check the next image is SFW, but just stops, and at least occasionally there's SFW images behind the NSFW previews. I don't know how N/SFW is implemented in civitai backend so no idea if its doable/reasonable.
When pressing "Add Trigger words to prompt", it adds all the words next to each others without a comma or space.
Hi, thanks for the extension.
I have my models on a different drive, also, to save disk space I prune all my models, and also, I change the files to .safetensors
The HASH change when I prune the model and change the file type, may I ask, it is possible to detect models with the filename? I always leave the filenames the same.
None of the models are getting the previews and info.
Also, every time you click on Refresh civitai Helper, the icons duplicate.
The extension seems to fail if you have any files in subfolders even though Stable Diffusion has no problem with this. For instance all my models are divided into sub-folders named things like characters, styles, etc. The extension ignores these and only gets information for anything in the models/stable-diffusion folder.
This is a good extension especially for fetching thumbnails. However it would be cool if the main Scan button had an option to select which types of models to scan: checkpoints hypernetworks, embeddings and/or Lora.
Currently it scans everything, which can be slow especially when scanning lots of checkpoints. If you only need to scan Lora for example and don't really need to scan for checkpoints, you have to wait for the scan to process checkpoints first, unless you move their folder back and forth after processing what you only need to scan.
A row of checkboxes to enable/disable the types of models to scan, or even a dropdown to select which type would speed up the scan.
如果lora是放在路径extensions\sd-webui-additional-networks\models\lora要如何配置?
I am creating a template (simple but functional) to generate the gallery for each model on the local computer. I think it is very interesting to have the maximum of information of each one in local and not to depend on connection to the web to consult it.
I think it could be introduced in civitai-helper and if you like, optimize the use of the models.
An example:
Perhaps you can add a custom directory box to detect model updates, upgrades, previews and information downloads. This is of great significance to people who have less storage on a single disk and more than one disk. For example, one of my disk programs is SD, including models (which have occupied most of the storage), and the other disk is used to download and store new models and infrequent models,So every time I download preview images and updates, I need to transfer them. I hope you can see my suggestions. Thank you for your plug-in. It is really very practical
#8
情况与此 issue 一致,原因为将 Default view for Extra Networks(附加网络默认视图)设置为 thumbs(小图式)。
Can you format the civitai.info json files so they are indented?
Should be easy to do with data = json.dumps(content, indent=4)
I'd like it to be human readable so that I can add my own trigger words if the author doesn't include them.
Add a button next to the "Refresh Civitai Helper" to show/hide NSFW preview pictures.
scan的时候出现Civitai Helper: Failed to get model_info,我把这个文件移走再scan,结果其他文件又出现相同的Failed to get model_info了,就这么弄了好几次,总是有文件报Failed to get model_info的错误。我看了一下,有些文件不是在c站下的,但是也有文件就是从c站下的。所以在scan能不能把这些找不到info文件直接略过,我这里有上百个文件,一个一个弄太麻烦了。
The 'Use Prompt from Preview" rarely reproduces the image it was aiming for since it doesn't apply any settings related to Height / Width / etc..
Maybe this is out of scope and the goal of the button was only to generate a prompt that works for X network?
If so, could we have a way to chuck the preview image in PNG Info?
If you think either of these are out of scope - just close the issue.
Thanks - This extension has been a life saver, the Quality of Life time saving it's done is immeasurable.
增加通过hash搜索模型和lora的功能;
增加 PNG Info 中图片依赖的模型和lora的搜索和下载功能;
增加从 Copy Generation Data 中复制下来的文本反查所有依赖模型的功能;
这可以帮助我们复现别人的结果,让这个工具实用性更强
**Having trouble using the scan function to create info files/previews for newly added Loras/hypernetworks/etc...
This issue only started happening today
Using the latest version installed from git url**
`Civitai Helper: Start scan_model
Civitai Helper: Scanning path: C:\Users\USERNAME\Documents\StableDiffusion\stable-diffusion-webui\embeddings
Civitai Helper: Checking preview image for model: C:\Users\USERNAME\Documents\StableDiffusion\stable-diffusion-webui\embeddings\bad-hands-5.pt
Civitai Helper: Model Info is empty
Civitai Helper: Creating model info for: cutev2-11000.pt
Civitai Helper: Calculate SHA256
Civitai Helper: Using Memory Optimized SHA256
Civitai Helper: sha256: 9bcbf6133c7e6067e2e517135c92762b384c1e214dde8a0565ed0e3da618f6ba
Civitai Helper: Request model info from civitai
Civitai Helper: Get error code: 403
Civitai Helper:
<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>7a6df2372cd232e4</code></div>
</div>
<div class="text-center" id="footer-text">Performance & security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
Civitai Helper: Failed to get model_info`
Similar results happen when trying to load info from url
`Civitai Helper: Run get_model_id_from_url
Civitai Helper: Run get_model_path_by_type_and_name
Civitai Helper: Request model info from civitai
Civitai Helper: Get error code: 403
Civitai Helper:
<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>7a6e0253db3c334e</code></div>
</div>
<div class="text-center" id="footer-text">Performance & security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
Civitai Helper: Failed to get model info by id: 18696
Civitai Helper: failed to get model info from url: https://civitai.com/models/18696/tae-takemi-or-persona-5
`
Let me know if there is any other info I can provide to help clarify things.
Thanks for the amazing work and great extension!
Since we can save and load settings, I think it is a waste not to include this option.
Very good plug-ins, Setting of Default view for Extra Networks usually in the card mode, take up a lot of computer screen space. I like to switch to the thumb mode, which is easier to see the overall situation, hope in the thumbs mode,one click to create prompt "lora:loraname:multiplier and tag" will be better choose。
很好的插件,通常card的模式下,会很占电脑屏幕空间,影响工作效率,我喜欢切换成thumbs模式,更容易看全局,希望在thumbs模式加入点击一次生成"lora:loraname:multiplier 和 tag"
Or added as an option.
e.g.:
/Lora/filename.safetensor
/Lora/_helper/filename.civitai.info
/Lora/_helper/filename.preview.png
Not a bug but more like a missing feature - an indication in the UI that it is working would be appreciated. I initially clicked the 'scan model' button more than once because I did not see any indication of activity in the UI.
An indication in the shell or ui that it is complete would also be great.
First, thank you so much for making this!
If possible it would be amazing to be able to add custom tags to our TI, Ckp, Lora, HN, etc. so that I could say add a "Character" tag to all my character/person based Lora and easily find them, same for Styles, Helpers, Negatives, Utilities, etc.!
The ability to store a note that we could put in our trigger words and used prompts for quick reference on each of these it would save a lot of moving between documents / sites and looking up stuff making the entire workflow faster.
Download updated models/lora/embeddings without having to manually go to the site to download them, and also the option to delete old models automatically.
NSFW toggle on the main WebUI that will filter out all NSFW when its on. (some times I want to show people things, but dont want those visible, my kinks are my own :P )
Again I really appreciate your efforts and if these requests are not possible I understand.
因为从Civitai以外地方下载的lora也很多,希望能增加一个存储录入自定义tag的功能
if "url" in img_dict.keys():
#修改处########
imgurl = img_dict["url"]
imgurl = re.sub('/width=\d+/', '/width=' + str(img_dict["width"]) + '/', imgurl)
printD("Sending request for image: " + imgurl)
#get image#######
img_r = requests.get(imgurl, stream=True)
###############
正则替换了下载路径的分辨率
Can there be a button to create a wildcard containing all the installed loras and their trigger words?
I have about 500 LoRAs, when I view them in thumb view the icons seem to always be on and almost completely cover the image.
Is there any way to make them only appear when you mouse over an image? Or a button to toggle the icons on and off.
I also think maybe the thumbnail view could just have two icons, Replace image, and Insert Keywords. There really isn't a need to have the URL icon on the thumb view.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.