how do i quantize and serve qwen model with fp8 kv cache with an open ai server using…
- User
how do i quantize and serve qwen model with fp8 kv cache with an open ai server using tensorrt-llm?
Assistant
The provided documents do not contain specific information on quantizing and serving the Qwen model with FP8 KV cache using TensorRT-LLM and an OpenAI server. However, the documents do provide information about relevant tools and techniques that could be used to achieve this. Based on the provided context, here's how you might approach this, along with pointers to relevant tools:
1. Quantization:
- TensorRT Model Optimizer: The
pytorch-quantization/README.mdand thetensorflow-quantization/README.mdmention that the recommended tool for quantization is now the TensorRT Model Optimizer. This tool supports quantization for both PyTorch and TensorFlow models and is where the latest quantization advancements are being made. You should explore the TensorRT Model Optimizer repository for FP8 quantization support, especially for the KV cache. - Quantization Aware Training (QAT): The
tensorflow-quantization/README.mdmentions that the TensorFlow quantization toolkit implements NVIDIA's QAT recipe, which is suitable for TensorRT acceleration. If the Qwen model is originally in TensorFlow, you might consider using this toolkit as a starting point, and explore the possibility to customize it for FP8 and KV cache. - Pytorch Quantization Toolkit: While it is no longer under active development, the
pytorch-quantization/README.mdmentions it is compatible with NVIDIA's integer kernels for Tensor Cores. Although it is not clear that it supports FP8, you can check it out and adapt it to your use case.
2. Model Conversion and Optimization for TensorRT-LLM:
- ONNX: Both the
tensorflow-quantization/README.mdandpytorch-quantization/README.mdmention ONNX as an intermediate format for converting models to TensorRT. Therefore, a possible approach involves converting the quantized Qwen model to ONNX, and from there, TensorRT-LLM can import and optimize the model. - ONNX GraphSurgeon: As described in
onnx-graphsurgeon/README.md, this tool can be used to modify ONNX models. It could be helpful in adapting the ONNX model to be compatible with TensorRT-LLM's expected input and output formats. - Polygraphy: The
Polygraphy/README.mdindicates it can be used to convert models to TensorRT engines and compare results between backends. This tool may help with debugging and verifying the converted TensorRT-LLM model.
3. Serving with TensorRT-LLM and OpenAI API:
- TensorRT Model Optimizer: The
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.