mirror of
https://github.com/deepseek-ai/DeepSeek-VL
synced 2025-06-26 18:27:43 +00:00
feat: add multiple images (or in-context learning) conversation examples (#47)
Co-authored-by: Bo Liu <benjaminliu.eecs@gmail.com>
This commit is contained in:
18
inference.py
18
inference.py
@@ -33,6 +33,7 @@ vl_gpt: MultiModalityCausalLM = AutoModelForCausalLM.from_pretrained(
|
||||
)
|
||||
vl_gpt = vl_gpt.to(torch.bfloat16).cuda().eval()
|
||||
|
||||
# single image conversation example
|
||||
conversation = [
|
||||
{
|
||||
"role": "User",
|
||||
@@ -42,6 +43,23 @@ conversation = [
|
||||
{"role": "Assistant", "content": ""},
|
||||
]
|
||||
|
||||
# multiple images (or in-context learning) conversation example
|
||||
# conversation = [
|
||||
# {
|
||||
# "role": "User",
|
||||
# "content": "<image_placeholder>A dog wearing nothing in the foreground, "
|
||||
# "<image_placeholder>a dog wearing a santa hat, "
|
||||
# "<image_placeholder>a dog wearing a wizard outfit, and "
|
||||
# "<image_placeholder>what's the dog wearing?",
|
||||
# "images": [
|
||||
# "images/dog_a.png",
|
||||
# "images/dog_b.png",
|
||||
# "images/dog_c.png",
|
||||
# "images/dog_d.png",
|
||||
# ],
|
||||
# },
|
||||
# {"role": "Assistant", "content": ""}
|
||||
# ]
|
||||
|
||||
# load images and prepare for inputs
|
||||
pil_images = load_pil_images(conversation)
|
||||
|
||||
Reference in New Issue
Block a user