Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support user-specified IMAGE_TOKEN position for deepseek-vl model #1627

Merged
merged 10 commits into from
May 24, 2024

Conversation

irexyc
Copy link
Collaborator

@irexyc irexyc commented May 21, 2024

Motivation

for some models, the location of the image token is not restricted, in this case, the user should insert the image token manually.

@lvhan028
Copy link
Collaborator

may provide a case so that @zhulinJulia24 can add it into TCs

lmdeploy/vl/templates.py Outdated Show resolved Hide resolved
@lvhan028 lvhan028 requested a review from AllentDan May 24, 2024 04:42
logger.error(
f'the number of {IMAGE_TOKEN} is not equal '
f'to input images, {len(segs) - 1} vs {len(features)}')
features = features[:len(segs) - 1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that len(segs) > len(features)

from lmdeploy.vl import load_image
from lmdeploy.vl.constants import IMAGE_TOKEN

pipe = pipeline('deepseek-ai/deepseek-vl-7b-chat')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we try deepseek-ai/deepseek-vl-1.3b-chat instead as an example? It is smaller and can be downloaded faster.

```python
from lmdeploy import pipeline
from lmdeploy.vl import load_image
from lmdeploy.vl.constants import IMAGE_TOKEN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May notify users that is is actually '<IMAGE_TOKEN>' in comments or other forms. This is useful for api_server users.

Copy link
Collaborator

@AllentDan AllentDan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lvhan028 lvhan028 merged commit a844b1b into InternLM:main May 24, 2024
5 checks passed
@lvhan028 lvhan028 changed the title Custom vl user input Support user-specified IMAGE_TOKEN position for deepseek-vl model May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants