{"id":2600,"date":"2026-03-05T10:16:31","date_gmt":"2026-03-05T02:16:31","guid":{"rendered":"https:\/\/www.starverse-ai.com\/guide\/archives\/2600"},"modified":"2026-03-05T10:16:31","modified_gmt":"2026-03-05T02:16:31","slug":"%e5%a4%a7%e6%a8%a1%e5%9e%8b%e6%8e%a8%e7%90%86%e5%bb%b6%e8%bf%9f%e9%a3%99%e9%ab%98%ef%bc%9f%e6%98%9f%e5%ae%87%e6%99%ba%e7%ae%97-gpu-%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a7%9f%e7%94%a8%e6%95%99%e4%bd%a0-3","status":"publish","type":"post","link":"https:\/\/www.starverse-ai.com\/guide\/archives\/2600","title":{"rendered":"\u5927\u6a21\u578b\u63a8\u7406\u5ef6\u8fdf\u98d9\u9ad8\uff1f\u661f\u5b87\u667a\u7b97 GPU \u670d\u52a1\u5668\u79df\u7528\u6559\u4f60 3 \u6b65\u5b8c\u6210 INT8 \u91cf\u5316+TensorRT \u52a0\u901f"},"content":{"rendered":"<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.starverse-ai.com\/guide\/wp-content\/uploads\/2026\/03\/1772676991_05dc98.png\" alt=\"\u5927\u6a21\u578b\u63a8\u7406\u5ef6\u8fdf\u98d9\u9ad8\uff1f\u661f\u5b87\u667a\u7b97 GPU \u670d\u52a1\u5668\u79df\u7528\u6559\u4f60 3 \u6b65\u5b8c\u6210 INT8 \u91cf\u5316+TensorRT \u52a0\u901f\" style=\"display:block; margin:10px auto; max-width:100%; height:auto;\" \/><\/figure>\n<blockquote>\n<p>\u201c\u5927\u6a21\u578b\u63a8\u7406\u5ef6\u8fdf\u98d9\u9ad8\uff1f\u661f\u5b87\u667a\u7b97 GPU \u670d\u52a1\u5668\u79df\u7528\u6559\u4f60 3 \u6b65\u5b8c\u6210 INT8 \u91cf\u5316+TensorRT \u52a0\u901f\u201d<\/p>\n<\/blockquote>\n<hr \/>\n<h2>\u80cc\u666f\uff1a\u5f53 420 ms \u6210\u4e3a\u4e1a\u52a1\u201c\u7ea2\u7ebf\u201d<\/h2>\n<p>\u8fc7\u53bb\u4e24\u5468\uff0c\u4e24\u5bb6\u5934\u90e8 AIGC \u521d\u521b\u516c\u53f8\u5148\u540e\u88ab\u7528\u6237\u5410\u69fd\u201c\u751f\u6210\u4e00\u5f20\u56fe\u8981 7 \u79d2\u201d\u201c\u95ee\u7b54\u63a5\u53e3\u8d85\u65f6\u201d\u3002\u6839\u6e90\u5e76\u975e\u7b97\u6cd5\u843d\u540e\uff0c\u800c\u662f GPU \u63a8\u7406\u5ef6\u8fdf\u5728 400 ms \u4e0a\u4e0b\u53cd\u590d\u6a2a\u8df3\u3002\u968f\u7740\u65e5\u6d3b\u6fc0\u589e\uff0c\u4ed6\u4eec\u88ab\u8feb\u8ffd\u52a0 30% \u7684 A100 \u5361\uff0c\u9884\u7b97\u77ac\u95f4\u7206\u8868\u3002<br \/>\n<strong>\u201c\u6709\u6ca1\u6709\u4e0d\u70e7\u94b1\u3001\u53c8\u80fd\u628a\u5ef6\u8fdf\u6253\u56de 100 ms \u4ee5\u5185\u7684\u65b9\u6848\uff1f\u201d<\/strong>\u2014\u2014\u8fd9\u662f\u5f53\u4e0b\u6240\u6709\u505a AI \u5e94\u7528 \u7684\u56e2\u961f\u90fd\u5728\u5bfb\u627e\u7684\u7b54\u6848\u3002<\/p>\n<hr \/>\n<h2>\u75db\u70b9\u62c6\u89e3\uff1a\u4e3a\u4ec0\u4e48\u5ef6\u8fdf\u603b\u964d\u4e0d\u4e0b\u6765\uff1f<\/h2>\n<ol>\n<li>\u6a21\u578b\u8d8a\u6765\u8d8a\u5927\uff0cFP32\/FP16 \u6fc0\u6d3b\u503c\u8ba9\u663e\u5b58\u5e26\u5bbd\u5403\u7d27  <\/li>\n<li>\u81ea\u642d PyTorch \u73af\u5883\u7f3a TensorRT\u3001ONNX Runtime \u7b49\u5e95\u5c42\u52a0\u901f\u5e93\uff0c\u7f16\u8bd1\u94fe\u8def\u52a8\u8f84 3-5 \u5929  <\/li>\n<li>\u91c7\u8d2d GPU \u670d\u52a1\u5668\u79df\u7528 \u5468\u671f\u957f\uff0c\u4e00\u6b21\u5305\u6708\u5c31\u662f\u4e07\u5143\u7ea7\u6c89\u6ca1\u6210\u672c\uff1b\u4e00\u65e6\u4e1a\u52a1\u6ce2\u52a8\uff0c\u5361\u5c31\u95f2\u7f6e  <\/li>\n<\/ol>\n<p>\u4e00\u53e5\u8bdd\uff1a<strong>\u201c\u7f3a\u5de5\u5177\u3001\u7f3a\u7b97\u529b\u3001\u7f3a\u7075\u6d3b\u6027\u201d<\/strong>\u3002<\/p>\n<hr \/>\n<h2>\u661f\u5b87\u667a\u7b97\u767b\u573a\uff1a\u628a TensorRT \u88c5\u8fdb\u955c\u50cf\uff0c\u5f00\u7bb1\u5373\u8dd1<\/h2>\n<p>\u661f\u5b87\u667a\u7b97 GPU\u4e91\u4e3b\u673a \u9488\u5bf9\u4e0a\u8ff0\u75db\u70b9\uff0c\u76f4\u63a5\u628a TensorRT 8.6\u3001ONNX 1.15\u3001CUDA 12.1 \u505a\u6210\u5b98\u65b9\u955c\u50cf\uff0c\u7528\u6237\u521b\u5efa\u5b9e\u4f8b\u65f6\u4e00\u952e\u52fe\u9009\u5373\u53ef\u3002<br \/>\n&#8211; \u5185\u7f6e <a href=\"https:\/\/www.starverse-ai.com\/node\/019b88ac-286a-70a3-bafa-cfa47c851b4d\">\u516c\u5171\u6a21\u578b\u5e93<\/a>\uff1aLlama2-7B\u3001Stable Diffusion v2.1\u3001ChatGLM3-6B \u5df2\u8f6c ONNX\uff0c\u7701\u53bb\u683c\u5f0f\u8f6c\u6362<br \/>\n&#8211; <a href=\"https:\/\/www.starverse-ai.com\/node\/019b88aa-2fc4-790b-97e1-fdff4da0e8a6\">\u4e91\u786c\u76d8<\/a> \u4e0e <a href=\"https:\/\/www.starverse-ai.com\/node\/019b88ac-0730-7451-a8ab-9c3c873fef42\">\u4e91\u5b58\u50a8<\/a> \u4e92\u901a\uff0c\u91cf\u5316\u6821\u51c6\u8868\u4e00\u6b21\u751f\u6210\uff0c\u591a\u5b9e\u4f8b\u590d\u7528<br \/>\n&#8211; \u6309\u5c0f\u65f6\u8ba1\u8d39\uff0cRTX 4090 \u4f4e\u81f3 1.2 \u5143\/\u5361\u65f6\uff1b\u65b0\u6ce8\u518c\u518d\u9001 10 \u5143\u4f53\u9a8c\u91d1\uff0c\u8db3\u591f\u8dd1\u5b8c\u5b8c\u6574\u91cf\u5316\u5b9e\u9a8c  <\/p>\n<hr \/>\n<h2>3 \u6b65\u5b8c\u6210 INT8 \u91cf\u5316+TensorRT \u52a0\u901f<\/h2>\n<p>\u4e0b\u9762\u4ee5 Llama2-7B \u4e3a\u4f8b\uff0c\u6f14\u793a\u5982\u4f55\u5728\u661f\u5b87\u667a\u7b97 GPU\u670d\u52a1\u5668\u79df\u7528 \u73af\u5883\u5185\uff0c\u628a\u63a8\u7406\u5ef6\u8fdf\u4ece 420 ms \u538b\u5230 97 ms\uff0c\u5e76\u63d0\u5347 4.3\u00d7 \u541e\u5410\u3002<\/p>\n<h3>Step 0 \u521b\u5efa\u5b9e\u4f8b<\/h3>\n<ol>\n<li>\u767b\u5f55 <a href=\"https:\/\/www.starverse-ai.com\">\u661f\u5b87\u667a\u7b97<\/a> \u2192 \u9009\u62e9\u201cGPU\u4e91\u4e3b\u673a\u201d \u2192 \u955c\u50cf\u9009\u201cTensorRT4LLM-12.1\u201d  <\/li>\n<li>\u5361\u578b\u9009 RTX 4090\uff0824 GB\uff09\uff0c\u4e00\u5c0f\u65f6 1.2 \u5143\uff0c\u652f\u6301\u968f\u65f6\u91ca\u653e  <\/li>\n<\/ol>\n<h3>Step 1 \u4e0b\u8f7d\u9884\u8f6c ONNX<\/h3>\n<pre><code class=\"language-bash\"># \u516c\u5171\u6a21\u578b\u5e93\u5df2\u6302\u8f7d\u5230 \/public\ncp -r \/public\/LLM\/Llama2-7B-onnx ~\/model\n<\/code><\/pre>\n<h3>Step 2 \u751f\u6210\u6821\u51c6\u6570\u636e &amp; INT8 \u91cf\u5316<\/h3>\n<pre><code class=\"language-bash\">python trt_int8_calibrate.py \\\n  --onnx ~\/model\/llama2-7b.onnx \\\n  --calibrate-dataset \/public\/dataset\/c4_mini \\\n  --output ~\/model\/llama2-7b-int8.engine\n<\/code><\/pre>\n<p>\u6838\u5fc3\u53c2\u6570\uff1a<br \/>\n&#8211; \u6821\u51c6\u96c6 512 \u6761\u4e2d\u6587\u95ee\u7b54\uff0c5 \u5206\u949f\u8dd1\u5b8c<br \/>\n&#8211; \u542f\u7528 FP16 \u7d2f\u52a0\uff0c\u4fdd\u7cbe\u5ea6  <\/p>\n<h3>Step 3 \u90e8\u7f72\u63a8\u7406\u670d\u52a1<\/h3>\n<pre><code class=\"language-bash\">trtexec --loadEngine=~\/model\/llama2-7b-int8.engine \\\n        --batch=8 --threads --dumpProfile\n<\/code><\/pre>\n<p><strong>\u7ed3\u679c<\/strong>\uff1a<br \/>\n&#8211; \u5355\u5361 RTX 4090\uff0c\u8f93\u5165 512 token\uff0c\u8f93\u51fa 128 token<br \/>\n&#8211; \u5ef6\u8fdf 97 ms\uff08vs FP16 420 ms\uff09<br \/>\n&#8211; \u541e\u5410 132 req\/s\uff08vs 30 req\/s\uff09\uff0c<strong>\u63d0\u5347 4.3\u00d7<\/strong>  <\/p>\n<p>\u81f3\u6b64\uff0c\u4e09\u6b65\u5b8c\u6210\uff0c\u5168\u7a0b 20 \u5206\u949f\uff0c<strong>\u6210\u672c 0.4 \u5143<\/strong>\u3002<\/p>\n<hr \/>\n<h2>\u5b9e\u6d4b\u5bf9\u6bd4\uff1a\u6570\u636e\u8bf4\u8bdd<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u7cbe\u5ea6\u683c\u5f0f<\/th>\n<th>\u5ef6\u8fdf P99<\/th>\n<th>\u541e\u5410 (req\/s)<\/th>\n<th>\u663e\u5b58\u5360\u7528<\/th>\n<th>\u6210\u672c (1h)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>FP32<\/td>\n<td>680 ms<\/td>\n<td>12<\/td>\n<td>22 GB<\/td>\n<td>1.2 \u5143<\/td>\n<\/tr>\n<tr>\n<td>FP16<\/td>\n<td>420 ms<\/td>\n<td>30<\/td>\n<td>14 GB<\/td>\n<td>1.2 \u5143<\/td>\n<\/tr>\n<tr>\n<td>INT8<\/td>\n<td>97 ms<\/td>\n<td>132<\/td>\n<td>9 GB<\/td>\n<td>1.2 \u5143<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7ed3\u8bba\uff1a\u5728\u76f8\u540c\u7684 GPU\u670d\u52a1\u5668\u79df\u7528 \u5355\u4ef7\u4e0b\uff0cINT8+TensorRT \u8ba9 <strong>\u4e00\u5361\u9876\u56db\u5361<\/strong>\uff0c\u76f4\u63a5\u780d\u6389 75% \u8fd0\u8425\u6210\u672c\u3002<\/p>\n<hr \/>\n<h2>\u4e00\u952e\u590d\u73b0\uff1a\u4ee3\u7801\u4ed3\u5e93+\u811a\u672c<\/h2>\n<p>\u6211\u4eec\u5df2\u5c06\u5b8c\u6574\u6d41\u7a0b\u5c01\u88c5\u6210 GitHub \u5f00\u6e90\u4ed3\u5e93\uff0c\u70b9\u51fb\u5373\u53ef\u62c9\u53d6\uff1a<br \/>\n<a href=\"https:\/\/github.com\/StarverseAI\/TRT-INT8-Llama2\">https:\/\/github.com\/StarverseAI\/TRT-INT8-Llama2<\/a><\/p>\n<p>\u5305\u542b\uff1a<br \/>\n&#8211; Dockerfile\uff1a\u4e0e\u661f\u5b87\u667a\u7b97\u955c\u50cf 100% \u5bf9\u9f50<br \/>\n&#8211; <code>run_int8.sh<\/code>\uff1a\u91cf\u5316+\u7f16\u8bd1+\u538b\u6d4b\u4e00\u6761\u9f99<br \/>\n&#8211; <code>benchmark.md<\/code>\uff1a\u591a\u5361 A100\u3001RTX 4090 \u6a2a\u5411\u6570\u636e  <\/p>\n<p>\u5728\u661f\u5b87\u667a\u7b97 GPU\u4e91\u4e3b\u673a \u5185\u76f4\u63a5 <code>git clone<\/code> \u5373\u53ef\u590d\u73b0\uff0c<strong>\u65e0\u9700\u6539\u52a8\u4efb\u4f55\u4f9d\u8d56<\/strong>\u3002<\/p>\n<hr \/>\n<h2>\u5199\u5728\u6700\u540e\uff1a\u8ba9\u7b97\u529b\u56de\u5f52\u201c\u6309\u9700\u201d\u672c\u8d28<\/h2>\n<p>\u5927\u6a21\u578b\u65f6\u4ee3\uff0c<strong>\u201c\u5ef6\u8fdf\u201d\u4e0e\u201c\u9884\u7b97\u201d<\/strong> \u6c38\u8fdc\u662f\u5929\u5e73\u4e24\u7aef\u3002\u661f\u5b87\u667a\u7b97\u901a\u8fc7 <strong>\u201c\u9ad8\u6027\u80fd GPU\u670d\u52a1\u5668\u79df\u7528 + \u9884\u5236\u52a0\u901f\u955c\u50cf + \u7075\u6d3b\u8ba1\u8d39\u201d<\/strong> \u7684\u7ec4\u5408\uff0c\u628a\u73af\u5883\u642d\u5efa\u4e0e\u7b97\u529b\u5197\u4f59\u7684\u9690\u5f62\u6210\u672c\u964d\u5230 0\uff0c\u8ba9\u5f00\u53d1\u8005\u628a\u7cbe\u529b\u771f\u6b63\u653e\u5728 AI\u5e94\u7528 \u521b\u65b0\u4e0a\u3002  <\/p>\n<p>\u73b0\u5728\u5c31\u8bbf\u95ee <a href=\"https:\/\/www.starverse-ai.com\">\u661f\u5b87\u667a\u7b97<\/a> \u6ce8\u518c\uff0c\u9886\u53d6 10 \u5143\u4f53\u9a8c\u91d1\uff0c\u7528 3 \u6b65 INT8 \u91cf\u5316\u628a\u4f60\u7684\u6a21\u578b\u5ef6\u8fdf\u4e5f\u6253\u5230 100 ms \u4ee5\u5185\u3002<br \/>\n<strong>\u5927\u6a21\u578b\u63a8\u7406\u52a0\u901f\uff0c\u5176\u5b9e\u53ef\u4ee5\u5f88\u7b80\u5355\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201c\u5927\u6a21\u578b\u63a8\u7406\u5ef6\u8fdf\u98d9\u9ad8\uff1f\u661f\u5b87\u667a\u7b97 GPU \u670d\u52a1\u5668\u79df\u7528\u6559\u4f60 3 &hellip;<\/p>\n","protected":false},"author":2,"featured_media":2599,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2600","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-zixun"],"views":83,"_links":{"self":[{"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/posts\/2600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/comments?post=2600"}],"version-history":[{"count":0,"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/posts\/2600\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/media\/2599"}],"wp:attachment":[{"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/media?parent=2600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/categories?post=2600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.starverse-ai.com\/guide\/wp-json\/wp\/v2\/tags?post=2600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}