[English](README.md) | 简体中文
👋 join us on Twitter, Discord and WeChat
______________________________________________________________________ ## 更新 🎉 - \[2023/07\] TurboMind 支持使用 GQA 的 Llama-2 70B 模型 - \[2023/07\] TurboMind 支持 Llama-2 7B/13B 模型 - \[2023/07\] TurboMind 支持 InternLM 的 Tensor Parallel 推理 ______________________________________________________________________ ## 简介 LMDeploy 由 [MMDeploy](https://github.com/open-mmlab/mmdeploy) 和 [MMRazor](https://github.com/open-mmlab/mmrazor) 团队联合开发,是涵盖了 LLM 任务的全套轻量化、部署和服务解决方案。 这个强大的工具箱提供以下核心功能: - **高效推理引擎 TurboMind**:基于 [FasterTransformer](https://github.com/NVIDIA/FasterTransformer),我们实现了高效推理引擎 TurboMind,支持 InternLM、LLaMA、vicuna等模型在 NVIDIA GPU 上的推理。 - **交互推理方式**:通过缓存多轮对话过程中 attention 的 k/v,记住对话历史,从而避免重复处理历史会话。 - **多 GPU 部署和量化**:我们提供了全面的模型部署和量化支持,已在不同规模上完成验证。 - **persistent batch 推理**:进一步优化模型执行效率。  ## 性能 **场景一**: 固定的输入、输出token数(1,2048),测试 output token throughput **场景二**: 使用真实数据,测试 request throughput 测试配置:LLaMA-7B, NVIDIA A100(80G) TurboMind 的 output token throughput 超过 2000 token/s, 整体比 DeepSpeed 提升约 5% - 15%,比 huggingface transformers 提升 2.3 倍 在 request throughput 指标上,TurboMind 的效率比 vLLM 高 30%  ## 快速上手 ### 安装 ```shell conda create -n lmdeploy python=3.10 -y conda activate lmdeploy pip install lmdeploy ``` ### 部署 InternLM #### 获取 InternLM 模型 ```shell # 1. 下载 InternLM 模型 # Make sure you have git-lfs installed (https://git-lfs.com) git lfs install git clone https://huggingface.co/internlm/internlm-chat-7b /path/to/internlm-chat-7b # if you want to clone without large files – just their pointers # prepend your git clone with the following env var: GIT_LFS_SKIP_SMUDGE=1 # 2. 转换为 trubomind 要求的格式。默认存放路径为 ./workspace python3 -m lmdeploy.serve.turbomind.deploy internlm-chat-7b /path/to/internlm-chat-7b ``` #### 使用 turbomind 推理 ```shell python3 -m lmdeploy.turbomind.chat ./workspace ``` > **Note**