mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
@@ -81,8 +81,8 @@ class DeepDanbooru:
|
||||
tag_outformat = tag_outformat.replace('_', ' ')
|
||||
if shared.opts.deepbooru_escape:
|
||||
tag_outformat = re.sub(re_special, r'\\\1', tag_outformat)
|
||||
if shared.opts.deepbooru_clip_score and not force_disable_ranks:
|
||||
tag_outformat = f"({tag_outformat}:{probability:.3f})"
|
||||
if shared.opts.interrogate_score and not force_disable_ranks:
|
||||
tag_outformat = f"({tag_outformat}:{probability:.2f})"
|
||||
res.append(tag_outformat)
|
||||
if len(res) > shared.opts.deepbooru_max_tags:
|
||||
res = res[:shared.opts.deepbooru_max_tags]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -213,8 +213,8 @@ class InterrogateModels:
|
||||
for _name, topn, items in self.categories():
|
||||
matches = self.rank(image_features, items, top_count=topn)
|
||||
for match, score in matches:
|
||||
if shared.opts.interrogate_clip_score:
|
||||
res += f", ({match}:{score/100:.3f})"
|
||||
if shared.opts.interrogate_score:
|
||||
res += f", ({match}:{score/100:.2f})"
|
||||
else:
|
||||
res += f", {match}"
|
||||
except Exception as e:
|
||||
|
||||
@@ -37,6 +37,7 @@ vlm_models = {
|
||||
"Microsoft GIT VQA Large": "microsoft/git-large-vqav2", # 1.6GB
|
||||
"ToriiGate 0.4 2B": "Minthy/ToriiGate-v0.4-2B",
|
||||
"ViLT Base": "dandelin/vilt-b32-finetuned-vqa", # 0.5GB
|
||||
"JoyTag": "fancyfeast/joytag",
|
||||
}
|
||||
vlm_prompts = [
|
||||
'<CAPTION>',
|
||||
@@ -344,6 +345,9 @@ def interrogate(question, image, model_name):
|
||||
answer = qwen(question, image, vqa_model)
|
||||
elif 'smol' in vqa_model.lower():
|
||||
answer = smol(question, image, vqa_model)
|
||||
elif 'joytag' in vqa_model.lower():
|
||||
from modules.interrogate import joytag
|
||||
answer = joytag.predict(image)
|
||||
else:
|
||||
answer = 'unknown model'
|
||||
except Exception as e:
|
||||
|
||||
+1
-1
@@ -910,12 +910,12 @@ options_templates.update(options_section(('control', "Control Options"), {
|
||||
options_templates.update(options_section(('interrogate', "Interrogate"), {
|
||||
"interrogate_default_type": OptionInfo("OpenCLiP", "Default type", gr.Radio, {"choices": ["OpenCLiP", "VLM", "DeepBooru"]}),
|
||||
"interrogate_offload": OptionInfo(True, "Interrogate: offload models "),
|
||||
"interrogate_score": OptionInfo(False, "Include scores in results when available"),
|
||||
|
||||
"interrogate_clip_sep": OptionInfo("<h2>OpenCLiP</h2>", "", gr.HTML),
|
||||
"interrogate_clip_model": OptionInfo("ViT-L-14/openai", "CLiP: default model", gr.Dropdown, lambda: {"choices": get_clip_models()}, refresh=refresh_clip_models),
|
||||
"interrogate_clip_mode": OptionInfo(caption_types[0], "CLiP: default mode", gr.Dropdown, {"choices": caption_types}),
|
||||
"interrogate_blip_model": OptionInfo(list(caption_models)[0], "CLiP: default captioner", gr.Dropdown, {"choices": list(caption_models)}),
|
||||
"interrogate_clip_score": OptionInfo(False, "CLiP: include scores in results"),
|
||||
"interrogate_clip_num_beams": OptionInfo(1, "CLiP: num beams", gr.Slider, {"minimum": 1, "maximum": 16, "step": 1}),
|
||||
"interrogate_clip_min_length": OptionInfo(32, "CLiP: min length", gr.Slider, {"minimum": 1, "maximum": 128, "step": 1}),
|
||||
"interrogate_clip_max_length": OptionInfo(74, "CLiP: max length", gr.Slider, {"minimum": 1, "maximum": 512, "step": 1}),
|
||||
|
||||
Reference in New Issue
Block a user