mirror of
https://github.com/deepseek-ai/DeepSeek-VL2.git
synced 2026-11-05 01:07:23 +00:00
[GH-ISSUE #17] The inference output is meaningless #14
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepSeek-VL2#14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yydxlv on GitHub (Dec 23, 2024).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-VL2/issues/17
When i input an image , the inference output is repetitive and not well-organized.
`conversation = [
{
"role": "<|User|>",
"content": "\n Describe the image.",
"images": ["../data/cat.png"],
},
{"role": "<|Assistant|>", "content": ""},
]
pil_images = load_pil_images(conversation)
prepare_inputs = vl_chat_processor(conversations=conversation, images=pil_images, force_batchify=True, system_prompt="Describe the image.").to(vl_gpt.device)
inputs_embeds = vl_gpt.prepare_inputs_embeds(**prepare_inputs)
outputs = vl_gpt.language.generate(
inputs_embeds=inputs_embeds,
attention_mask=prepare_inputs.attention_mask,
pad_token_id=tokenizer.eos_token_id,
bos_token_id=tokenizer.bos_token_id,
eos_token_id=tokenizer.eos_token_id,
max_new_tokens=128,
do_sample=False,
use_cache=True
)
answer = tokenizer.decode(outputs[0].cpu().tolist(), skip_special_tokens=True)
print(f"{prepare_inputs['sft_format'][0]}", answer)`
The output is follow:
Describe the image.
<|User|>:
Describe the image.
<|Assistant|>: The image shows a cat wearing a shirt with a shirt with a design that resembles a shirt with a design that resembles a shirt with a design that resembles a shirt with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with with
@HubHop commented on GitHub (Dec 23, 2024):
Hi @yydxlv, can you let me know which model you are testing? If possible, can you also share this failure case (image) with us?
@yydxlv commented on GitHub (Dec 23, 2024):
The model name is deepseek-vl2-small
I use the following code to load the model
`import torch
from transformers import AutoModelForCausalLM
from deepseek_vl2.models import DeepseekVLV2Processor, DeepseekVLV2ForCausalLM
from deepseek_vl2.utils.io import load_pil_images
from transformers import AutoProcessor
model_name = "models/deepseek-vl2-small"
vl_chat_processor = DeepseekVLV2Processor.from_pretrained(model_name)
tokenizer = vl_chat_processor.tokenizer
vl_gpt = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True).to(torch.bfloat16).cuda().eval()`
The input img is
Thank you for help
@HubHop commented on GitHub (Dec 23, 2024):
Hi @yydxlv, I tested it with DeepSeek-VL2-Small and your image. The results seem to be good:
Please try our demo code in the readme and directly replace the prompts/images, to see if the results are correct or not.
@yydxlv commented on GitHub (Dec 23, 2024):
Yeah, I use the same code as the demo, but the result is strange.
Is there anything wrong with me ?
@HubHop commented on GitHub (Dec 23, 2024):
The code looks good to me. I'm not entirely sure but you may check if it is due to different versions of python packages. Below is our testing environment.
@yydxlv commented on GitHub (Dec 23, 2024):
Yeah, i have just reinstalled and verified torch==2.0.1 and transformers==4.38.2.,
the model is runed on A800, but the output is still the same like this
"
<|User|>:
Describe the image.
<|Assistant|>: The image shows a cat wearing a shirt with a shirt with a design that resembles a transformer. The shirt has a transformer design on it. The shirt has a transformer. The shirt has a transformer. The shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt shirt
"
@Blaizzy commented on GitHub (Dec 23, 2024):
You need to pass input_ids.
There is a PR addressing this issue #11
@MrRace commented on GitHub (Dec 24, 2024):
It was truly disappointing. Nothing is perfect everywhere. Maybe it's time to let go!
@tracyCzf commented on GitHub (Dec 27, 2024):
@yydxlv @HubHop Using the same code, deepseek-vl2-small generated the same bad result with yydxlv. But deepssek-vl2-tiny and deepssek-vl2 generated results looks good.
@p1x33l commented on GitHub (Jan 8, 2025):
+1
@Blaizzy commented on GitHub (Jan 8, 2025):
I can't get deepseek tiny to work well on MLX
@p1x33l commented on GitHub (Jan 8, 2025):
i had the same issue, i extracted the code used in inference.py file and it works fine
@Blaizzy commented on GitHub (Jan 8, 2025):
Is this for me @p1x33l?
@Blaizzy commented on GitHub (Jan 8, 2025):
Testing prince-canuma--deepseek-vl2-tiny ───────────────────────────────────────────────
@Blaizzy commented on GitHub (Jan 8, 2025):
Compared to deepseek-small and deepseek-vl2.
Testing mlx-community/deepseek-vl2-6bit ────────────────────────────────────────────────╯