🚀 DanTagGen - delta (rev2)
DanTagGen(Danbooru标签生成器)灵感源自p1atdev的Dart项目,但采用了不同的架构、数据集、格式和训练策略。
🚀 快速开始
本模型理论上可用于任何LLaMA推理接口,推荐使用llama.cpp
或llama-cpp-python
运行,速度会非常快。
✨ 主要特性
版本差异
- alpha:在200万数据集上预训练,批量大小较小,能力有限。
- beta:在530万数据集上预训练,批量大小较大,更稳定,在仅提供少量信息时表现更佳。
- delta:在720万数据集上预训练,批量大小更大,略有欠拟合但多样性更好,引入了质量标签。
- rev2:基于delta继续训练,使用相同数据集,额外训练2个轮次。
模型架构
此版本的DTG基于4亿参数的LLaMA架构从头开始训练(个人习惯称其为NanoLLaMA)。由于采用了LLaMA架构,理论上它可用于任何LLaMA推理接口。本仓库还提供了转换后的FP16 gguf模型以及量化的8位/6位gguf模型。
📦 安装指南
暂未提供具体安装步骤,可参考推荐使用的llama.cpp
或llama-cpp-python
的官方文档进行安装。
💻 使用示例
基础用法
prompt = f"""
quality: {quality or '<|empty|>'}
rating: {rating or '<|empty|>'}
artist: {artist.strip() or '<|empty|>'}
characters: {characters.strip() or '<|empty|>'}
copyrights: {copyrights.strip() or '<|empty|>'}
aspect ratio: {f"{aspect_ratio:.1f}" or '<|empty|>'}
target: {'<|' + target + '|>' if target else '<|long|>'}
general: {", ".join(special_tags)}, {general.strip().strip(",")}<|input_end|>
"""
例如:
quality: masterpiece
rating: safe
artist: <|empty|>
characters: <|empty|>
copyrights: <|empty|>
aspect ratio: 1.0
target: <|short|>
general: 1girl, solo, dragon girl, dragon horns, dragon tail<|input_end|>
你可能会得到如下结果:
rating: safe
artist: <|empty|>
characters: <|empty|>
copyrights: <|empty|>
aspect ratio: 1.0
target: <|short|>
general: 1girl, solo, dragon girl, dragon horns, dragon tail<|input_end|>open mouth, red eyes, long hair, pointy ears, tail, black hair, chinese clothes, simple background, dragon, hair between eyes, horns, china dress, dress, looking at viewer, breasts
📚 详细文档
数据集与训练
使用在HakuPhi中实现的训练器进行训练,在720万数据上共训练12个轮次,该模型大约处理了100 - 150亿个标记。数据集由HakuBooru从我的Danbooru SQLite数据库导出,使用每个评级下点赞数的百分位数过滤数据(200万 = 前25%,530万 = 前75%)。
实用工具
- HF空间:https://huggingface.co/spaces/KBlueLeaf/DTG-demo
- DTG + Kohaku XL Epsilon演示:https://huggingface.co/spaces/KBlueLeaf/This-Cute-Dragon-Girl-Doesnt-Exist
- SD-WebUI扩展:https://github.com/KohakuBlueleaf/z-a1111-sd-webui-dtg
- ComfyUI节点:https://github.com/toyxyz/a1111-sd-webui-dtg_comfyui
📄 许可证
本项目采用CC BY-SA 4.0许可证。