{"id":62,"date":"2026-07-28T09:00:00","date_gmt":"2026-07-28T01:00:00","guid":{"rendered":"https:\/\/fsdata.site\/?p=62"},"modified":"2026-07-23T23:15:32","modified_gmt":"2026-07-23T15:15:32","slug":"%e6%9c%ac%e5%9c%b0%e9%83%a8%e7%bd%b2%e5%a4%a7%e6%a8%a1%e5%9e%8b-llm-%e5%ae%8c%e5%85%a8%e6%8c%87%e5%8d%97%ef%bc%9a%e4%bb%8e%e7%a1%ac%e4%bb%b6%e9%80%89%e5%9e%8b%e5%88%b0-vllm-%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/fsdata.site\/?p=62","title":{"rendered":"\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b LLM \u5b8c\u5168\u6307\u5357\uff1a\u4ece\u786c\u4ef6\u9009\u578b\u5230 vLLM \u5b9e\u6218"},"content":{"rendered":"<h2>\u4e00\u3001\u4e3a\u4ec0\u4e48\u8981\u672c\u5730\u90e8\u7f72\u5927\u6a21\u578b<\/h2>\n<p>\u628a\u6570\u636e\u4f20\u5230\u4e91\u7aef\u5927\u6a21\u578b\uff0c\u9690\u79c1\u548c\u5408\u89c4\u662f\u7ed5\u4e0d\u5f00\u7684\u574e\u3002\u672c\u5730\u90e8\u7f72\u8ba9\u4f60\u5728\u81ea\u6709\u670d\u52a1\u5668\u4e0a\u8dd1\u6a21\u578b\uff0c\u6570\u636e\u4e0d\u51fa\u5185\u7f51\u3002\u672c\u6587\u4ece\u786c\u4ef6\u5230\u5b9e\u6218\u5b8c\u6574\u8bb2\u4e00\u904d\u3002<\/p>\n<h2>\u4e8c\u3001\u786c\u4ef6\u600e\u4e48\u9009<\/h2>\n<h3>1. \u663e\u5b58\u662f\u6838\u5fc3<\/h3>\n<ul>\n<li><strong>7B \u6a21\u578b\uff08\u5982 Qwen2.5-7B\uff09<\/strong>\uff1a\u91cf\u5316\u540e 4-6GB \u663e\u5b58\uff0c\u4e00\u5f20 4060\/3060 \u591f\u7528\u3002<\/li>\n<li><strong>14B \u6a21\u578b<\/strong>\uff1a\u9700\u8981 12-16GB \u663e\u5b58\uff0c\u5efa\u8bae 4070 Ti \/ 3090\u3002<\/li>\n<li><strong>32B+ \u6a21\u578b<\/strong>\uff1a24GB+ \u663e\u5b58\uff0c4090 \u6216 A100\u3002<\/li>\n<\/ul>\n<p>\u6ca1\u6709\u72ec\u663e\u4e5f\u80fd\u8dd1\uff0c\u7528 CPU + \u5927\u5185\u5b58\uff0832GB+\uff09\uff0c\u53ea\u662f\u6162\u3002<\/p>\n<h3>2. \u91cf\u5316\u53d6\u820d<\/h3>\n<p>Q4_K_M \u91cf\u5316\u5728\u4f53\u79ef\u548c\u6548\u679c\u95f4\u6700\u5e73\u8861\uff0c\u65e5\u5e38\u4f7f\u7528\u57fa\u672c\u65e0\u635f\u3002<\/p>\n<h2>\u4e09\u3001\u7528 Ollama \u4e94\u5206\u949f\u8d77\u6a21\u578b<\/h2>\n<pre><code># \u5b89\u88c5\ncurl -fsSL https:\/\/ollama.com\/install.sh | sh\n# \u62c9\u53d6\u5e76\u8fd0\u884c\nollama run qwen2.5:7b\n# \u67e5\u770b\u5df2\u88c5\u6a21\u578b\nollama list\n<\/code><\/pre>\n<p>\u60f3\u6301\u4e45\u670d\u52a1\uff0c\u8bbe\u5f00\u673a\u81ea\u542f\uff1a<code>systemctl enable --now ollama<\/code>\u3002<\/p>\n<h2>\u56db\u3001\u751f\u4ea7\u7ea7\u670d\u52a1\uff1avLLM<\/h2>\n<p>\u9ad8\u5e76\u53d1\u573a\u666f\u7528 vLLM\uff0c\u541e\u5410\u6bd4\u539f\u751f\u9ad8\u6570\u500d\uff1a<\/p>\n<pre><code>pip install vllm\npython -m vllm.entrypoints.openai.api_server \\\n  --model Qwen\/Qwen2.5-7B-Instruct \\\n  --tensor-parallel-size 1 \\\n  --port 8000\n<\/code><\/pre>\n<p>\u5b83\u517c\u5bb9 OpenAI API \u683c\u5f0f\uff0c\u73b0\u6709\u4ee3\u7801\u51e0\u4e4e\u4e0d\u7528\u6539\u3002<\/p>\n<h2>\u4e94\u3001\u63a5\u5165\u4f60\u81ea\u5df1\u7684\u5e94\u7528<\/h2>\n<pre><code>import openai\nclient = openai.OpenAI(base_url=\"http:\/\/localhost:8000\/v1\", api_key=\"none\")\nresp = client.chat.completions.create(\n    model=\"Qwen2.5-7B-Instruct\",\n    messages=[{\"role\":\"user\",\"content\":\"\u7528\u4e00\u53e5\u8bdd\u89e3\u91ca\u53cd\u5411\u4ee3\u7406\"}]\n)\nprint(resp.choices[0].message.content)\n<\/code><\/pre>\n<h2>\u516d\u3001\u5e38\u89c1\u5751<\/h2>\n<ul>\n<li><strong>\u4e2d\u6587\u4e71\u7801\/\u622a\u65ad<\/strong>\uff1a\u786e\u8ba4 tokenizer \u548c\u6a21\u578b\u5339\u914d\uff0c\u7528\u5b98\u65b9 chat \u6a21\u677f\u3002<\/li>\n<li><strong>\u663e\u5b58\u6ea2\u51fa<\/strong>\uff1a\u964d\u91cf\u5316\u7b49\u7ea7\u6216\u51cf max_model_len\u3002<\/li>\n<li><strong>\u5e76\u53d1\u4e0a\u4e0d\u53bb<\/strong>\uff1avLLM \u5f00 <code>--gpu-memory-utilization<\/code> \u5230 0.9\u3002<\/li>\n<\/ul>\n<h2>\u7ed3\u8bed<\/h2>\n<p>\u672c\u5730\u90e8\u7f72\u95e8\u69db\u6bd4\u60f3\u8c61\u4e2d\u4f4e\u3002\u5148\u62ff 7B \u6a21\u578b\u7ec3\u624b\uff0c\u8dd1\u901a\u540e\u518d\u6309\u9700\u5347\u7ea7\u786c\u4ef6\u548c\u6a21\u578b\u89c4\u6a21\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u624b\u628a\u624b\u672c\u5730\u8dd1\u5927\u6a21\u578b\uff1a\u663e\u5b58\u600e\u4e48\u9009\u3001Ollama \u4e94\u5206\u949f\u8d77\u6a21\u578b\u3001vLLM \u9ad8\u541e\u5410\u90e8\u7f72\u3001\u5e94\u7528\u5982\u4f55\u63a5\u5165 OpenAI \u683c\u5f0f\u3002<\/p>\n","protected":false},"author":2,"featured_media":111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-62","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-app"],"_links":{"self":[{"href":"https:\/\/fsdata.site\/index.php?rest_route=\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fsdata.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fsdata.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fsdata.site\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/fsdata.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":1,"href":"https:\/\/fsdata.site\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/fsdata.site\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions\/112"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fsdata.site\/index.php?rest_route=\/wp\/v2\/media\/111"}],"wp:attachment":[{"href":"https:\/\/fsdata.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fsdata.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fsdata.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}