KBlueLeaf commited on
Commit
4cd56bb
1 Parent(s): 5c38035

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -0
README.md CHANGED
@@ -1,3 +1,80 @@
1
  ---
2
  license: cc-by-sa-4.0
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-sa-4.0
3
+ datasets:
4
+ - KBlueLeaf/danbooru2023-sqlite
5
+ language:
6
+ - en
7
+ library_name: transformers
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - not-for-all-audiences
11
+ - art
12
+ widget:
13
+ - text: "quality: masterpiece\nrating: safe\nartist: <|empty|>\ncharacters: <|empty|>\ncopyrights: <|empty|>\naspect ratio: 1.0\ntarget: <|short|>\ngeneral: 1girl, solo, dragon girl, dragon horns, dragon tail<|input_end|>"
14
  ---
15
+
16
+ # DanTagGen - delta (rev2)
17
+ DanTagGen(Danbooru Tag Generator) is inspired from p1atdev's dart project.
18
+ But with different arch, dataset, format and different training strategy.
19
+
20
+ ## Difference between versions
21
+ - alpha: pretrain on 2M dataset, smaller batch size. Limited ability
22
+ - beta: pretrain on 5.3M dataset, larger batch size. More stable, better ability with only a few information provided.
23
+ - delta: pretrain on 7.2M dataset, larger batch size. Slightly underfit but better diversity. quality tag introduced.
24
+ - rev2: resumed from delta, same dataset, 2 more epoch.
25
+
26
+ ## Model arch
27
+ This version of DTG is trained from scratch with 400M param LLaMA arch.(In my personal preference I will call it NanoLLaMA)
28
+ Since it is llama arch. Theoritically it should be able to be used in any LLaMA inference interface.
29
+
30
+ This repo also provided converted FP16 gguf model and quantized 8bit/6bit gguf models.
31
+ Basically it is recommended to use llama.cpp or llama-cpp-python to run this model. Which will be very fast.
32
+
33
+ ## Format
34
+ ```python3
35
+ prompt = f"""
36
+ quality: {quality or '<|empty|>'}
37
+ rating: {rating or '<|empty|>'}
38
+ artist: {artist.strip() or '<|empty|>'}
39
+ characters: {characters.strip() or '<|empty|>'}
40
+ copyrights: {copyrights.strip() or '<|empty|>'}
41
+ aspect ratio: {f"{aspect_ratio:.1f}" or '<|empty|>'}
42
+ target: {'<|' + target + '|>' if target else '<|long|>'}
43
+ general: {", ".join(special_tags)}, {general.strip().strip(",")}<|input_end|>
44
+ """
45
+ ```
46
+
47
+ for example:
48
+ ```
49
+ quality: masterpiece
50
+ rating: safe
51
+ artist: <|empty|>
52
+ characters: <|empty|>
53
+ copyrights: <|empty|>
54
+ aspect ratio: 1.0
55
+ target: <|short|>
56
+ general: 1girl, solo, dragon girl, dragon horns, dragon tail<|input_end|>
57
+ ```
58
+
59
+ And you may get something like:
60
+ ```
61
+ rating: safe
62
+ artist: <|empty|>
63
+ characters: <|empty|>
64
+ copyrights: <|empty|>
65
+ aspect ratio: 1.0
66
+ target: <|short|>
67
+ 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
68
+ ```
69
+
70
+ ## Dataset and Training
71
+ I use the trainer I implemented in HakuPhi to run the training.
72
+ with Total 12epoch on 7.2M data. This model have roughly 10~15B token seen.
73
+
74
+ The dataset is exported by HakuBooru with my danbooru sqlite database. Use the percentile of fav_count on each rating to filter the data. (2M = top 25%, 5.3M = top 75%)
75
+
76
+ ## Utilities
77
+ HF space: https://huggingface.co/spaces/KBlueLeaf/DTG-demo
78
+ Demo for DTG + Kohaku XL Epsilon: https://huggingface.co/spaces/KBlueLeaf/This-Cute-Dragon-Girl-Doesnt-Exist
79
+ SD-WebUI Extension: https://github.com/KohakuBlueleaf/z-a1111-sd-webui-dtg
80
+ ComfyUI Node: https://github.com/toyxyz/a1111-sd-webui-dtg_comfyui