Deploy an AI Coding Assistant with NVIDIA TensorRT-LLM and NVIDIA Triton | NVIDIA Technical Blog
Quick Start Guide — tensorrt_llm documentation (nvidia.github.io)
使用TensorRT-LLM的源码,来下载docker并在docker里编译TensorRT-LLM;
模型格式先Huggingface转为FasterTransformer;再用TensorRT-LLM将其compile为TensorRT engine;然后可用TensorRT-LLM的C++ runtime来跑推理(或者模型放到Triton Repo上,并指定TensorRT-LLM为backend)
Input的Tokenizing和Output的De-Tokenizing,视作前处理、后处理,创建"Python Model";整个流程用一个"Ensemble Model"来表示,包含以上两个"Model"以及真正的GPT-Model;
LLama:
https://github.com/NVIDIA/TensorRT-LLM/blob/main/examples/llama/README.md
TensorRT-LLM支持很多常用模型;例如:baichuan、internlm、chatglm、qwen、bloom、gpt、gptneox、llama;
convert_checkpoint.py,是每种模型用自己的;run.py,是所有模型共享;
每种模型,支持的技术完善程度不同。
支持LLama的以下功能:
- FP16
- FP8
- INT8 & INT4 Weight-Only
- SmoothQuant
- Groupwise quantization (AWQ/GPTQ)
- FP8 KV CACHE
- INT8 KV CACHE (+ AWQ/per-channel weight-only)
- Tensor Parallel
- STRONGLY TYPED
python convert_checkpoint.py
--tp_size 4 // Tensor-parallel
--pp_size 4 // Pipeline-parallel
Pipeline并行,在某一个GPU忙碌时,其他GPU是否在忙着处理别的batch?
量化相关:
Numerical Precision — tensorrt_llm documentation (nvidia.github.io)
9种量化,对每种模型只支持一部分:
Model |
FP32 |
FP16 |
BF16 |
FP8 |
W8A8 SQ |
W8A16 |
W4A16 |
W4A16 AWQ |
W4A16 GPTQ |
---|