Spaces:
Running
on
Zero
Running
on
Zero
Upload 7 files
Browse files- llmdolphin.py +6 -0
- tagger.py +10 -4
- utils.py +5 -0
llmdolphin.py
CHANGED
@@ -18,6 +18,12 @@ llm_models = {
|
|
18 |
"Lumimaid-Magnum-12B.i1-Q4_K_M.gguf": ["mradermacher/Lumimaid-Magnum-12B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
19 |
"Nemo-12B-Marlin-v1.i1-Q4_K_M.gguf": ["mradermacher/Nemo-12B-Marlin-v1-i1-GGUF", MessagesFormatterType.MISTRAL],
|
20 |
"Nemo-12B-Marlin-v2.i1-Q4_K_M.gguf": ["mradermacher/Nemo-12B-Marlin-v2-i1-GGUF", MessagesFormatterType.MISTRAL],
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
"Evolved-Llama3-8B.i1-Q5_K_M.gguf": ["mradermacher/Evolved-Llama3-8B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
22 |
"DarkIdol-Llama-3.1-8B-Instruct-1.2-Uncensored-Q5_K_M.gguf": ["bartowski/DarkIdol-Llama-3.1-8B-Instruct-1.2-Uncensored-GGUF", MessagesFormatterType.LLAMA_3],
|
23 |
"Llama-3-Swallow-8B-Instruct-v0.1.Q5_K_M.gguf": ["YukiTomita-CC/Llama-3-Swallow-8B-Instruct-v0.1-IMat-GGUF_dolly-15k-ja-prompt", MessagesFormatterType.ALPACA],
|
|
|
18 |
"Lumimaid-Magnum-12B.i1-Q4_K_M.gguf": ["mradermacher/Lumimaid-Magnum-12B-i1-GGUF", MessagesFormatterType.MISTRAL],
|
19 |
"Nemo-12B-Marlin-v1.i1-Q4_K_M.gguf": ["mradermacher/Nemo-12B-Marlin-v1-i1-GGUF", MessagesFormatterType.MISTRAL],
|
20 |
"Nemo-12B-Marlin-v2.i1-Q4_K_M.gguf": ["mradermacher/Nemo-12B-Marlin-v2-i1-GGUF", MessagesFormatterType.MISTRAL],
|
21 |
+
"Nemo-12B-Marlin-v3.Q4_K_M.gguf": ["mradermacher/Nemo-12B-Marlin-v3-GGUF", MessagesFormatterType.MISTRAL],
|
22 |
+
"MN-12B-Lyra-v1.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Lyra-v1-i1-GGUF", MessagesFormatterType.CHATML],
|
23 |
+
"MN-12B-Starsong-v1.i1-Q4_K_M.gguf": ["mradermacher/MN-12B-Starsong-v1-i1-GGUF", MessagesFormatterType.CHATML],
|
24 |
+
"Humanish-Roleplay-Llama-3.1-8B.i1-Q5_K_M.gguf": ["mradermacher/Humanish-Roleplay-Llama-3.1-8B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
25 |
+
"Llama-3-Luminurse-v0.1-OAS-8B.Q5_K_M.gguf": ["grimjim/Llama-3-Luminurse-v0.1-OAS-8B-GGUF", MessagesFormatterType.LLAMA_3],
|
26 |
+
"L3.1-8B-Niitama-v1.1-Q5_K_M-imat.gguf": ["L3.1-8B-Niitama-v1.1-Q5_K_M-imat.gguf", MessagesFormatterType.MISTRAL],
|
27 |
"Evolved-Llama3-8B.i1-Q5_K_M.gguf": ["mradermacher/Evolved-Llama3-8B-i1-GGUF", MessagesFormatterType.LLAMA_3],
|
28 |
"DarkIdol-Llama-3.1-8B-Instruct-1.2-Uncensored-Q5_K_M.gguf": ["bartowski/DarkIdol-Llama-3.1-8B-Instruct-1.2-Uncensored-GGUF", MessagesFormatterType.LLAMA_3],
|
29 |
"Llama-3-Swallow-8B-Instruct-v0.1.Q5_K_M.gguf": ["YukiTomita-CC/Llama-3-Swallow-8B-Instruct-v0.1-IMat-GGUF_dolly-15k-ja-prompt", MessagesFormatterType.ALPACA],
|
tagger.py
CHANGED
@@ -6,6 +6,7 @@ from transformers import (
|
|
6 |
AutoImageProcessor,
|
7 |
AutoModelForImageClassification,
|
8 |
)
|
|
|
9 |
|
10 |
|
11 |
WD_MODEL_NAMES = ["p1atdev/wd-swinv2-tagger-v3-hf"]
|
@@ -30,12 +31,15 @@ PEOPLE_TAGS = (
|
|
30 |
|
31 |
|
32 |
RATING_MAP = {
|
|
|
33 |
"general": "safe",
|
34 |
"sensitive": "sensitive",
|
35 |
"questionable": "nsfw",
|
36 |
"explicit": "explicit, nsfw",
|
37 |
}
|
38 |
DANBOORU_TO_E621_RATING_MAP = {
|
|
|
|
|
39 |
"safe": "rating_safe",
|
40 |
"sensitive": "rating_safe",
|
41 |
"nsfw": "rating_explicit",
|
@@ -90,9 +94,10 @@ def list_uniq(l):
|
|
90 |
|
91 |
|
92 |
def load_dict_from_csv(filename):
|
93 |
-
from pathlib import Path
|
94 |
dict = {}
|
95 |
-
if not Path(filename).exists():
|
|
|
|
|
96 |
try:
|
97 |
with open(filename, 'r', encoding="utf-8") as f:
|
98 |
lines = f.readlines()
|
@@ -128,7 +133,8 @@ def character_list_to_series_list(character_list):
|
|
128 |
|
129 |
|
130 |
def select_random_character(series: str, character: str):
|
131 |
-
from random import randrange
|
|
|
132 |
character_list = list(anime_series_dict.keys())
|
133 |
character = character_list[randrange(len(character_list) - 1)]
|
134 |
series = anime_series_dict.get(character.split(",")[0].strip(), "")
|
@@ -146,7 +152,6 @@ def danbooru_to_e621(dtag, e621_dict):
|
|
146 |
|
147 |
import re
|
148 |
tag = re.sub(r'[\w ]+', lambda wrapper: d_to_e(wrapper, e621_dict), dtag, 2)
|
149 |
-
|
150 |
return tag
|
151 |
|
152 |
|
@@ -317,6 +322,7 @@ def insert_recom_prompt(prompt: str = "", neg_prompt: str = "", type: str = "Non
|
|
317 |
def load_model_prompt_dict():
|
318 |
import json
|
319 |
dict = {}
|
|
|
320 |
try:
|
321 |
with open('model_dict.json', encoding='utf-8') as f:
|
322 |
dict = json.load(f)
|
|
|
6 |
AutoImageProcessor,
|
7 |
AutoModelForImageClassification,
|
8 |
)
|
9 |
+
from pathlib import Path
|
10 |
|
11 |
|
12 |
WD_MODEL_NAMES = ["p1atdev/wd-swinv2-tagger-v3-hf"]
|
|
|
31 |
|
32 |
|
33 |
RATING_MAP = {
|
34 |
+
"sfw": "safe",
|
35 |
"general": "safe",
|
36 |
"sensitive": "sensitive",
|
37 |
"questionable": "nsfw",
|
38 |
"explicit": "explicit, nsfw",
|
39 |
}
|
40 |
DANBOORU_TO_E621_RATING_MAP = {
|
41 |
+
"sfw": "rating_safe",
|
42 |
+
"general": "rating_safe",
|
43 |
"safe": "rating_safe",
|
44 |
"sensitive": "rating_safe",
|
45 |
"nsfw": "rating_explicit",
|
|
|
94 |
|
95 |
|
96 |
def load_dict_from_csv(filename):
|
|
|
97 |
dict = {}
|
98 |
+
if not Path(filename).exists():
|
99 |
+
if Path('./tagger/', filename).exists(): filename = str(Path('./tagger/', filename))
|
100 |
+
else: return dict
|
101 |
try:
|
102 |
with open(filename, 'r', encoding="utf-8") as f:
|
103 |
lines = f.readlines()
|
|
|
133 |
|
134 |
|
135 |
def select_random_character(series: str, character: str):
|
136 |
+
from random import seed, randrange
|
137 |
+
seed()
|
138 |
character_list = list(anime_series_dict.keys())
|
139 |
character = character_list[randrange(len(character_list) - 1)]
|
140 |
series = anime_series_dict.get(character.split(",")[0].strip(), "")
|
|
|
152 |
|
153 |
import re
|
154 |
tag = re.sub(r'[\w ]+', lambda wrapper: d_to_e(wrapper, e621_dict), dtag, 2)
|
|
|
155 |
return tag
|
156 |
|
157 |
|
|
|
322 |
def load_model_prompt_dict():
|
323 |
import json
|
324 |
dict = {}
|
325 |
+
path = 'model_dict.json' if Path('model_dict.json').exists() else './tagger/model_dict.json'
|
326 |
try:
|
327 |
with open('model_dict.json', encoding='utf-8') as f:
|
328 |
dict = json.load(f)
|
utils.py
CHANGED
@@ -43,3 +43,8 @@ COPY_ACTION_JS = """\
|
|
43 |
navigator.clipboard.writeText(inputs);
|
44 |
}
|
45 |
}"""
|
|
|
|
|
|
|
|
|
|
|
|
43 |
navigator.clipboard.writeText(inputs);
|
44 |
}
|
45 |
}"""
|
46 |
+
|
47 |
+
|
48 |
+
def gradio_copy_prompt(prompt: str):
|
49 |
+
gr.Info("Copied!")
|
50 |
+
return prompt
|