{"id":27244,"date":"2025-02-28T20:18:04","date_gmt":"2025-02-28T12:18:04","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=27244"},"modified":"2025-02-28T20:18:22","modified_gmt":"2025-02-28T12:18:22","slug":"deepseek-r1-fp4","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/pt\/deepseek-r1-fp4\/","title":{"rendered":"DeepSeek-R1-FP4\uff1aFP4\u4f18\u5316\u7248DeepSeek-R1\u63a8\u7406\u901f\u5ea625\u500d"},"content":{"rendered":"<p>DeepSeek-R1-FP4 \u662f\u7531 NVIDIA \u5f00\u6e90\u5e76\u4f18\u5316\u7684\u4e00\u4e2a\u91cf\u5316\u8bed\u8a00\u6a21\u578b\uff0c\u57fa\u4e8e <a href=\"https:\/\/www.kdjingpai.com\/deepseek-chatshena\/\">DeepSeek<\/a> AI \u7684 <a href=\"https:\/\/www.kdjingpai.com\/deepseek-r1nenglixiang\/\">DeepSeek-R1<\/a> \u5f00\u53d1\u3002\u5b83\u901a\u8fc7 TensorRT Model Optimizer \u5c06\u6743\u91cd\u548c\u6fc0\u6d3b\u503c\u91cf\u5316\u4e3a FP4 \u6570\u636e\u7c7b\u578b\uff0c\u4f7f\u6a21\u578b\u5728\u4fdd\u6301\u9ad8\u6027\u80fd\u7684\u540c\u65f6\u5927\u5e45\u964d\u4f4e\u8d44\u6e90\u9700\u6c42\u3002\u76f8\u6bd4\u539f\u59cb\u6a21\u578b\uff0c\u78c1\u76d8\u7a7a\u95f4\u548c GPU \u5185\u5b58\u5360\u7528\u51cf\u5c11\u7ea6 1.6 \u500d\uff0c\u975e\u5e38\u9002\u5408\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u8fdb\u884c\u9ad8\u6548\u63a8\u7406\u3002\u8be5\u6a21\u578b\u7279\u522b\u9488\u5bf9 NVIDIA \u7684 Blackwell \u67b6\u6784\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u636e\u79f0\u63a8\u7406\u901f\u5ea6\u63d0\u5347\u9ad8\u8fbe 25 \u500d\uff0c\u6bcf <a href=\"https:\/\/www.kdjingpai.com\/tokenization\/\">token<\/a> \u6210\u672c\u964d\u4f4e 20 \u500d\uff0c\u5c55\u73b0\u4e86\u5f3a\u5927\u7684\u6027\u80fd\u6f5c\u529b\u3002\u5b83\u652f\u6301\u957f\u8fbe 128K \u7684\u4e0a\u4e0b\u6587\u957f\u5ea6\uff0c\u9002\u7528\u4e8e\u5904\u7406\u590d\u6742\u6587\u672c\u4efb\u52a1\uff0c\u4e14\u5f00\u653e\u7ed9\u5546\u4e1a\u548c\u975e\u5546\u4e1a\u7528\u9014\uff0c\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u4e00\u4e2a\u9ad8\u6027\u4ef7\u6bd4\u7684 AI \u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p><img decoding=\"async\" title=\"DeepSeek-R1-FP4\uff1a\u8ba9DeepSeek-R1\u63a8\u7406\u901f\u8bfb\u63d0\u534725\u500d-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/02\/80b6a3a573bb9b5.png\" alt=\"DeepSeek-R1-FP4\uff1a\u8ba9DeepSeek-R1\u63a8\u7406\u901f\u8bfb\u63d0\u534725\u500d-1\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li><strong>\u9ad8\u6548\u63a8\u7406<\/strong>: \u4f7f\u7528 FP4 \u91cf\u5316\u6280\u672f\u5927\u5e45\u63d0\u5347\u63a8\u7406\u901f\u5ea6\uff0c\u4f18\u5316\u8d44\u6e90\u4f7f\u7528\u3002<\/li>\n<li><strong>\u957f\u4e0a\u4e0b\u6587\u652f\u6301<\/strong>: \u6700\u5927\u652f\u6301 128K \u7684\u4e0a\u4e0b\u6587\u957f\u5ea6\uff0c\u9002\u5408\u5904\u7406\u957f\u6587\u672c\u751f\u6210\u4efb\u52a1\u3002<\/li>\n<li><strong>TensorRT-LLM \u90e8\u7f72<\/strong>: \u53ef\u901a\u8fc7 TensorRT-LLM \u6846\u67b6\u5feb\u901f\u90e8\u7f72\u5230 NVIDIA GPU \u4e0a\u8fd0\u884c\u3002<\/li>\n<li><strong>\u5f00\u6e90\u4f7f\u7528<\/strong>: \u652f\u6301\u5546\u4e1a\u548c\u975e\u5546\u4e1a\u573a\u666f\uff0c\u5141\u8bb8\u81ea\u7531\u4fee\u6539\u548c\u884d\u751f\u5f00\u53d1\u3002<\/li>\n<li><strong>\u6027\u80fd\u4f18\u5316<\/strong>: \u9488\u5bf9 Blackwell \u67b6\u6784\u8bbe\u8ba1\uff0c\u63d0\u4f9b\u8d85\u9ad8\u63a8\u7406\u6548\u7387\u548c\u6210\u672c\u6548\u76ca\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5\u4e0e\u90e8\u7f72\u6d41\u7a0b<\/h3>\n<p>DeepSeek-R1-FP4 \u7684\u90e8\u7f72\u9700\u8981\u4e00\u5b9a\u7684\u786c\u4ef6\u548c\u8f6f\u4ef6\u73af\u5883\u652f\u6301\uff0c\u5c24\u5176\u662f NVIDIA GPU \u548c TensorRT-LLM \u6846\u67b6\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u6307\u5357\uff0c\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u4e0a\u624b\u3002<\/p>\n<h4>1. \u73af\u5883\u51c6\u5907<\/h4>\n<ul>\n<li><strong>\u786c\u4ef6\u8981\u6c42<\/strong>: \u5efa\u8bae\u4f7f\u7528 NVIDIA Blackwell \u67b6\u6784 GPU\uff08\u5982 B200\uff09\uff0c\u81f3\u5c11\u9700\u8981 8 \u5f20 GPU\uff08\u6bcf\u5f20\u663e\u5b58\u9700\u6ee1\u8db3\u6a21\u578b\u9700\u6c42\uff0c\u7ea6 336GB VRAM \u672a\u91cf\u5316\uff0c\u91cf\u5316\u540e\u7ea6 1342GB\uff09\u3002\u5bf9\u4e8e\u66f4\u5c0f\u89c4\u6a21\u7684\u6d4b\u8bd5\uff0c\u63a8\u8350\u81f3\u5c11 1 \u5f20\u9ad8\u6027\u80fd GPU\uff08\u5982 A100\/H100\uff09\u3002<\/li>\n<li><strong>\u8f6f\u4ef6\u4f9d\u8d56<\/strong>:\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7edf\uff1aLinux\uff08\u5982 Ubuntu 20.04 \u6216\u66f4\u9ad8\u7248\u672c\uff09\u3002<\/li>\n<li>NVIDIA \u9a71\u52a8\uff1a\u6700\u65b0\u7248\u672c\uff08\u652f\u6301 CUDA 12.4 \u6216\u66f4\u9ad8\uff09\u3002<\/li>\n<li>TensorRT-LLM\uff1a\u9700\u4ece GitHub \u6e90\u7801\u7f16\u8bd1\u6700\u65b0\u4e3b\u5206\u652f\u7248\u672c\u3002<\/li>\n<li>Python\uff1a3.11 \u6216\u66f4\u9ad8\u7248\u672c\u3002<\/li>\n<li>\u5176\u4ed6\u5e93\uff1a<code>tensorrt_llm<\/code>\u3001<code>torch<\/code>\u00a0\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2. \u4e0b\u8f7d\u6a21\u578b<\/h4>\n<ul>\n<li>\u8bbf\u95ee\u00a0<a href=\"https:\/\/huggingface.co\/nvidia\/DeepSeek-R1-FP4\">Hugging Face \u9875\u9762<\/a>\uff0c\u70b9\u51fb\u201cFiles and versions\u201d\u9009\u9879\u5361\u3002<\/li>\n<li>\u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6\uff08\u5982\u00a0<code>model-00001-of-00080.safetensors<\/code>\u00a0\u7b49\uff0c\u5171 80 \u4e2a\u5206\u7247\uff0c\u603b\u5927\u5c0f\u8d85 400GB\uff09\u3002<\/li>\n<li>\u5c06\u6587\u4ef6\u4fdd\u5b58\u81f3\u672c\u5730\u76ee\u5f55\uff0c\u4f8b\u5982\u00a0<code>\/path\/to\/model\/<\/code>\u3002<\/li>\n<\/ul>\n<h4>3. \u5b89\u88c5 TensorRT-LLM<\/h4>\n<ul>\n<li>\u4ece GitHub \u514b\u9686\u6700\u65b0 TensorRT-LLM \u4ed3\u5e93\uff1a\n<pre><code>git clone https:\/\/github.com\/NVIDIA\/TensorRT-LLM.git\r\ncd TensorRT-LLM<\/code><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li>\u7f16\u8bd1\u5e76\u5b89\u88c5\uff1a\n<pre><code>make build\r\npip install -r requirements.txt\r\n<\/code><\/pre>\n<\/li>\n<li>\u9a8c\u8bc1\u5b89\u88c5\uff1a\n<pre><code>python -c \"import tensorrt_llm; print(tensorrt_llm.__version__)\"\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>4. \u90e8\u7f72\u6a21\u578b<\/h4>\n<ul>\n<li>\u4f7f\u7528\u63d0\u4f9b\u7684\u793a\u4f8b\u4ee3\u7801\u52a0\u8f7d\u5e76\u8fd0\u884c\u6a21\u578b\uff1a\n<pre><code>from tensorrt_llm import SamplingParams, LLM\r\n# \u521d\u59cb\u5316\u6a21\u578b\r\nllm = LLM(\r\nmodel=\"\/path\/to\/model\/nvidia\/DeepSeek-R1-FP4\",\r\ntensor_parallel_size=8,  # \u6839\u636e GPU \u6570\u91cf\u8c03\u6574\r\nenable_attention_dp=True\r\n)\r\n# \u8bbe\u7f6e\u91c7\u6837\u53c2\u6570\r\nsampling_params = SamplingParams(max_tokens=32)\r\n# \u8f93\u5165\u63d0\u793a\r\nprompts = [\r\n\"\u4f60\u597d\uff0c\u6211\u7684\u540d\u5b57\u662f\",\r\n\"\u7f8e\u56fd\u603b\u7edf\u662f\",\r\n\"\u6cd5\u56fd\u7684\u9996\u90fd\u662f\",\r\n\"AI\u7684\u672a\u6765\u662f\"\r\n]\r\n# \u751f\u6210\u8f93\u51fa\r\noutputs = llm.generate(prompts, sampling_params)\r\nfor output in outputs:\r\nprint(output)\r\n<\/code><\/pre>\n<\/li>\n<li>\u6267\u884c\u4e0a\u8ff0\u4ee3\u7801\u524d\uff0c\u786e\u4fdd GPU \u8d44\u6e90\u5df2\u6b63\u786e\u5206\u914d\u3002\u82e5\u8d44\u6e90\u4e0d\u8db3\uff0c\u53ef\u8c03\u6574\u00a0<code>tensor_parallel_size<\/code>\u00a0\u53c2\u6570\u3002<\/li>\n<\/ul>\n<h4>5. \u529f\u80fd\u64cd\u4f5c\u6307\u5357<\/h4>\n<h5><strong>\u9ad8\u6548\u63a8\u7406<\/strong><\/h5>\n<ul>\n<li>DeepSeek-R1-FP4 \u7684\u6838\u5fc3\u4f18\u52bf\u662f\u5176 FP4 \u91cf\u5316\u6280\u672f\u3002\u7528\u6237\u65e0\u9700\u624b\u52a8\u8c03\u6574\u6a21\u578b\u53c2\u6570\uff0c\u53ea\u9700\u786e\u4fdd\u786c\u4ef6\u652f\u6301 Blackwell \u67b6\u6784\uff0c\u5373\u53ef\u4f53\u9a8c\u63a8\u7406\u901f\u5ea6\u63d0\u5347\u3002\u8fd0\u884c\u65f6\uff0c\u5efa\u8bae\u8bbe\u7f6e\u00a0<code>max_tokens<\/code>\u00a0\u53c2\u6570\u63a7\u5236\u8f93\u51fa\u957f\u5ea6\uff0c\u907f\u514d\u8d44\u6e90\u6d6a\u8d39\u3002<\/li>\n<li>\u64cd\u4f5c\u793a\u4f8b\uff1a\u5728\u7ec8\u7aef\u8fd0\u884c Python \u811a\u672c\uff0c\u8f93\u5165\u4e0d\u540c\u63d0\u793a\uff0c\u89c2\u5bdf\u8f93\u51fa\u901f\u5ea6\u548c\u8d28\u91cf\u3002<\/li>\n<\/ul>\n<h5><strong>\u957f\u4e0a\u4e0b\u6587\u5904\u7406<\/strong><\/h5>\n<ul>\n<li>\u8be5\u6a21\u578b\u652f\u6301\u9ad8\u8fbe 128K \u7684\u4e0a\u4e0b\u6587\u957f\u5ea6\uff0c\u9002\u5408\u751f\u6210\u957f\u7bc7\u6587\u7ae0\u6216\u5904\u7406\u590d\u6742\u5bf9\u8bdd\u3002<\/li>\n<li>\u64cd\u4f5c\u65b9\u6cd5\uff1a\u5728\u00a0<code>prompts<\/code>\u00a0\u4e2d\u8f93\u5165\u8f83\u957f\u7684\u4e0a\u4e0b\u6587\uff0c\u4f8b\u5982\u4e00\u6bb5 5000 \u5b57\u7684\u6587\u7ae0\u5f00\u5934\uff0c\u7136\u540e\u8bbe\u7f6e\u00a0<code>max_tokens=1000<\/code>\uff0c\u751f\u6210\u540e\u7eed\u5185\u5bb9\u3002\u8fd0\u884c\u540e\u68c0\u67e5\u751f\u6210\u6587\u672c\u7684\u8fde\u8d2f\u6027\u3002<\/li>\n<li>\u6ce8\u610f\u4e8b\u9879\uff1a\u957f\u4e0a\u4e0b\u6587\u53ef\u80fd\u589e\u52a0\u5185\u5b58\u5360\u7528\uff0c\u5efa\u8bae\u76d1\u63a7 GPU \u663e\u5b58\u4f7f\u7528\u60c5\u51b5\u3002<\/li>\n<\/ul>\n<h5><strong>\u6027\u80fd\u4f18\u5316<\/strong><\/h5>\n<ul>\n<li>\u82e5\u4f7f\u7528 Blackwell GPU\uff0c\u53ef\u76f4\u63a5\u53d7\u76ca\u4e8e 25 \u500d\u63a8\u7406\u901f\u5ea6\u63d0\u5347\u3002\u82e5\u4f7f\u7528\u5176\u4ed6\u67b6\u6784\uff08\u5982 A100\uff09\uff0c\u6027\u80fd\u589e\u76ca\u53ef\u80fd\u7565\u4f4e\uff0c\u4f46\u4ecd\u663e\u8457\u4f18\u4e8e\u672a\u91cf\u5316\u6a21\u578b\u3002<\/li>\n<li>\u64cd\u4f5c\u5efa\u8bae\uff1a\u5728\u591a GPU \u73af\u5883\u4e0b\uff0c\u8c03\u6574\u00a0<code>tensor_parallel_size<\/code>\u00a0\u53c2\u6570\u4ee5\u5145\u5206\u5229\u7528\u786c\u4ef6\u8d44\u6e90\u3002\u4f8b\u5982\uff0c8 \u5f20 GPU \u8bbe\u7f6e\u4e3a 8\uff0c4 \u5f20 GPU \u8bbe\u7f6e\u4e3a 4\u3002<\/li>\n<\/ul>\n<h4>6. \u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3<\/h4>\n<ul>\n<li><strong>\u663e\u5b58\u4e0d\u8db3<\/strong>: \u82e5\u63d0\u793a\u5185\u5b58\u6ea2\u51fa\uff0c\u51cf\u5c11\u00a0<code>tensor_parallel_size<\/code>\u00a0\u6216\u4f7f\u7528\u66f4\u4f4e\u91cf\u5316\u7248\u672c\uff08\u5982\u793e\u533a\u63d0\u4f9b\u7684 GGUF \u683c\u5f0f\uff09\u3002<\/li>\n<li><strong>\u63a8\u7406\u901f\u5ea6\u6162<\/strong>: \u786e\u4fdd TensorRT-LLM \u5df2\u6b63\u786e\u7f16\u8bd1\u5e76\u542f\u7528 GPU \u52a0\u901f\uff0c\u68c0\u67e5\u9a71\u52a8\u7248\u672c\u662f\u5426\u5339\u914d\u3002<\/li>\n<li><strong>\u8f93\u51fa\u5f02\u5e38<\/strong>: \u68c0\u67e5\u8f93\u5165\u63d0\u793a\u683c\u5f0f\uff0c\u786e\u4fdd\u4e0d\u542b\u7279\u6b8a\u5b57\u7b26\u5e72\u6270\u6a21\u578b\u3002<\/li>\n<\/ul>\n<h3>\u4f7f\u7528\u5efa\u8bae<\/h3>\n<ul>\n<li><strong>\u521d\u6b21\u4f7f\u7528<\/strong>: \u4ece\u7b80\u5355\u63d0\u793a\u5f00\u59cb\uff0c\u9010\u6b65\u589e\u52a0\u4e0a\u4e0b\u6587\u957f\u5ea6\uff0c\u719f\u6089\u6a21\u578b\u6027\u80fd\u3002<\/li>\n<li><strong>\u751f\u4ea7\u73af\u5883<\/strong>: \u90e8\u7f72\u524d\u6d4b\u8bd5\u591a\u7ec4\u63d0\u793a\uff0c\u786e\u4fdd\u8f93\u51fa\u7b26\u5408\u9884\u671f\u3002\u5efa\u8bae\u642d\u914d\u8d1f\u8f7d\u5747\u8861\u5de5\u5177\u4f18\u5316\u591a\u7528\u6237\u8bbf\u95ee\u3002<\/li>\n<li><strong>\u5f00\u53d1\u8005\u5b9a\u5236<\/strong>: \u53ef\u57fa\u4e8e\u5f00\u6e90\u8bb8\u53ef\u4fee\u6539\u6a21\u578b\uff0c\u9002\u914d\u7279\u5b9a\u4efb\u52a1\uff0c\u5982\u4ee3\u7801\u751f\u6210\u6216\u95ee\u7b54\u7cfb\u7edf\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u7528\u6237\u5373\u53ef\u5feb\u901f\u90e8\u7f72\u5e76\u4f7f\u7528 DeepSeek-R1-FP4\uff0c\u4eab\u53d7\u9ad8\u6548\u63a8\u7406\u5e26\u6765\u7684\u4fbf\u5229\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DeepSeek-R1-FP4 \u662f\u7531 NVIDIA \u5f00\u6e90\u5e76\u4f18\u5316\u7684\u4e00\u4e2a\u91cf\u5316\u8bed\u8a00\u6a21\u578b\uff0c\u57fa\u4e8e DeepSeek AI \u7684 DeepSeek-R1 \u5f00\u53d1\u3002\u5b83\u901a\u8fc7 TensorRT Model Optimizer \u5c06\u6743\u91cd\u548c\u6fc0\u6d3b\u503c\u91cf\u5316\u4e3a FP4 \u6570\u636e\u7c7b&#8230;<\/p>\n","protected":false},"author":1,"featured_media":61940,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[230],"class_list":["post-27244","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","tag-aikaiyuanxiangmu"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/27244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/comments?post=27244"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/27244\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media\/61940"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media?parent=27244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/categories?post=27244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/tags?post=27244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}