mirror of
https://github.com/deepseek-ai/DeepSeek-VL2.git
synced 2026-11-05 01:07:23 +00:00
[GH-ISSUE #4] Cannot inference model #1
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#1
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 @williamium3000 on GitHub (Dec 15, 2024).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-VL2/issues/4
When I try to inference, I get the following error.
Traceback (most recent call last):
File "/william/project/cognitive-dev-bench/test.py", line 57, in
outputs = vl_gpt.language.generate(
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/transformers/generation/utils.py", line 2231, in generate
result = self._sample(
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/transformers/generation/utils.py", line 3222, in _sample
outputs = self(**model_inputs, return_dict=True)
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
File "/william/repo/DeepSeek-VL2/deepseek_vl/models/modeling_deepseek.py", line 1723, in forward
outputs = self.model(
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
File "/william/repo/DeepSeek-VL2/deepseek_vl/models/modeling_deepseek.py", line 1592, in forward
layer_outputs = decoder_layer(
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
File "/william/repo/DeepSeek-VL2/deepseek_vl/models/modeling_deepseek.py", line 1306, in forward
hidden_states, self_attn_weights, present_key_value = self.self_attn(
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/miniconda3/envs/deepseek/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
File "/william/repo/DeepSeek-VL2/deepseek_vl/models/modeling_deepseek.py", line 893, in forward
q_pe, k_pe = apply_rotary_pos_emb(q_pe, k_pe, cos, sin, position_ids)
File "/william/repo/DeepSeek-VL2/deepseek_vl/models/modeling_deepseek.py", line 366, in apply_rotary_pos_emb
cos = cos[position_ids].unsqueeze(unsqueeze_dim)
IndexError: index is out of bounds for dimension with size 0
@NuiMrme commented on GitHub (Dec 15, 2024):
vl_gpt.language.generate(cause errors for me as well but in different files@learningpro commented on GitHub (Dec 16, 2024):
please check your torch related packages version, My project works well with the following version
@weiaicunzai commented on GitHub (Dec 16, 2024):
I am getting the similar error, something is wrong with this cos variable.
@ApolloRay commented on GitHub (Dec 16, 2024):
IndexError: index is out of bounds for dimension with size 0
same problem
@williamium3000 commented on GitHub (Dec 16, 2024):
@learningpro I use the following env

I cannot use the 12.4 cuda since my cuda is only 12.3 (using 12.4 cuda torch gives me
problem.
However, I believe the cuda is not a major issue here.
@ApolloRay commented on GitHub (Dec 16, 2024):
fix it.

you can add input_ids = prepare_inputs["input_ids"], at line 106 in inference.py
@robinren03 commented on GitHub (Dec 16, 2024):
Thank you! It works for me.
@Adenialzz commented on GitHub (Dec 17, 2024):
What is the expected output of the demo about two giraffes images ?
@HubHop commented on GitHub (Dec 18, 2024):
Hi guys, if you're encountering the issue mentioned, please try running
pip install transformers==4.38.2.@HubHop commented on GitHub (Dec 18, 2024):
@Adenialzz Here is one example from DeepSeek-VL2-tiny:
Input:
<|User|>:
<|ref|>The giraffe at the back.<|/ref|>.
Expected output:
<|Assistant|>: <|ref|>The giraffe at the back.<|/ref|><|det|>582, 271, 942, 888<|/det|><|end▁of▁sentence|>
Please make sure you have set
skip_special_tokens=False.@williamium3000 commented on GitHub (Dec 18, 2024):
@HubHop Can you give an example of interleaved image text? The case in the hugging face won't work. Thanks!
@HubHop commented on GitHub (Dec 18, 2024):
@williamium3000 Sure! Below is one example of interleaved image-texts. No other changes required in the demo from the readme.
Expected output:
Example images:
@williamium3000 commented on GitHub (Dec 18, 2024):
thanks
@williamium3000 commented on GitHub (Dec 20, 2024):
Hi, can you please provide a multi-GPU inference (splitting the model to multiple GPUs) code as the standard deepseek-vl2 is too large to be handled on one single GPU?
@williamium3000 commented on GitHub (Dec 22, 2024):
any clues? @HubHop
@HubHop commented on GitHub (Dec 22, 2024):
Hi @williamium3000, thanks for mentioning this feature. Due to many schedules, please kindly wait. We will consider adding this support later.
@HubHop commented on GitHub (Dec 23, 2024):
Hi @williamium3000, please let me know if this works for you: https://github.com/deepseek-ai/DeepSeek-VL2/issues/8#issuecomment-2558914207
@hzgdeerHo commented on GitHub (Dec 23, 2024):
The same requests for infer with multi-GPU
@ccx1997 commented on GitHub (Dec 26, 2024):
It is due to the version of transformers. I do not wanna downgrade the version, so I solved it by do the following modification in
def prepare_inputs_for_generationindeepseek_vl2/models/modeling_deepseek.py:It worked for the latest transformers==4.46.3
@williamium3000 commented on GitHub (Dec 27, 2024):
Thanks. Exactly what I need. @HubHop