{"id":33425,"date":"2025-07-25T05:02:36","date_gmt":"2025-07-24T21:02:36","guid":{"rendered":"https:\/\/www.kdjingpai.com\/?p=33425"},"modified":"2025-07-25T05:02:36","modified_gmt":"2025-07-24T21:02:36","slug":"dotsllm1","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/pt\/dotsllm1\/","title":{"rendered":"dots.llm1\uff1a\u5c0f\u7ea2\u4e66\u5f00\u6e90\u7684\u9996\u4e2aMoE\u5927\u8bed\u8a00\u6a21\u578b"},"content":{"rendered":"<p><code>rednote-hilab\/dots.llm1.base<\/code>\u662f\u5c0f\u7ea2\u4e66\u5f00\u6e90\u7684\u9996\u4e2a\u5927\u8bed\u8a00\u6a21\u578bdots.llm1\uff0c\u6258\u7ba1\u4e8eHugging Face\u5e73\u53f0\u3002\u6a21\u578b\u91c7\u7528\u6df7\u5408\u4e13\u5bb6\uff08MoE\uff09\u67b6\u6784\uff0c\u62e5\u67091420\u4ebf\u53c2\u6570\uff0c\u63a8\u7406\u65f6\u4ec5\u6fc0\u6d3b140\u4ebf\u53c2\u6570\uff0c\u517c\u987e\u9ad8\u6027\u80fd\u4e0e\u4f4e\u6210\u672c\u3002dots.llm1\u4f7f\u752811.2\u4e07\u4ebf\u975e\u5408\u6210\u9ad8\u8d28\u91cf\u8bed\u6599\u8bad\u7ec3\uff0c\u5728\u4e2d\u6587\u6d4b\u8bd5\u4e2d\u5e73\u5747\u5f97\u520691.3\uff0c\u8d85\u8d8aDeepSeek V2\u3001V3\u53ca\u963f\u91ccQwen2.5\u7cfb\u5217\u3002\u652f\u630132,768\u4ee4\u724c\u8d85\u957f\u4e0a\u4e0b\u6587\uff0c\u9002\u5408\u6587\u672c\u751f\u6210\u3001\u5bf9\u8bdd\u7b49\u4efb\u52a1\u3002\u9875\u9762\u63d0\u4f9b\u6a21\u578b\u6743\u91cd\u3001\u914d\u7f6e\u6587\u4ef6\u53ca\u4f7f\u7528\u793a\u4f8b\uff0c\u65b9\u4fbf\u5f00\u53d1\u8005\u96c6\u6210\u4e0e\u7814\u7a76\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33426\" title=\"-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/07\/26a0c8350a091bf.jpg\" alt=\"-1\" width=\"1616\" height=\"886\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/07\/26a0c8350a091bf.jpg 1616w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/07\/26a0c8350a091bf-1536x842.jpg 1536w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/07\/26a0c8350a091bf-18x10.jpg 18w\" sizes=\"auto, (max-width: 1616px) 100vw, 1616px\" \/><\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li>\u751f\u6210\u9ad8\u8d28\u91cf\u6587\u672c\uff0c\u9002\u7528\u4e8e\u5bf9\u8bdd\u3001\u6587\u7ae0\u7eed\u5199\u548c\u4ee3\u7801\u751f\u6210\u3002<\/li>\n<li>\u4f7f\u7528MoE\u67b6\u6784\uff0c\u63a8\u7406\u4ec5\u6fc0\u6d3b140\u4ebf\u53c2\u6570\uff0c\u964d\u4f4e\u8ba1\u7b97\u6210\u672c\u3002<\/li>\n<li>\u652f\u630132,768\u4ee4\u724c\u8d85\u957f\u4e0a\u4e0b\u6587\uff0c\u9002\u5408\u5904\u7406\u957f\u6587\u6863\u6216\u590d\u6742\u4efb\u52a1\u3002<\/li>\n<li>\u63d0\u4f9b\u6bcf1\u4e07\u4ebftoken\u7684\u8bad\u7ec3\u68c0\u67e5\u70b9\uff0c\u52a9\u529b\u7814\u7a76\u6a21\u578b\u8bad\u7ec3\u52a8\u6001\u3002<\/li>\n<li>\u652f\u6301Docker\u548cvLLM\u90e8\u7f72\uff0c\u4f18\u5316\u9ad8\u541e\u5410\u91cf\u63a8\u7406\u573a\u666f\u3002<\/li>\n<li>\u96c6\u6210Hugging Face Transformers\uff0c\u63d0\u4f9bPython\u4ee3\u7801\u793a\u4f8b\u3002<\/li>\n<li>\u4f18\u5316\u4e2d\u6587\u5904\u7406\u80fd\u529b\uff0c\u6d4b\u8bd5\u5f97\u5206\u8d85\u8d8a\u591a\u4e2a\u4e3b\u6d41\u5f00\u6e90\u6a21\u578b\u3002<\/li>\n<\/ul>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5\u4e0e\u90e8\u7f72<\/h3>\n<p>\u8981\u4f7f\u7528dots.llm1.base\uff0c\u9700\u51c6\u5907\u652f\u6301GPU\u7684\u8ba1\u7b97\u73af\u5883\uff08\u63a8\u8350\u81f3\u5c118GB\u663e\u5b58\uff09\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u90e8\u7f72\u6b65\u9aa4\uff1a<\/p>\n<h4>1. \u901a\u8fc7Docker\u90e8\u7f72<\/h4>\n<p>Docker\u662f\u5b98\u65b9\u63a8\u8350\u7684\u90e8\u7f72\u65b9\u5f0f\uff0c\u652f\u6301GPU\u52a0\u901f\u548c\u9ad8\u541e\u5410\u91cf\u63a8\u7406\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u786e\u4fdd\u5b89\u88c5Docker\u548cNVIDIA Container Toolkit\u3002<\/li>\n<li>\u62c9\u53d6\u5e76\u8fd0\u884cDocker\u955c\u50cf\uff1a<\/li>\n<\/ol>\n<pre><code>docker run --gpus all \\\r\n-v ~\/.cache\/huggingface:\/root\/.cache\/huggingface \\\r\n-p 8000:8000 \\\r\n--ipc=host \\\r\nrednotehilab\/dots1:vllm-openai-v0.9.0.1 \\\r\n--model rednote-hilab\/dots.llm1.base \\\r\n--tensor-parallel-size 8 \\\r\n--trust-remote-code \\\r\n--served-model-name dots1\r\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u6d4b\u8bd5\u670d\u52a1\u662f\u5426\u6b63\u5e38\uff1a<\/li>\n<\/ol>\n<pre><code>curl http:\/\/localhost:8000\/v1\/chat\/completions \\\r\n-H \"Content-Type: application\/json\" \\\r\n-d '{\r\n\"model\": \"dots1\",\r\n\"messages\": [\r\n{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\r\n{\"role\": \"user\", \"content\": \"What is MoE in AI?\"}\r\n],\r\n\"max_tokens\": 32,\r\n\"temperature\": 0\r\n}'\r\n<\/code><\/pre>\n<p>\u6210\u529f\u8fd4\u56de\u8868\u660e\u670d\u52a1\u8fd0\u884c\u6b63\u5e38\u3002<\/p>\n<h4>2. \u4f7f\u7528Hugging Face Transformers<\/h4>\n<p>\u82e5\u4e0d\u4f7f\u7528Docker\uff0c\u53ef\u901a\u8fc7Python\u52a0\u8f7d\u6a21\u578b\uff1a<\/p>\n<ol>\n<li>\u5b89\u88c5\u4f9d\u8d56\uff1a<\/li>\n<\/ol>\n<pre><code>pip install transformers torch\r\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u52a0\u8f7d\u6a21\u578b\u548c\u5206\u8bcd\u5668\uff1a<\/li>\n<\/ol>\n<pre><code>import torch\r\nfrom transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig\r\nmodel_name = \"rednote-hilab\/dots.llm1.base\"\r\ntokenizer = AutoTokenizer.from_pretrained(model_name)\r\nmodel = AutoModelForCausalLM.from_pretrained(model_name, device_map=\"auto\", torch_dtype=torch.bfloat16)\r\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u8fdb\u884c\u6587\u672c\u751f\u6210\uff1a<\/li>\n<\/ol>\n<pre><code>text = \"\u4eba\u5de5\u667a\u80fd\u4e2d\u7684MoE\u67b6\u6784\u662f\u4ec0\u4e48\uff1f\"\r\ninputs = tokenizer(text, return_tensors=\"pt\")\r\noutputs = model.generate(**inputs.to(model.device), max_new_tokens=100)\r\nresult = tokenizer.decode(outputs[0], skip_special_tokens=True)\r\nprint(result)\r\n<\/code><\/pre>\n<h4>3. \u4f7f\u7528vLLM\u8fdb\u884c\u9ad8\u541e\u5410\u91cf\u63a8\u7406<\/h4>\n<p>vLLM\u9002\u5408\u5927\u89c4\u6a21\u63a8\u7406\u573a\u666f\u3002\u5b89\u88c5vLLM\u540e\u8fd0\u884c\uff1a<\/p>\n<pre><code><a href=\"https:\/\/www.kdjingpai.com\/en\/vllm\/\">vllm<\/a> serve rednote-hilab\/dots.llm1.base --port 8000 --tensor-parallel-size 8\r\n<\/code><\/pre>\n<h3>\u4e3b\u8981\u529f\u80fd\u64cd\u4f5c<\/h3>\n<h4>\u6587\u672c\u751f\u6210<\/h4>\n<p>dots.llm1.base\u64c5\u957f\u751f\u6210\u8fde\u8d2f\u6587\u672c\uff0c\u9002\u5408\u5b66\u672f\u5199\u4f5c\u3001\u6587\u7ae0\u7eed\u5199\u7b49\u3002\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u51c6\u5907\u8f93\u5165\u6587\u672c\uff0c\u5982\u6280\u672f\u6587\u6863\u6216\u95ee\u9898\u63cf\u8ff0\u3002<\/li>\n<li>\u4f7f\u7528Python\u4ee3\u7801\u6216Docker\u670d\u52a1\uff0c\u8bbe\u7f6e<code>max_new_tokens<\/code>\u63a7\u5236\u8f93\u51fa\u957f\u5ea6\u3002<\/li>\n<li>\u68c0\u67e5\u8f93\u51fa\u5185\u5bb9\uff0c\u786e\u4fdd\u903b\u8f91\u8fde\u8d2f\u3002<\/li>\n<\/ol>\n<h4>\u5bf9\u8bdd\u4efb\u52a1<\/h4>\n<p>\u901a\u8fc7\u63d0\u793a\u5de5\u7a0b\uff0c\u6a21\u578b\u53ef\u5b9e\u73b0\u5bf9\u8bdd\u529f\u80fd\u3002\u793a\u4f8b\uff1a<\/p>\n<pre><code>messages = [{\"role\": \"user\", \"content\": \"\u8bb2\u89e3MoE\u67b6\u6784\u7684\u6838\u5fc3\u539f\u7406\u3002\"}]\r\ninput_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors=\"pt\")\r\noutputs = model.generate(input_tensor.to(model.device), max_new_tokens=200)\r\nresult = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)\r\nprint(result)\r\n<\/code><\/pre>\n<h4>\u7814\u7a76\u8bad\u7ec3\u52a8\u6001<\/h4>\n<p>\u6a21\u578b\u63d0\u4f9b\u6bcf1\u4e07\u4ebftoken\u7684\u4e2d\u95f4\u68c0\u67e5\u70b9\uff0c\u7814\u7a76\u4eba\u5458\u53ef\u4eceHugging Face\u7684<code>dots1<\/code>\u96c6\u5408\u4e0b\u8f7d\uff0c\u5206\u6790MoE\u6a21\u578b\u8bad\u7ec3\u8fc7\u7a0b\u3002<\/p>\n<h4>\u6a21\u578b\u67b6\u6784\u7279\u70b9<\/h4>\n<p>dots.llm1\u91c7\u7528\u5355\u5411\u89e3\u7801\u5668Transformer\u67b6\u6784\uff0c\u66ff\u6362\u524d\u9988\u7f51\u7edc\u4e3aMoE\uff0c\u5305\u542b128\u4e2a\u8def\u7531\u4e13\u5bb6\u548c2\u4e2a\u5171\u4eab\u4e13\u5bb6\u3002\u6bcf\u8f93\u5165\u6807\u8bb0\u52a8\u6001\u9009\u62e96\u4e2a\u8def\u7531\u4e13\u5bb6\u548c2\u4e2a\u5171\u4eab\u4e13\u5bb6\uff0c\u603b\u8ba1\u6fc0\u6d3b8\u4e2a\u4e13\u5bb6\u7f51\u7edc\u3002\u6a21\u578b\u4f7f\u7528SwiGLU\u6fc0\u6d3b\u51fd\u6570\uff0c\u4f18\u5316\u6570\u636e\u5173\u7cfb\u6355\u6349\u3002\u6ce8\u610f\u529b\u5c42\u91c7\u7528\u591a\u5934\u6ce8\u610f\u529b\u673a\u5236\uff08MHA\uff09\u7ed3\u5408RMSNorm\u5f52\u4e00\u5316\uff0c\u63d0\u5347\u6570\u503c\u7a33\u5b9a\u6027\u3002\u8d1f\u8f7d\u5e73\u8861\u7b56\u7565\u901a\u8fc7\u52a8\u6001\u504f\u7f6e\u9879\u4f18\u5316\u4e13\u5bb6\u7f51\u7edc\u4f7f\u7528\u7387\u3002<\/p>\n<h3>\u6ce8\u610f\u4e8b\u9879<\/h3>\n<ul>\n<li>\u63a8\u8350\u4f7f\u7528GPU\uff0c\u663e\u5b58\u81f3\u5c118GB\u3002<\/li>\n<li>\u6a21\u578b\u6743\u91cd\u7ea64GB\uff0c\u9700\u7a33\u5b9a\u7f51\u7edc\u4e0b\u8f7d\u3002<\/li>\n<li>\u4f7f\u7528<code>torch.bfloat16<\/code>\u4f18\u5316\u6027\u80fd\uff0c\u68c0\u67e5\u786c\u4ef6\u517c\u5bb9\u6027\u3002<\/li>\n<li>\u4e2d\u6587\u4efb\u52a1\u8868\u73b0\u4f18\u5f02\uff0c\u4f46\u9700\u8c03\u6574\u63d0\u793a\u4ee5\u4f18\u5316\u5bf9\u8bdd\u6548\u679c\u3002<\/li>\n<\/ul>\n<h2>\u5e94\u7528\u573a\u666f<\/h2>\n<ol>\n<li><strong>\u5b66\u672f\u7814\u7a76<\/strong><br \/>\n\u7814\u7a76\u4eba\u5458\u53ef\u5206\u6790\u4e2d\u95f4\u68c0\u67e5\u70b9\uff0c\u63a2\u7d22MoE\u67b6\u6784\u7684\u8bad\u7ec3\u52a8\u6001\u548c\u53c2\u6570\u6548\u7387\u3002<\/li>\n<li><strong>\u5185\u5bb9\u521b\u4f5c<\/strong><br \/>\n\u96c6\u6210\u6a21\u578b\u5230\u5199\u4f5c\u5de5\u5177\uff0c\u751f\u6210\u6587\u7ae0\u3001\u62a5\u544a\u6216\u6280\u672f\u6587\u6863\u8349\u7a3f\u3002<\/li>\n<li><strong>\u5bf9\u8bdd\u7cfb\u7edf<\/strong><br \/>\n\u5f00\u53d1\u5ba2\u670d\u673a\u5668\u4eba\u6216\u6559\u80b2\u52a9\u624b\uff0c\u652f\u6301\u957f\u4e0a\u4e0b\u6587\u5bf9\u8bdd\u3002<\/li>\n<li><strong>\u4ee3\u7801\u8f85\u52a9<\/strong><br \/>\n\u751f\u6210\u4ee3\u7801\u7247\u6bb5\uff0c\u8f85\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u7f16\u5199\u7b97\u6cd5\u6216\u811a\u672c\u3002<\/li>\n<\/ol>\n<h2>QA<\/h2>\n<ol>\n<li><strong>dots.llm1.base\u4e0einst\u7248\u672c\u7684\u533a\u522b\uff1f<\/strong><br \/>\nbase\u7248\u9002\u5408\u6587\u672c\u8865\u5168\uff0cinst\u7248\u7ecf\u6307\u4ee4\u5fae\u8c03\uff0c\u4f18\u5316\u5bf9\u8bdd\u80fd\u529b\u3002<\/li>\n<li><strong>\u5982\u4f55\u964d\u4f4e\u63a8\u7406\u6210\u672c\uff1f<\/strong><br \/>\nMoE\u67b6\u6784\u4ec5\u6fc0\u6d3b140\u4ebf\u53c2\u6570\uff0c\u7ed3\u5408vLLM\u548cDocker\u4f18\u5316\u8d44\u6e90\u4f7f\u7528\u3002<\/li>\n<li><strong>\u652f\u6301\u54ea\u4e9b\u8bed\u8a00\uff1f<\/strong><br \/>\n\u4e3b\u8981\u652f\u6301\u4e2d\u6587\u548c\u82f1\u6587\uff0c\u4e0a\u4e0b\u6587\u957f\u5ea6\u8fbe32,768\u4ee4\u724c\u3002<\/li>\n<li><strong>\u8bad\u7ec3\u6570\u636e\u5982\u4f55\u4fdd\u8bc1\u9ad8\u8d28\u91cf\uff1f<\/strong><br \/>\n\u4f7f\u752811.2\u4e07\u4ebf\u975e\u5408\u6210\u8bed\u6599\uff0c\u901a\u8fc7\u4e09\u7ea7\u5904\u7406\u6d41\u6c34\u7ebf\u7b5b\u9009\u9ad8\u8d28\u91cf\u5185\u5bb9\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>rednote-hilab\/dots.llm1.base\u662f\u5c0f\u7ea2\u4e66\u5f00\u6e90\u7684\u9996\u4e2a\u5927\u8bed\u8a00\u6a21\u578bdots.llm1\uff0c\u6258\u7ba1\u4e8eHugging Face\u5e73\u53f0\u3002\u6a21\u578b\u91c7\u7528\u6df7\u5408\u4e13\u5bb6\uff08MoE\uff09\u67b6\u6784\uff0c\u62e5\u67091420\u4ebf\u53c2\u6570\uff0c\u63a8\u7406\u65f6\u4ec5\u6fc0\u6d3b140\u4ebf\u53c2\u6570\uff0c\u517c\u987e\u9ad8\u6027\u80fd\u4e0e\u4f4e\u6210\u672c\u3002d&#8230;<\/p>\n","protected":false},"author":1,"featured_media":31260,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,392,397],"tags":[230],"class_list":["post-33425","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","category-models","category-text-model","tag-aikaiyuanxiangmu"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/33425","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=33425"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/33425\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media\/31260"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media?parent=33425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/categories?post=33425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/tags?post=33425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}