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

Add pipeline.chat api for easy use #1292

Merged
merged 14 commits into from
Mar 18, 2024
Merged

Conversation

irexyc
Copy link
Collaborator

@irexyc irexyc commented Mar 15, 2024

Motivation

Add pipeline.chat api for easy use

Use cases (Optional)

from lmdeploy import pipeline
pipe = pipeline('InternLM/internlm2-chat-7b/')
sess = pipe.chat('中国的首都是哪个城市')
sess.response()
sess = pipe.chat('美国的首都是哪个城市', session=sess)
sess.response()
sess = pipe.chat('你刚才提到了哪两个城市', session=sess)
sess.response()
from lmdeploy import pipeline
pipe = pipeline('/nvme/chenxin/download/tmp/Yi-VL-6B/')
sess = pipe.chat(('描述一下这个图片', 'onzc.jpg'))
sess.response()
sess = pipe.chat('丰富一下细节', session=sess)
sess.response()

@lvhan028 lvhan028 requested a review from AllentDan March 15, 2024 07:39
@lvhan028 lvhan028 added the enhancement New feature or request label Mar 15, 2024
Comment on lines +106 to +108
def response(self) -> Response:
"""return response."""
return self._response
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里要不要用 property 啊,感觉用函数有点奇怪

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 bd29205 into InternLM:main Mar 18, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants