🚀 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許可證。