transformer大语言模型(LLM)部署方案整理

说明

大模型的基本特征就是大,单机单卡部署会很慢,甚至显存不够用。毕竟不是谁都有H100/A100, 能有个3090就不错了。

目前已经有不少框架支持了大模型的分布式部署,可以并行的提高推理速度。不光可以单机多卡,还可以多机多卡。
我自己没啥使用经验,简单罗列下给自己备查。不足之处,欢迎在评论区指出。

框架名称出品方开源地址
FasterTranaformer英伟达FasterTransformer github
TGIhuggingfacehuggingface/text-generation-inference
vLLM伯克利大学 LMSYS 组织github-vllm
deepspeed微软github.com/microsoft/DeepSpeed
lmdeployopen-mmlabInternLM/lmdeploy
TurboTransformers腾讯Tencent/TurboTransformers

FasterTranaformer/TensorRT-LLM

faster transformer是英伟达的大模型推理方案,但是后续可能不再维护,因为英伟达推出了一个更新的框架TensorRT-LLM,它目前还在申请使用阶段,未来应该会全面开源吧。

FasterTransformer支持的模型

ModelsFrameworkFP16INT8 (after Turing)Sparsity (after Ampere)Tensor parallelPipeline parallelFP8 (after Hopper)
BERTTensorFlowYesYes----
BERTPyTorchYesYesYesYesYes-
BERTTriton backendYes--YesYes-
BERTC++YesYes---Yes
XLNetC++Yes-----
EncoderTensorFlowYesYes----
EncoderPyTorchYesYesYes---
DecoderTensorFlowYes-----
DecoderPyTorchYes-----
DecodingTensorFlowYes-----
DecodingPyTorchYes-----
GPTTensorFlowYes-----
GPT/OPTPyTorchYes--YesYesYes
GPT/OPTTriton backendYes--YesYes-
GPT-MoEPyTorchYes--YesYes-
BLOOMPyTorchYes--YesYes-
BLOOMTriton backendYes--YesYes-
GPT-JTriton backendYes--YesYes-
LongformerPyTorchYes-----
T5/UL2PyTorchYes--YesYes-
T5TensorFlow 2Yes-----
T5/UL2Triton backendYes--YesYes-
T5TensorRTYes--YesYes-
T5-MoEPyTorchYes--YesYes-
Swin TransformerPyTorchYesYes----
Swin TransformerTensorRTYesYes----
ViTPyTorchYesYes----
ViTTensorRTYesYes----
GPT-NeoXPyTorchYes--YesYes-
GPT-NeoXTriton backendYes--YesYes-
BART/mBARTPyTorchYes--YesYes-
WeNetC++Yes-----
DeBERTaTensorFlow 2Yes--On-goingOn-going-
DeBERTaPyTorchYes--On-goingOn-going-

参考资料:

FasterTransformer github

H100推理飙升8倍!英伟达官宣开源TensorRT-LLM,支持10+模型

英伟达发布 TensorRT-LLM 模型,性能最高提升 8 倍,何时能正式发售?对此你有哪些期待?

TGI(huggingface/text-generation-inference)

huggingface官方的框架,根据小记:主流推理框架在Llama 2 的上性能比较的数据,TGI跑LLAMA-13b的性能好于vllm。

Optimized architectures

Other architectures are supported on a best effort basis using:

AutoModelForCausalLM.from_pretrained(<model>, device_map="auto")

or

AutoModelForSeq2SeqLM.from_pretrained(<model>, device_map="auto")

参考资料:

huggingface/text-generation-inference

vllm

vLLM 是伯克利大学 LMSYS 组织开源的大语言模型高速推理框架,极大地提升了实时场景下的 LLM 服务的吞吐与内存使用效率。

vllm支持的模型

vLLM seamlessly supports many Huggingface models, including the following architectures:

  • Aquila (BAAI/Aquila-7B, BAAI/AquilaChat-7B, etc.)
  • Baichuan (baichuan-inc/Baichuan-7B, baichuan-inc/Baichuan-13B-Chat, etc.)
  • BLOOM (bigscience/bloom, bigscience/bloomz, etc.)
  • Falcon (tiiuae/falcon-7b, tiiuae/falcon-40b, tiiuae/falcon-rw-7b, etc.)
  • GPT-2 (gpt2, gpt2-xl, etc.)
  • GPT BigCode (bigcode/starcoder, bigcode/gpt_bigcode-santacoder, etc.)
  • GPT-J (EleutherAI/gpt-j-6b, nomic-ai/gpt4all-j, etc.)
  • GPT-NeoX (EleutherAI/gpt-neox-20b, databricks/dolly-v2-12b, stabilityai/stablelm-tuned-alpha-7b, etc.)
  • InternLM (internlm/internlm-7b, internlm/internlm-chat-7b, etc.)
  • LLaMA & LLaMA-2 (meta-llama/Llama-2-70b-hf, lmsys/vicuna-13b-v1.3, young-geng/koala, openlm-research/open_llama_13b, etc.)
  • MPT (mosaicml/mpt-7b, mosaicml/mpt-30b, etc.)
  • OPT (facebook/opt-66b, facebook/opt-iml-max-30b, etc.)
  • Qwen (Qwen/Qwen-7B, Qwen/Qwen-7B-Chat, etc.)

参考资料:

github-vllm

有人使用vLLM加速过自己的大语言模型吗?效果怎么样?

比HuggingFace快24倍!伯克利神级LLM推理系统开源,碾压SOTA,让GPU砍半

deepspeed

DeepSpeed是微软推出的大规模模型分布式训练的工具,主要实现了ZeRO并行训练算法。
这个框架可以做训练,也可以推理。我同事使用这个框架对baichuan-13进行推理,功能正常。

DeepSpeed has been used to train many different large-scale models, below is a list of several examples that we are aware of (if you’d like to include your model please submit a PR):

参考资料:

github.com/microsoft/DeepSpeed

deepspeed入门教程

lmdeploy

LMDeploy 由 MMDeploy 和 MMRazor 团队联合开发,是涵盖了 LLM 任务的全套轻量化、部署和服务解决方案。
支持的模型:

Note

W4A16 推理需要 Ampere 及以上架构的 Nvidia GPU

模型模型并行FP16KV INT8W4A16W8A8
LlamaYesYesYesYesNo
Llama2YesYesYesYesNo
InternLMYesYesYesYesNo
QWen-7BYesYesYesNoNo
Baichuan-7BYesYesYesYesNo
Baichuan2-7BYesYesNoNoNo
Code LlamaYesYesNoNoNo

参考资料:

LLM 低成本 GPU 部署方案 lmdeploy 开源

InternLM/lmdeploy

TurboTransformers

TurboTransformers是腾讯开源的模型加速推理框架。

当前支持的模型种类不算多:

参考资料:

Tencent/TurboTransformers

腾讯开源TurboTransformers,推理加速性能超越TensorRT等主流优化引擎

参考资料

LLM推理优化技术综述:KVCache、PageAttention、FlashAttention、MQA、GQA

小记:主流推理框架在Llama 2 的上性能比较

vllm vs TGI 部署 llama v2 7B 踩坑笔记

目前业界大模型推理框架很多,各有什么优缺点,应该如何选择?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值