Views
No views yet
pip install lmdeploy1from lmdeploy import pipeline, TurbomindEngineConfig
2from lmdeploy.vl import load_image
3
4model = 'OpenGVLab/InternVL2-8B-AWQ'
5image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg')
6backend_config = TurbomindEngineConfig(model_format='awq')
7pipe = pipeline(model, backend_config=backend_config, log_level='INFO')
8response = pipe(('describe this image', image))
9print(response.text)api_server enables models to be easily packed into services with a single command. The provided RESTful APIs are compatible with OpenAI's interfaces. Below are an example of service startup:lmdeploy serve api_server OpenGVLab/InternVL2-8B-AWQ --backend turbomind --server-port 23333 --model-format awqpip install openai1from openai import OpenAI
2
3client = OpenAI(api_key='YOUR_API_KEY', base_url='http://0.0.0.0:23333/v1')
4model_name = client.models.list().data[0].id
5response = client.chat.completions.create(
6 model=model_name,
7 messages=[{
8 'role':
9 'user',
10 'content': [{
11 'type': 'text',
12 'text': 'describe this image',
13 }, {
14 'type': 'image_url',
15 'image_url': {
16 'url':
17 'https://modelscope.oss-cn-beijing.aliyuncs.com/resource/tiger.jpeg',
18 },
19 }],
20 }],
21 temperature=0.8,
22 top_p=0.8)
23print(response)1@article{chen2023internvl,
2 title={InternVL: Scaling up Vision Foundation Models and Aligning for Generic Visual-Linguistic Tasks},
3 author={Chen, Zhe and Wu, Jiannan and Wang, Wenhai and Su, Weijie and Chen, Guo and Xing, Sen and Zhong, Muyan and Zhang, Qinglong and Zhu, Xizhou and Lu, Lewei and Li, Bin and Luo, Ping and Lu, Tong and Qiao, Yu and Dai, Jifeng},
4 journal={arXiv preprint arXiv:2312.14238},
5 year={2023}
6}
7@article{chen2024far,
8 title={How Far Are We to GPT-4V? Closing the Gap to Commercial Multimodal Models with Open-Source Suites},
9 author={Chen, Zhe and Wang, Weiyun and Tian, Hao and Ye, Shenglong and Gao, Zhangwei and Cui, Erfei and Tong, Wenwen and Hu, Kongzhi and Luo, Jiapeng and Ma, Zheng and others},
10 journal={arXiv preprint arXiv:2404.16821},
11 year={2024}
12}