zhiyucheng commited on
Commit
2cdc043
·
verified ·
1 Parent(s): b2cbce0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +158 -0
README.md ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model Overview
2
+
3
+ ## Description:
4
+ The NVIDIA Llama 3.1 405B Instruct FP8 model is the quantized version of the Meta's Llama 3.1 405B Instruct model, which is an auto-regressive language model that uses an optimized transformer architecture. For more information, please check [here](https://huggingface.co/meta-llama/Meta-Llama-3.1-405B-Instruct). The NVIDIA Llama 3.1 405B Instruct FP8 model is quantized with [TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer).
5
+
6
+ This model is ready for commercial/non-commercial use. <br>
7
+
8
+ ## Third-Party Community Consideration [(Insert for Third-Party Community Models)]
9
+ This model is not owned or developed by NVIDIA. This model has been developed and built to a third-party’s requirements for this application and use case; see link to Non-NVIDIA [(Meta-Llama-3.1-405B-Instruct) Model Card](https://huggingface.co/meta-llama/Meta-Llama-3.1-405B-Instruct).
10
+
11
+ ### License/Terms of Use:
12
+ [llama3.1](https://huggingface.co/meta-llama/Meta-Llama-3.1-405B-Instruct/blob/main/LICENSE)
13
+
14
+ ## Model Architecture:
15
+ **Architecture Type:** Transformers <br>
16
+ **Network Architecture:** Llama3.1 <br>
17
+
18
+ ## Input:
19
+ **Input Type(s):** Text <br>
20
+ **Input Format(s):** String <br>
21
+ **Input Parameters:** Sequences <br>
22
+ **Other Properties Related to Input:** Context length up to 128K <br>
23
+
24
+ ## Output:
25
+ **Output Type(s):** Text <br>
26
+ **Output Format:** String <br>
27
+ **Output Parameters:** Sequences <br>
28
+ **Other Properties Related to Output:** N/A <br>
29
+
30
+ ## Software Integration:
31
+ **Supported Runtime Engine(s):** <br>
32
+ * Tensor(RT)-LLM <br>
33
+ * vLLM <br>
34
+
35
+ **Supported Hardware Microarchitecture Compatibility:** <br>
36
+ * NVIDIA Blackwell <br>
37
+ * NVIDIA Hopper <br>
38
+ * NVIDIA Lovelace <br>
39
+
40
+ **Preferred Operating System(s):** <br>
41
+ * Linux <br>
42
+
43
+ ## Model Version(s):
44
+ The model is quantized with nvidia-modelopt **v0.15.1** <br>
45
+
46
+ ## Datasets:
47
+ * Calibration Dataset: [cnn_dailymail](https://huggingface.co/datasets/abisee/cnn_dailymail) <br>
48
+ * Evaluation Dataset: [MMLU](https://github.com/hendrycks/test) <br>
49
+
50
+
51
+ ## Inference:
52
+ **Engine:** Tensor(RT)-LLM or vLLM <br>
53
+ **Test Hardware:** H200 <br>
54
+
55
+ ## Post Training Quantization
56
+ This model was obtained by quantizing the weights and activations of Meta-Llama-3.1-405B-Instruct to FP8 data type, ready for inference with TensorRT-LLM. Only the weights and activations of the linear operators within transformers blocks are quantized. This optimization reduces the number of bits per parameter from 16 to 8, reducing the disk size and GPU memory requirements by approximately 50%. On H200, we achieved 1.7x speedup.
57
+
58
+ ## Usage
59
+
60
+ ### Deploy with TensorRT-LLM
61
+
62
+ To deploy the quantized checkpoint with [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM), follow the sample commands below with the TensorRT-LLM GitHub repo:
63
+
64
+ * Checkpoint convertion:
65
+ ```sh
66
+ python examples/llama/convert_checkpoint.py --model_dir Llama-3.1-405B-Instruct-FP8 --output_dir /ckpt --use_fp8
67
+ ```
68
+
69
+ * Build engines:
70
+ ```sh
71
+ trtllm-build --checkpoint_dir /ckpt --output_dir /engine
72
+ ```
73
+
74
+ * Accuracy evaluation:
75
+
76
+ 1) Prepare the MMLU dataset:
77
+ ```sh
78
+ mkdir data; wget https://people.eecs.berkeley.edu/~hendrycks/data.tar -O data/mmlu.tar
79
+ tar -xf data/mmlu.tar -C data && mv data/data data/mmlu
80
+ ```
81
+
82
+ 2) Measure MMLU:
83
+
84
+ ```sh
85
+ python examples/mmlu.py --engine_dir ./engine --tokenizer_dir Llama-3.1-405B-Instruct-FP8/ --test_trt_llm --data_dir data/mmlu
86
+ ```
87
+
88
+ * Throughputs evaluation:
89
+
90
+ Please refer to the [TensorRT-LLM benchmarking documentation](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/Suite.md) for details.
91
+
92
+ #### Evaluation
93
+ The accuracy (MMLU, 5-shot) and throughputs (tokens per second, TPS) benchmark results are presented in the table below:
94
+ <table>
95
+ <tr>
96
+ <td><strong>Precision</strong>
97
+ </td>
98
+ <td><strong>MMLU</strong>
99
+ </td>
100
+ <td><strong>TPS</strong>
101
+ </td>
102
+ </tr>
103
+ <tr>
104
+ <td>FP16
105
+ </td>
106
+ <td>86.6
107
+ </td>
108
+ <td>275.0
109
+ </td>
110
+ </tr>
111
+ <tr>
112
+ <td>FP8
113
+ </td>
114
+ <td>86.2
115
+ </td>
116
+ <td>469.78
117
+ </td>
118
+ </tr>
119
+ <tr>
120
+ </table>
121
+ We benchmarked with tensorrt-llm v0.13 on 8 H200 GPUs, using batch size 1024 for the throughputs with in-flight batching enabled. We achieved **~1.7x** speedup with FP8.
122
+
123
+ ### Deploy with vLLM
124
+
125
+ To deploy the quantized checkpoint with [vLLM](https://github.com/vllm-project/vllm.git), follow the instructions below:
126
+
127
+ 1. Install vLLM from directions [here](https://github.com/vllm-project/vllm?tab=readme-ov-file#getting-started).
128
+ 2. To use a Model Optimizer PTQ checkpoint with vLLM, `quantization=modelopt` flag must be passed into the config while initializing `LLM` Engine.
129
+
130
+ Example:
131
+
132
+ ```
133
+ from vllm import LLM, SamplingParams
134
+
135
+ model_id = "nvidia/Llama-3.1-405B-Instruct-FP8"
136
+ tp_size = 8 #use the required number of gpus based on your GPU Memory.
137
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.9)
138
+ max_model_len = 8192
139
+
140
+ prompts = [
141
+ "Hello, my name is",
142
+ "The president of the United States is",
143
+ "The capital of France is",
144
+ "The future of AI is",
145
+ ]
146
+
147
+ llm = LLM(model=model_id, quantization='modelopt', tensor_parallel_size=tp_size, max_model_len=max_model_len)
148
+ outputs = llm.generate(prompts, sampling_params)
149
+
150
+ # Print the outputs.
151
+ for output in outputs:
152
+ prompt = output.prompt
153
+ generated_text = output.outputs[0].text
154
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
155
+
156
+ ```
157
+
158
+ This model can be deployed with an OpenAI Compatible Server via the vLLM backend. Instructions [here](https://docs.vllm.ai/en/latest/getting_started/quickstart.html#openai-compatible-server).