dominikdoom / a1111-sd-webui-tagcomplete Goto Github PK
View Code? Open in Web Editor NEWBooru style tag autocompletion for AUTOMATIC1111's Stable Diffusion web UI
License: MIT License
Booru style tag autocompletion for AUTOMATIC1111's Stable Diffusion web UI
License: MIT License
I've been told this is an issue with autocomplete not supporting the new wildcards extension version of A111. See more at: AUTOMATIC1111/stable-diffusion-webui-wildcards#1
Wildcards are also now stored in extensions\wildcards\wildcards.
Autocomplete only checks inside \scripts\wildcards
Many thanks.
English is not my native language; please excuse typing errors.
When autocompleting tags , I can only seem to use the arrow keys and enter or click the candidate with the mouse, I feel this is not very easy to use.
It might work better if you could just press TAB to complete the first candidate as soon as one is available, and would also be in line with most ides
Tagcomplete version: 92a0820
Editing tag in weight parenthesis and no tag list shown, different from the demo here.
Editing tag in simple weight syntax ((<tag>)
, [<tag>]
) and no tag list shown unless blanks before and after the tag.
When edit cat
in (cat)
(alias of (cat:1.1)
), it searchs (cat)
exactly, only tags like chen_(cat)
matches but cat_ears
do not.
discussion: tag can and many of them do have parenthesis, but that's not needed when speaking of searching at most of times, for example cat
have hundreds of related tags while (cat)
is a valid tag component too but have only 9 matches out of 10k tags.
So maybe it's safe (or to say tolerable) to ignore parenthesis of user input?
I've had to completely remove this since it's causing way too many issues with typing anything into text2img. It basically made me think my keyboard was broken since almost every word i typed would miss letters or miss spaces out. Not sure what is causing it but after removing it completely it has gone back to the way it was.
I really like this addon for A111 and it's been really useful to me in generating prompts but I wish we could perhaps choose what parts of the script are used. For example to be able to disable wildcards/embedding/etc so that the user can pick what they want. For example, i don't really use wildcards/embeddings most of the time if at all but I like using the danbooru/e621 auto complete tags and it gives me ideas when using it that I might not have thought about.
Obviously this is your project and I don't want to come across as being one of those users that demands things every day but I wanted to report what i've found.
Using https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/releases/tag/1.7.3
Firefox
Windows 10
The ctrl+↑ combination key fails after installing the plugin.How to solve this problem?
I installed this as instructed in the readme as an extension. Then once the webui is in final stages of loading up this error pops up. (note that the webui still functions and I can produce images, just the extention keeps spitting out errors constantly, the error following is the first error I get").
Error loading script: tag_autocomplete_helper.py
Traceback (most recent call last):
File "/content/stable-diffusion-webui/modules/scripts.py", line 168, in load_scripts
exec(compiled, module.dict)
File "/content/stable-diffusion-webui/extensions/tag-autocomplete/scripts/tag_autocomplete_helper.py", line 24, in
TAGS_PATH = get_tags_base_path()
File "/content/stable-diffusion-webui/extensions/tag-autocomplete/scripts/tag_autocomplete_helper.py", line 18, in get_tags_base_path
if (script_path.is_relative_to(EXT_PATH)):
AttributeError: 'PosixPath' object has no attribute 'is_relative_to'
Looking at the error message I think the issue is script_path is not initialized. I looked at the code and the following is where its initialized.
a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py
Lines 16 to 18 in 372a499
I had downloaded the latest version through the Git clone that puts it into the extensions folder.
Ever since it only works when there are no () prompts anywhere in the positive ones.
As soon as you add one at any spot it just breaks and does not show the menu anymore. And that's when you try and add one before or after a () prompt.
Not a cache issues since that's cleared. Originally i had it in my Stable Diffusion folder itself and that worked without issues. Those files are gone now since i replaced it with a fresh git clone into the extensions folder.
Also running this Locally on a Linux machine, if that matters.
The wildcard embedding works great, but is it possible for the available wildcard lists to be located by looking through the directory? I can't really think of a reason why you would not want a list to show up, and it makes adding a bunch of lists more of a hassle.
You use extensions/wildcards/wildcards
Following the instructions on the wiki page will by default have wildcards at extensions/stable-diffusion-webui-wildcards/wildcards
I added the script on sd-webui and it work.
But I changed "tagFile" to customtags.csv and "maxResults" to 8 but there is no my custom tags csv and maxresults still is 5
Hello,
I was making a custom tags file, and added my embeddings (textual_inversion) as tags in the form "<name_embedded>" to enable autocompletion and stuff.
After editing my target csv file I noticed that the autocomplete function filters correctly but does not show the element in the list (the tag <name_embedded> appeared like '' )
I resolved the issue escaping the < and the > symbols with the html equivalent.
The line I edited
a1111-sd-webui-tagcomplete/tagAutocomplete.js
Line 272 in fbfc988
was replaced with
li.innerHTML = result[0].replace('<','<').replace('>','>');
and the issue is solved.
I mean, I know that the custom script is based on danbooru tags but maybe the scripts need html escaping to avoid those types of issues.
I think it would be very useful to have the tag count next to the tag name when selecting from the list. This would allow us to select a tag based on its popularity when there are multiple similar tags to choose from.
Not sure how much extra work that would be though.
add support for install this prog as extension (like wildcards)
Extensions
Now it read tag from web UI installation root folder.
This script is maybe the most helpfull that I ever installed. But the update is may be the weakest part. Migrate it as an extension could fix it at all.
Thanks for your work.
It will be great if this script can also load embeddings in the folder and auto complete them.
Hope to open the discussion module, so that we can share the translation of Tag
Using google translate and 5k+ line from https://ngabbs.com/read.php?tid=33869519
danbooru-0-zh-ver1.csv
tagcomplete works perfectly everywhere in prompt in one line, for example cat, dog, girl
But with newlines (which is valid for webui), it has problem handling it
For example in prompt:
cat, dog,⛔
⛔girl
tagcomplete is not working in position of ⛔
mark, while it's working in position of ✅
mark
cat, dog,✅girl
I got a embedding in png format, its token is something like emb_1.5
This embedding can't be recognized and not shown in the tag drop down list when type <
(yes, it can be used correctly and recognized by the Train
tab), I don't know how to change the token, changing the filename is not working, only emb_1.5
can active that embedding
I'm not sure legal characters for token of embedding, maybe other characters also triggers this bug but I don't know
p.s. Can you tell me about the <embedding name>
thing? I think I saw this angle brackets syntax somewhere before but I can't find it now in wiki of a1111's webui here or here, did this syntax removed or something? Or is this a tagcomplete feature?
I can only get autocomplete to work up to v1.2.2 but any version after that never brings anything up. Running the latest version of A111 via git pull on launch.
Not sure if related:
acConfig.activeIn is undefined TypeError: acConfig.activeIn is undefined <anonymous> http://127.0.0.1:7860/:1824 <anonymous> http://127.0.0.1:7860/:1814 runCallback http://127.0.0.1:7860/:82 executeCallbacks http://127.0.0.1:7860/:88 mutationObserver http://127.0.0.1:7860/:93 MutationCallback* http://127.0.0.1:7860/:92 EventListener.handleEvent* http://127.0.0.1:7860/:91
up dated the script to the newest version and now it is not working, regardless of the tick box saying auto complete on. no errors when running the script on start up.
比如我想补全solo,但即使4个字母都打出来也没有出现想要的选项,得往下翻,可以自选怎么按照标签类型排序吗?
还有,可以按照字母顺序补全吗,比如我输入cat,补全就首选前三个字母是cat的
[我用google机翻了下tag,基本可以凑或用,中文好像得以utf-8保存,不然会乱码
danbooru.csv
Hello i'm user https://colab.research.google.com/github/TheLastBen/fast-stable diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb
Error loading script: tag_autocomplete_helper.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 170, in load_scripts
exec(compiled, module.dict)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/tagcomplete/scripts/tag_autocomplete_helper.py", line 77, in
write_tag_base_path()
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/tagcomplete/scripts/tag_autocomplete_helper.py", line 63, in write_tag_base_path
f.write(TAGS_PATH.relative_to(FILE_DIR).as_posix())
File "/usr/lib/python3.7/pathlib.py", line 900, in relative_to
.format(str(self), str(formatted)))
ValueError: '/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/tagcomplete/tags' does not start with '/content/gdrive/MyDrive/sd/stable-diffusion'
how can it work?
It's even working with very wrong syntax, but a simple parenthesis breaks it with the latest version a038664 🤔
Uncaught (in promise) TypeError: can't access property "style", y is null
k http://127.0.0.1:7860/assets/index.6d1e8daf.js line 1704 > srcScript:1
3 [index.6d1e8daf.js line 1704 > srcScript:1:2468](http://127.0.0.1:7860/assets/index.6d1e8daf.js%20line%201704%20%3E%20srcScript)
Uncaught (in promise) TypeError: can't access property "length", x[2] is undefined
tags http://127.0.0.1:7860/:2028
autocomplete http://127.0.0.1:7860/:2028
<anonymous> http://127.0.0.1:7860/:2343
dbTimeOut http://127.0.0.1:7860/:1752
11 [127.0.0.1:7860:2028:26](http://127.0.0.1:7860/)
As the title states, I assume this script is only meant to be used with a certain stable diffusion model, so it would probably be good to add support for via the config file, specifying whitelisted models (aka models that accept these kind of tags) and only autocomplete IF one of these models are being used.
If due to my ignorance, or lack of knowledge this is supposed to be used with all sorts of models, then you can close this issue :)
(Copying from adieyal/sd-dynamic-prompts#20 (comment))
When writing a prompt, I can use the tab key to autocomplete wildcards. This is very useful, except it will auto-complete whichever one is the top one, rather than filling in only what is "common" to the current possibilities. This means I have to type out a considerable amount before I can auto-complete usefully.
For example, if the three files are "foofoo", "foobar" and "foobaz". I would expect the following:
f<TAB>
becomes "foo"foob<TAB>
becomes "fooba"Currently, f<TAB>
would just autocomplete whichever happens to be first in the list of possibilities.
Additionally, this happens when auto-completing tags, not just wildcards, I just hadn't used tag autocomplete enough to notice it.
I use the colab version of lastben (https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb) Based on python3.7
Seems the extension can't read the correct path of the tag folder.
How to change the path?
Error loading script: tag_autocomplete_helper.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 170, in load_scripts
exec(compiled, module.dict)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 77, in
write_tag_base_path()
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 63, in write_tag_base_path
f.write(TAGS_PATH.relative_to(FILE_DIR).as_posix())
File "/usr/lib/python3.7/pathlib.py", line 900, in relative_to
.format(str(self), str(formatted)))
ValueError: '/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete/tags' does not start with '/content/gdrive/MyDrive/sd/stable-diffusion'
A111 now has the ability to have scripts and javascript to be added as an extension without having to have scripts and javascript populate outside of [basedir]/extensions/extension-name
It also offers the ability to update from github from inside A111.
I've done a quick test of your script loaded as an extension and as far as I can tell it all works like normal.
You might want to consider asking Automatic1111 to add your script to the list located at: https://raw.githubusercontent.com/wiki/AUTOMATIC1111/stable-diffusion-webui/Extensions-index.md
Any time I'm trying to correct a spelling mistake with left and right arrow it focuses the popup instead.
I would expect that the up and down arrow keys would function to select from the autocomplete popup. Not the left and right arrows.
I followed the instructions and ensured everything is in it's proper directory, but the autocompletes appear to not be turned on at all. I am receiving this error:
Cannot read properties of null (reading 'children') TypeError: Cannot read properties of null (reading 'children') at updateOnBackgroundChange ((index):773:45) at (index):910:5 at runCallback ((index):82:9) at Array.forEach (<anonymous>) at executeCallbacks ((index):88:11) at MutationObserver.<anonymous> ((index):93:9) runCallback @ (index):84 executeCallbacks @ (index):88 (anonymous) @ (index):93
I'm 99% sure the error is related to the above. I made sure and disabled plugins as well to rule them out.
The plugin "iCloud Passwords", the Apple password manager, breaks this plugin, fyi.
Normally, the tag autocomplete works perfectly
examples below use the word ninja (忍者)
But autocomplete dosen't show up after stop inputting Chinese characters
Generally, Chinese native speakers use some kinds of input methods (or 输入法) as an assistance to input Chinese characters
After typing alphabet representations, one could choose right characters by pressing number keys or space (for current choice) or enter(for reserving inputted alphabets)
As shown above, autocomplete dosen't seem to work in these kinds of occasions. I vaguely remember that it was working few versions ago, but I'm not sure about how to test again
In additional, autocomplete for deleting seems to have similar problem
The default keyboard shortcut of highlighting a tag, then pressing ctrl+up or control+down to increase or decrease emphasis breaks because the up and down arrows inputs get sent to the dropdown instead.
Hey again!
I installed this project as an extension under the directory /root/data/extensions/a1111-sd-webui-tagcomplete-main/*
as instructed, /root/data
is my webui root.
But I get this error when running the app RuntimeError: File at path /root/data/tmp/tagAutocompletePath.txt does not exist.
Not sure why it is searching within the ./tmp
directory?
I am using the latest Automatic1111, and the latest of your code.
I also removed all the old files from your code before installing this one. Could there be any cached files left around?
Also cleared my cache just to be sure.
Thanks!
\extensions\tag-complete\
test.csv
with content below and save with UTF-8 encoding, place it into \extensions\tag-complete\tags\
solo,0,单人
\extensions\tag-complete\tags\config.json
from "extraFile": "",
to "extraFile": "test.csv",
sol
in prompt textboxJavascript File is in the right place, and so is the "tags" Folder (btw both Version 1.4.2)
(index):80 Cannot read properties of null (reading 'querySelector') TypeError: Cannot read properties of null (reading 'querySelector')
Yet there is no popup or anything showing up when I load the Web-UI.
I even tried it with another Browser (default Firefox, other being Chrome) and the result is the same.
As non-native english speakers, we're not sure what we want or the exact spelling at most of the times, that's why showAllResults
is set to true
by default in chinese translate version
The typical usage is, user type few characters they remember and scroll down hundreds times to find out the exact word they want, or google if not found then
So the dropdown list with many result would be more convenient to use by supporting scroll actions (page up/page down/home/end)
Do you think you can make this script work with the wildcard tokens from this script as well?
The idea is twofold:
First, after typing __
(two underscores), you get a list of all available .txt files. Selecting one completes the token.
Then, the list changes from available token names to the items of that list. Selecting one replaces the token with the item.
So, as an example:
__
shows a list of the wildcard files, like artist, adjective, style,...
adjective
replaces the __
with __adjective__
angry,beautiful,dark,...
__adjective__
with beautiful
http://127.0.0.1:7860/file/tags/config.json 500 internal server error
Normal tag autocompletion works fine, but wildcards and embedding autocomplete are not shown. In tags/temp , wc.txt and emb.txt are listed normally. I wonder if there is something I am missing.
Version used: 1.5.1
When showAllResults
is true
(as I said in #34 (comment), it's basically necessary for chinese users), characters maybe swallowed when typing, even with small resultStepLength
(50
in my case)
A possible and popular way to solve this is to delayed the keypress event handler until user stop typing, or handle it asynchronously
For example generate the dropdown list keypressHandlerDelay
ms later after user stops typing, the default value of the delay could be 300
ms or something and can be changed in config.json
Embeddings in png type is not shown when type <
Interfere vanilla hotkey to chagne weight, i.e. select a word and press ctrl+↑
or ctrl+↓
to quick change weight of it. With tagcomplete runnig, this hotkey no longer works
For example double click to select word dog
in prompt girl, (sad:1.5), dog
and press ctrl+↑
, the prompt changes to girl, (sad:1.5), (dog:1.1)
automatically, when tagcomplete is not installed
Have problem showing complete drop list inside weight parenthesis when edit existed tag
For example select dog
in girl, (sad:1.5), dog
and type runn
to overwrite it, the tagcomplete list shows and I can tab
to select running
But select sad
and type runn
to overwrite it, no list shows.
Select sad
and type runn
still no list show.
Select sad
and type runn
the list shows but tab
or click running
nothing happens.
With a lot of wildcards performance drops massively.
I got it turned off for now, and works fine with regular tags.
I'm using the wildcards from the dump on https://rentry.org/sdupdates so 483.
More than a dozen slows things down, more than a couple hundred makes the webui unusable.
tagcomplete add comma when select a tag from result unless it's
However there're many situation that comma after a tag is not needed
multiple tags in parenthesis for example complete (wet swimming:1.2)
Some people suppose that even for novelai model, natural sentence works better than tag style when describe background and actions, I feels it's true so I use more natural sentences now, that's when the auto suffix is unnecessary or even bothering
In this demo I have to press backspace
many times to write a short sentence
The smart detection is limited, ,
is not added to (<tag>:<number>)
, but still added to (<tag>)
or [<tag>]
, it only works when editing too, writing (dog ears:1.2)
character by character with tagcomplete you get (dog ears, :1.2)
It's not needed in editing, change cat
to cat ears
in girl with cat and tail
with tagcomplete
the result will be girl with cat ears, and tail
(note there are two space after ,
)
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.