A1111/Forge illustrious Prompt Sorter Tool
详情
下载文件
模型描述
我选错了分类。
由于这里可以进行版本管理,我已经删除了Articles中的文章。
从生成图像出现崩溃开始,现在也该进入最终章了。
正式版本已从「A1111/Forge的TAG分类说明(词典数据,暂定)」发布。词典会持续修正。
我原本以为,暂定版中“词典可以通过自己的生成图像,用TAG工具逐步培养”就可以了,但这样没完没了。
“那用ダンボール文件?但文件太大,内容又看不懂。”——我一度犹豫退缩。
但还是鼓起勇气,为ダンボール文件添加了索引,并在力所能及的范围内进行了分类。
这个工具的作用是:使用此词典,对关键词(提示词)进行重新排序。
我使用了扩展插件“a1111-sd-webui-tagcomplete”自带的“danbooru_e621_merged.csv”作为ダンボール文件。
之前也提过,“illustrious的令牌限制为150个”。
提示词分为两个75个令牌的块(chunk),最多150个令牌。
超过150个令牌的部分会被截断。
前75个令牌用于设定:角色名、角色固有外观、服装、作品标签。
后75个令牌用于设定:构图、背景、画风修正。
本工具的目标,就是将输入的提示词按此结构重新排序。
本工具仅适用于illustrious系列,不支持pony的下划线“_”。
不过,如果努力的话,也可以为pony制作词典(我的Excel文件)……
词典概要如下:
【0. 通用/质量】Dic_Knd: 000系列
1girl, solo, 等
【1. 角色名】Dic_Knd: 100系列
<角色名>
【2. 固有外观】Dic_Knd: 200系列
发色、发型、眼色、特征部件(丝带、发饰、呆毛等)
【3. 服装】Dic_Knd: 300系列
服装名称、颜色、装饰、作品专属服装元素
【4. 作品标签】Dic_Knd: 400系列
作品名、系列名
【5. 构图(最重要)】Dic_Knd: 500系列
我自行理解为:行为、动作、物体状态
solo, single panel, full body / upper body, looking at viewer, standing
【6. 背景】Dic_Knd: 600系列
detailed background, room / outdoor / sky / moonlight 等
分类不明的,也归入600系列。
【7. 画风修正】Dic_Knd: 700系列
sharp lines, vibrant colors, detailed face, clean shading
此分类方式与之前说明一致,现在说明工具使用方法。
解压附带的ZIP文件后,文件结构如下:
只要此结构不被破坏,文件夹位置可任意,工具使用相对路径运行。
工具基于Python编写,我在Windows 11环境下运行。

・tagin
放置待排序的文件。请使用“*.txt”文本文件格式。
工具将批量处理该文件夹内所有文件。
・tagout
存放排序后的结果,以文本文件形式保存。
批量处理多个文件时,会生成独立的文本文件。
・dic.csv
词典文件。排序时,若提示词不在词典中,会自动追加到词典末尾。
你可以自行重新分配Dic_Knd编号(分类)。
工具共两个,通过批处理文件启动。功能相同,仅输出格式不同。若处理约10个文件,瞬间即可完成,约1秒?
使用TAG工具打标签时,数据顺序是杂乱的,像这样:
1girl, solo, long hair, breasts, looking at viewer, blush, blue eyes, long sleeves, hair ornament, holding, ribbon, closed mouth, medium breasts, blue hair, full body, hair ribbon, ponytail, flower, weapon, sidelocks, thighs, outdoors, japanese clothes, alternate costume, socks, sword, blunt bangs, hair flower, wide sleeves, black footwear, kimono, holding weapon, mole, tree, v-shaped eyebrows, legs, mole under eye, sash, bare legs, floating hair, holding sword, white socks, sandals, floral print, obi, squatting, grass, high ponytail, katana, nature, pink flower, pink ribbon, forest, light blue hair, tress ribbon, glint, stairs, back bow, tabi, print kimono, pink kimono, on one knee, bamboo, zouri, flower knot, obijime, okobo, bamboo forest, blunt tresses, kamisato ayaka
・使用tag_sorter.bat启动时,输出格式为单行显示全部:
1girl, solo, kamisato ayaka, long hair, blue eyes, medium breasts, blue hair, hair ribbon, ponytail, sidelocks, blunt bangs, mole, mole under eye, floating hair, high ponytail, light blue hair, blunt tresses, long sleeves, hair ornament, ribbon, japanese clothes, socks, hair flower, wide sleeves, black footwear, kimono, sash, white socks, sandals, floral print, obi, pink ribbon, tress ribbon, back bow, tabi, print kimono, pink kimono, zouri, obijime, okobo, alternate costume, BREAK, breasts, looking at viewer, blush, holding, closed mouth, full body, thighs, holding weapon, v-shaped eyebrows, legs, bare legs, holding sword, squatting, flower, weapon, outdoors, sword, tree, grass, katana, nature, pink flower, forest, glint, stairs, flower knot, on one knee, bamboo, bamboo forest
为区分前半块与后半块,插入了“BREAK”。
・使用tag_sorter_div.bat启动时,输出格式按块分行显示:
1girl, solo, kamisato ayaka, long hair, blue eyes, medium breasts, blue hair, hair ribbon, ponytail, sidelocks, blunt bangs, mole, mole under eye, floating hair, high ponytail, light blue hair, blunt tresses,
long sleeves, hair ornament, ribbon, japanese clothes, socks, hair flower, wide sleeves, black footwear, kimono, sash, white socks, sandals, floral print, obi, pink ribbon, tress ribbon, back bow, tabi, print kimono, pink kimono, zouri, obijime, okobo, alternate costume,
BREAK,
breasts, looking at viewer, blush, holding, closed mouth, full body, thighs, holding weapon, v-shaped eyebrows, legs, bare legs, holding sword, squatting,
flower, weapon, outdoors, sword, tree, grass, katana, nature, pink flower, forest, glint, stairs, flower knot, on one knee, bamboo, bamboo forest,
可以看到,相似提示词大量集中。若仅保留必要提示词、减少令牌数,似乎能降低图像崩溃概率。
这张图是用于用TAG工具打标签时的参考图。

<<< 使用注意事项 >>>
请自行承担全部风险。出现任何问题我概不负责。
虽然我已自行运行数百次,确认工具正常,但因环境差异仍可能存在无法运行的情况。
另外,建议在执行前备份词典文件。
请务必在关闭Excel后再运行词典文件。
因为无法保证文件损坏时的恢复。
顺便一提,我在Windows 11环境下运行。
有时会出现“无法读取文本文件或词典文件”的错误。
这可能是文件格式问题。
请用记事本打开词典或文本文件,确认右下角的文件编码格式。
当你点击“另存为”时,会出现类似如下界面,请设置为UTF-8编码。

我会逐步修正词典中的分类。
由于ダンボール数据过于庞大,这项工作可能难以完成,但若发现“明显分类错误”的地方,我会进行修正。

