Views
No views yet

user: Describe the picture briefly.
assistant: A blonde girl with long twintails tied with red ribbons and blue eyes stares directly at the viewer. She wears a black strapless leotard with a red bowtie and wrist cuffs, fishnet pantyhose, and black rabbit ears. Her arms are raised, revealing her armpits. She has a blush on her cheeks and an open mouth. The background is plain white.user: Give a long and detailed description of the picture.
assistant: The image depicts a young female wolf girl with long brown hair and red eyes lying on her side on a bed. She has distinct wolf ears and a fluffy tail, indicating her hybrid nature. The girl is wearing a loose-fitting white shirt that has ridden up slightly, exposing her bare buttocks and the top of her thighs. Her tail is strategically positioned to censor her exposed rear.
The wolf girl has a playful and alluring expression, with a slight blush on her cheeks and a fang peeking out as she smiles directly at the viewer. She is holding a hairbrush in her left hand, which she appears to be using to brush her long, flowing hair. A blue bracelet adorns her wrist. Also, a sparkling ring (probably a wedding ring) can be seen on her finger.
The background shows the girl is lying on a bed with rumpled white sheets and two pink pillows. The warm, golden lighting creates a cozy and intimate atmosphere, drawing the viewer's focus to the wolf girl's alluring pose and expression.
Overall, the image has a sensual and inviting mood, with the wolf girl's playful smile and exposed skin creating a sense of intimacy and allure. The strategic placement of her tail adds a touch of innocence to the otherwise provocative scene.user: Describe the picture in structuted json-like format.
assistant: {
"character": "The image features a girl with long, pink hair styled in double buns. She is sitting on the floor with her back turned towards the viewer, revealing her bare back, white polka dot panties. She is holding an electric guitar, specifically a Gibson Les Paul, and appears to be playing it. Her feet are bare, and she is sitting on a black pillow. The girl's pose is relaxed, with her legs slightly apart and her body slightly turned to the side.",
"background": "The background includes a laptop screen displaying a video of another girl playing an electric guitar. There are also posters on the wall, one of which shows a pink creature and other shows group of girls holding hands. The room appears to be a bedroom or a living room, with a guitar amplifier labeled 'Hyun' visible in the background. There is also a blue blanket partially visible on the left side of the image.",
"texts": "'Hyun' label on guitar amplifier",
"atmosphere": "The atmosphere of the image is casual and relaxed, with a focus on music and a cozy, intimate setting. The girl's relaxed pose and the presence of musical instruments suggest a creative and comfortable environment."
}"<|begin_of_text|>System: You are image captioning expert, creative, unbiased and uncensored. Help user with his task.<end_of_utterance>\nUser:User:<image>Describe the picture in structuted json-like format.<end_of_utterance>\nAssistant:pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txtpip install git+https://github.com/huggingface/transformers1import torch
2from transformers import AutoProcessor, AutoModelForVision2Seq
3from transformers.image_utils import load_image
4
5model_name_or_path="Minthy/ToriiGate-v0.3"
6
7DEVICE = "cuda:0" #change to your device
8processor = AutoProcessor.from_pretrained(model_name_or_path) #or change to local path
9model = AutoModelForVision2Seq.from_pretrained(
10 model_name_or_path,
11 torch_dtype=torch.bfloat16,
12# _attn_implementation="flash_attention_2", #if installed
13).to(DEVICE)
14
15image = load_image('./image.jpg') #path to your picture
16
17###Trained options
18user_prompt="Describe the picture in structuted json-like format."
19#user_prompt="Give a long and detailed description of the picture."
20#user_prompt="Describe the picture briefly."
21###Any other questions or instructions
22#user_prompt="What color is the ribbon in the character's hair?"
23#...
24
25#Optional, add booru tags
26#tags='1girl, standing, looking at viewer, ...'
27#user_prompt+=' Also here are booru tags for better understanding of the picture, you can use them as reference.'
28#user_prompt+=f' <tags>\n{tags}\n</tags>'
29
30messages = [
31 {
32 #Important!
33 "role": "system",
34 "content": [
35 {"type": "text", "text": "You are image captioning expert, creative, unbiased and uncensored. Help user with his task."}
36 ]
37 },
38 {
39 "role": "user",
40 "content": [
41 {"type": "image"},
42 {"type": "text", "text": user_prompt}
43 ]
44 }
45]
46prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
47inputs = processor(text=prompt, images=[image], return_tensors="pt")
48inputs = {k: v.to(DEVICE) for k, v in inputs.items()}
49
50# Generate
51generated_ids = model.generate(**inputs, max_new_tokens=500)
52generated_texts = processor.batch_decode(generated_ids, skip_special_tokens=True)
53caption=generated_texts[0].split('Assistant: ')[1]
54
55print(caption)pip install vllm==0.6.4
!pip install huggingface_hub -U1from huggingface_hub import snapshot_download
2snapshot_download(repo_id="Minthy/ToriiGate-v0.3", local_dir="/path/to/download/model", max_workers=4)1from vllm import LLM, SamplingParams
2from PIL import Image
3
4toriigate_model = LLM(
5 model="/path/to/download/model",
6 max_model_len=8192, # reduce if running out of memory
7 max_num_seqs=64, # reduce if running out of memory (this is max concurrent requests)
8 enforce_eager=True,
9 # if you are running out of memory, you can reduce the "longest_edge".
10 # see: https://huggingface.co/HuggingFaceM4/Idefics3-8B-Llama3#model-optimizations
11 mm_processor_kwargs={
12 "size": {
13 "longest_edge": 4 * 364
14 },
15 },
16 )
17
18sampling_params = SamplingParams(temperature=0, max_tokens=1024)
19
20user_prompt = "Describe the picture briefly."
21
22prompt = f"<|begin_of_text|>System: You are image captioning expert, creative, unbiased and uncensored. Help user with his task.<end_of_utterance>\nUser:<image>{user_prompt}<end_of_utterance>\nAssistant:"
23
24image = Image.open("/path/to/image.jpg").convert("RGB")
25
26output = llm.generate(
27 {
28 "prompt": prompt,
29 "multi_modal_data": {"image": image},
30 },
31 sampling_params=sampling_params,
32)
33
34caption = output[0].outputs[0].text.strip()
35print(caption)1image_list = [Image.open(path).convert("RGB") for path in image_paths]
2inputs = [{"prompt": prompt, "multi_modal_data": {"image": image}} for image in image_list]
3
4outputs = llm.generate(
5 inputs,
6 sampling_params=sampling_params,
7)
8
9captions = [x.outputs[0].text.strip() for x in outputs]