INT4 Weight-only Quantization and Deployment (W4A16)
LMDeploy adopts
AWQ
algorithm for 4bit weight-only quantization. By developed the high-performance cuda kernel, the 4bit quantized model inference achieves up to 2.4x faster than FP16.
LMDeploy supports the following NVIDIA GPU for W4A16 inference:
Turing(sm75): 20 series, T4
Ampere(sm80,sm86): 30 series, A10, A16, A30, A100
Ada Lovelace(sm90): 40 series
Before proceeding with the quantization and inference, please ensure that lmdeploy is installed.
Trying the following codes, you can perform the batched offline inference with the quantized model:
from lmdeploy import pipeline, TurbomindEngineConfig
from lmdeploy.vl import load_image
model = 'OpenGVLab/InternVL2-2B-AWQ'
image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg')
backend_config = TurbomindEngineConfig(model_format='awq')
pipe = pipeline(model, backend_config=backend_config, log_level='INFO')
response = pipe(('describe this image', image))
print(response.text)
For more information about the pipeline parameters, please refer to
here
.
Service
LMDeploy's
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:
This project is released under the MIT license, while InternLM2 is licensed under the Apache-2.0 license.
Citation
If you find this project useful in your research, please consider citing:
@article{chen2023internvl,
title={InternVL: Scaling up Vision Foundation Models and Aligning for Generic Visual-Linguistic Tasks},
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},
journal={arXiv preprint arXiv:2312.14238},
year={2023}
}
@article{chen2024far,
title={How Far Are We to GPT-4V? Closing the Gap to Commercial Multimodal Models with Open-Source Suites},
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},
journal={arXiv preprint arXiv:2404.16821},
year={2024}
}
Runs of OpenGVLab InternVL2-2B-AWQ on huggingface.co
2.3K
Total runs
77
24-hour runs
-44
3-day runs
-1.3K
7-day runs
-21.2K
30-day runs
More Information About InternVL2-2B-AWQ huggingface.co Model
InternVL2-2B-AWQ huggingface.co is an AI model on huggingface.co that provides InternVL2-2B-AWQ's model effect (), which can be used instantly with this OpenGVLab InternVL2-2B-AWQ model. huggingface.co supports a free trial of the InternVL2-2B-AWQ model, and also provides paid use of the InternVL2-2B-AWQ. Support call InternVL2-2B-AWQ model through api, including Node.js, Python, http.
InternVL2-2B-AWQ huggingface.co is an online trial and call api platform, which integrates InternVL2-2B-AWQ's modeling effects, including api services, and provides a free online trial of InternVL2-2B-AWQ, you can try InternVL2-2B-AWQ online for free by clicking the link below.
OpenGVLab InternVL2-2B-AWQ online free url in huggingface.co:
InternVL2-2B-AWQ is an open source model from GitHub that offers a free installation service, and any user can find InternVL2-2B-AWQ on GitHub to install. At the same time, huggingface.co provides the effect of InternVL2-2B-AWQ install, users can directly use InternVL2-2B-AWQ installed effect in huggingface.co for debugging and trial. It also supports api for free installation.