The Latest AIs, every day
AIs with the most favorites on Toolify
AIs with the highest website traffic (monthly visits)
AI Tools by Apps
Discover the Discord of AI
AI Tools by browser extensions
GPTs from GPT Store
Discover The Best Model For AI
Top AI lists by month and monthly visits.
Top AI lists by category and monthly visits.
Top AI lists by region and monthly visits.
Top AI lists by source and monthly visits.
Top AI lists by revenue and real traffic.
DanbotNL is translator that tranaslates from natural languages into Danbooru tags. DanbotNL supports Japanese, English and Danbooru tags .
See our tech blog (Japanese) for more details.
See https://github.com/p1atdev/danbot-comfy-node .
pip install transformers sentencepiece protobuf
import torch
from transformers import AutoModelForPreTraining, AutoProcessor
REPO = "dartags/DanbotNL-2408-260m"
processor = AutoProcessor.from_pretrained(
REPO,
trust_remote_code=True,
revision="827103c", # optional
)
model = AutoModelForPreTraining.from_pretrained(
REPO,
trust_remote_code=True,
revision="827103c", # optional
torch_dtype=torch.bfloat16
)
# Translate
inputs = processor(
encoder_text="一人の猫耳の少女が座ってこっちを見ている。",
decoder_text=processor.decoder_tokenizer.apply_chat_template(
{
"aspect_ratio": "tall",
"rating": "general",
"length": "very_short",
"translate_mode": "exact",
},
tokenize=False,
),
return_tensors="pt",
)
with torch.inference_mode():
outputs = model.generate(
**inputs.to(model.device),
do_sample=False,
eos_token_id=processor.decoder_tokenizer.convert_tokens_to_ids(
"</translation>"
),
)
translation = ", ".join(
tag
for tag in processor.batch_decode(
outputs[0, len(inputs.input_ids[0]) :],
skip_special_tokens=True,
)
if tag.strip() != ""
)
print("translation:", translation)
# translation: 1girl, solo, looking at viewer, sitting, cat girl
# Extend
inputs = processor(
encoder_text="一人の猫耳の少女が座ってこっちを見ている。",
decoder_text=processor.decoder_tokenizer.apply_chat_template(
{
"aspect_ratio": "tall",
"rating": "general",
"length": "long",
"translate_mode": "approx",
"copyright": "",
"character": "",
"translation": translation,
},
tokenize=False,
),
return_tensors="pt",
)
with torch.inference_mode():
outputs = model.generate(
**inputs.to(model.device),
do_sample=False,
eos_token_id=processor.decoder_tokenizer.convert_tokens_to_ids("</extension>"),
)
extension = ", ".join(
tag
for tag in processor.batch_decode(
outputs[0, len(inputs.input_ids[0]) :],
skip_special_tokens=True,
)
if tag.strip() != ""
)
print("extension:", extension)
# extension: simple background, white background, shirt, skirt, long sleeves, animal ears, closed mouth, ribbon, jacket, pantyhose, open clothes, blue eyes, brown hair, long hair, shoes, white shirt, full body, cat ears, black skirt, loafers
ASPECT_RATIO = Literal[
"too_tall",
"tall_wallpaper",
"tall",
"square",
"wide",
"wide_wallpaper",
"too_wide",
]
RATING = Literal[
"general",
"sensitive",
"questionable",
"explicit",
]
LENGTH = Literal[
"very_short",
"short",
"long",
"very_long",
]
aspect_ratio: ASPECT_RATIO
rating: RATING
length: LENGTH
TRANSLATE_MODE = Literal[
"exact",
"approx",
]
translate_mode: TRANSLATE_MODE
copyright <- empty string or comma-separated valid danbooru tags (copyright)
character <- empty string or comma-separated valid danbooru tags (character)
translation <- empty string or comma-separated valid danbooru tags (general and meta)
prompt = (
"<|bos|>"
f"{aspect_ratio}{rating}{length}"
"<text><|text|></text>"
f"<|translate:{translate_mode}|><|input_end|>"
# ↑ up to here if translate_mode == "exact"
f"<copyright>{copyright}</copyright>"
f"<character>{character}</character>"
"<general>"
f"<translation>{translation}</translation>"
f"<extension>"
# ↑ up to here if translate_mode == "approx"
# {extension}</extension></general><|eos|> # the model generates this
)
DanbotNL-2408-260M huggingface.co is an AI model on huggingface.co that provides DanbotNL-2408-260M's model effect (), which can be used instantly with this dartags DanbotNL-2408-260M model. huggingface.co supports a free trial of the DanbotNL-2408-260M model, and also provides paid use of the DanbotNL-2408-260M. Support call DanbotNL-2408-260M model through api, including Node.js, Python, http.
DanbotNL-2408-260M huggingface.co is an online trial and call api platform, which integrates DanbotNL-2408-260M's modeling effects, including api services, and provides a free online trial of DanbotNL-2408-260M, you can try DanbotNL-2408-260M online for free by clicking the link below.
DanbotNL-2408-260M is an open source model from GitHub that offers a free installation service, and any user can find DanbotNL-2408-260M on GitHub to install. At the same time, huggingface.co provides the effect of DanbotNL-2408-260M install, users can directly use DanbotNL-2408-260M installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

