{"id":213,"date":"2024-07-25T21:33:25","date_gmt":"2024-07-25T13:33:25","guid":{"rendered":"https:\/\/www.onetts.com\/ai\/?p=213"},"modified":"2024-07-25T22:44:00","modified_gmt":"2024-07-25T14:44:00","slug":"qwen1-5-32b-chat","status":"publish","type":"post","link":"https:\/\/www.onetts.com\/ai\/models\/qwen1-5-32b-chat\/","title":{"rendered":"Qwen1.5-32B-Chat"},"content":{"rendered":"<p data-spm-anchor-id=\"a2c6h.13066512.0.i3.5bcd36afnY9M76\">Qwen1.5-32B-Chat \u662f Qwen2 \u7684\u6d4b\u8bd5\u7248\u672c\uff0c\u662f\u4e00\u4e2a\u57fa\u4e8e Transformer \u67b6\u6784\u7684\u89e3\u7801\u5668\u8bed\u8a00\u6a21\u578b\uff0c\u4e13\u4e3a\u5bf9\u8bdd\u751f\u6210\u800c\u4f18\u5316\u3002\u5b83\u5728\u591a\u8bed\u8a00\u652f\u6301\u3001\u4e0a\u4e0b\u6587\u957f\u5ea6\u7a33\u5b9a\u6027\u548c\u4eba\u7c7b\u504f\u597d\u65b9\u9762\u8fdb\u884c\u4e86\u663e\u8457\u6539\u8fdb\u3002\u8be5\u6a21\u578b\u63d0\u4f9b\u4e868\u79cd\u4e0d\u540c\u5c3a\u5bf8\u7684\u7248\u672c\uff0c\u5305\u62ec\u4e00\u4e2a32B\u7684\u5bc6\u96c6\u6a21\u578b\uff0c\u652f\u6301\u9ad8\u8fbe32K\u7684\u4e0a\u4e0b\u6587\u957f\u5ea6\uff0c\u65e0\u9700\u8fdc\u7a0b\u4ee3\u7801\u4fe1\u4efb\u3002<\/p>\n<h2 id=\"-\">\u6a21\u578b\u8bc4\u6d4b<\/h2>\n<p>Qwen1.5-32B-Chat \u5728\u591a\u4e2a\u8bed\u8a00\u6a21\u578b\u8bc4\u6d4b\u6307\u6807\u4e0a\u8868\u73b0\u51fa\u8272\uff0c\u7279\u522b\u662f\u5728\u5bf9\u8bdd\u751f\u6210\u548c\u591a\u8bed\u8a00\u7406\u89e3\u65b9\u9762\u3002\u5b83\u901a\u8fc7\u76d1\u7763\u5fae\u8c03\u548c\u76f4\u63a5\u504f\u597d\u4f18\u5316\u8fdb\u884c\u4e86\u540e\u8bad\u7ec3\uff0c\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002\u5c3d\u7ba1\u5177\u4f53\u7684\u8bc4\u6d4b\u6570\u636e\u672a\u5728\u6587\u6863\u4e2d\u63d0\u4f9b\uff0c\u4f46\u6a21\u578b\u7684\u6539\u8fdb\u70b9\u548c\u7279\u6027\u8868\u660e\u5b83\u5728\u8bed\u8a00\u751f\u6210\u4efb\u52a1\u4e0a\u5177\u6709\u8f83\u9ad8\u7684\u6f5c\u529b\u3002<\/p>\n<h2 id=\"-\">\u90e8\u7f72\u4f7f\u7528<\/h2>\n<h3 id=\"-\">\u90e8\u7f72\u6b65\u9aa4<\/h3>\n<ol>\n<li><strong>\u5b89\u88c5\u4f9d\u8d56<\/strong>\uff1a\u786e\u4fdd\u5b89\u88c5\u4e86 Python \u73af\u5883\uff0c\u5e76\u5b89\u88c5\u00a0<code>transformers&gt;=4.37.0<\/code>\u3002<\/li>\n<li><strong>\u52a0\u8f7d\u6a21\u578b\u548c\u5206\u8bcd\u5668<\/strong>\uff1a\n<pre><code class=\"lang-python\"><span class=\"token keyword\">from<\/span> modelscope <span class=\"token keyword\">import<\/span> AutoModelForCausalLM<span class=\"token punctuation\">,<\/span> AutoTokenizer\r\nmodel <span class=\"token operator\">=<\/span> AutoModelForCausalLM<span class=\"token punctuation\">.<\/span>from_pretrained<span class=\"token punctuation\">(<\/span><span class=\"token string\">\"qwen\/Qwen1.5-32B-Chat\"<\/span><span class=\"token punctuation\">)<\/span>\r\ntokenizer <span class=\"token operator\">=<\/span> AutoTokenizer<span class=\"token punctuation\">.<\/span>from_pretrained<span class=\"token punctuation\">(<\/span><span class=\"token string\">\"qwen\/Qwen1.5-32B-Chat\"<\/span><span class=\"token punctuation\">)<\/span>\r\n<\/code><\/pre>\n<\/li>\n<li><strong>\u51c6\u5907\u8f93\u5165<\/strong>\uff1a\u5b9a\u4e49\u63d0\u793a\u548c\u7cfb\u7edf\u6d88\u606f\uff0c\u4f7f\u7528\u5206\u8bcd\u5668\u7684\u00a0<code>apply_chat_template<\/code>\u00a0\u65b9\u6cd5\u3002<\/li>\n<li><strong>\u751f\u6210\u6587\u672c<\/strong>\uff1a\u4f7f\u7528\u6a21\u578b\u7684\u00a0<code>generate<\/code>\u00a0\u65b9\u6cd5\u751f\u6210\u6587\u672c\u3002<\/li>\n<li><strong>\u89e3\u7801\u8f93\u51fa<\/strong>\uff1a\u4f7f\u7528\u5206\u8bcd\u5668\u7684\u00a0<code>batch_decode<\/code>\u00a0\u65b9\u6cd5\u89e3\u7801\u751f\u6210\u7684 ID\u3002<\/li>\n<\/ol>\n<h3 id=\"-\">\u793a\u4f8b\u4ee3\u7801<\/h3>\n<pre><code class=\"lang-python\"><span class=\"token comment\" spellcheck=\"true\"># \u7701\u7565\u4e86\u90e8\u5206\u4ee3\u7801\uff0c\u5177\u4f53\u8bf7\u53c2\u8003\u4e0a\u6587\u63d0\u4f9b\u7684\u5feb\u901f\u5f00\u59cb\u90e8\u5206\u3002<\/span>\r\n<\/code><\/pre>\n<h2 id=\"-\">\u5e38\u89c1\u95ee\u9898<\/h2>\n<h3 id=\"q-keyerror-qwen2-\">Q: \u5982\u4f55\u89e3\u51b3\u00a0<code>KeyError: 'qwen2'<\/code>\u00a0\u9519\u8bef\uff1f<\/h3>\n<p>A: \u786e\u4fdd\u5b89\u88c5\u4e86\u6b63\u786e\u7248\u672c\u7684\u00a0<code>transformers<\/code>\u00a0\u5e93\uff0c\u4f7f\u7528\u00a0<code>pip install transformers&gt;=4.37.0<\/code>\u00a0\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<h3 id=\"q-\">Q: \u5982\u4f55\u8c03\u6574\u751f\u6210\u6587\u672c\u7684\u957f\u5ea6\uff1f<\/h3>\n<p>A: \u901a\u8fc7\u8bbe\u7f6e\u00a0<code>generate<\/code>\u00a0\u65b9\u6cd5\u7684\u00a0<code>max_new_tokens<\/code>\u00a0\u53c2\u6570\u6765\u8c03\u6574\u3002<\/p>\n<h3 id=\"q-\">Q: \u5982\u4f55\u5904\u7406\u591a\u8bed\u8a00\u8f93\u5165\uff1f<\/h3>\n<p>A: Qwen1.5-32B-Chat \u652f\u6301\u591a\u8bed\u8a00\uff0c\u53ea\u9700\u786e\u4fdd\u8f93\u5165\u6587\u672c\u662f\u6a21\u578b\u652f\u6301\u7684\u8bed\u8a00\u4e4b\u4e00\u3002<\/p>\n<h2 id=\"-\">\u76f8\u5173\u8d44\u6e90<\/h2>\n<ul>\n<li><strong>ModelScope \u6a21\u578b\u5e93\u94fe\u63a5<\/strong>\uff1a<a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\/\/www.modelscope.cn\/models\/qwen\/Qwen1.5-32B-Chat\">Qwen1.5-32B-Chat<\/a><\/li>\n<li><strong>Hugging Face Transformers \u5e93<\/strong>\uff1a<a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\/\/github.com\/huggingface\/transformers\">Hugging Face Transformers<\/a><\/li>\n<li><strong>Qwen \u6280\u672f\u62a5\u544a<\/strong>\uff1aarXiv \u4e0a\u7684\u00a0<a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\/\/arxiv.org\/abs\/2309.16609\">Qwen Technical Report<\/a><\/li>\n<\/ul>\n<h3 id=\"-\">\u7ed3\u8bed<\/h3>\n<p>Qwen1.5-32B-Chat \u4f5c\u4e3a\u65b0\u4e00\u4ee3\u7684\u8bed\u8a00\u6a21\u578b\uff0c\u5176\u591a\u8bed\u8a00\u80fd\u529b\u548c\u5bf9\u8bdd\u751f\u6210\u6027\u80fd\u4f7f\u5176\u5728\u591a\u79cd\u5e94\u7528\u573a\u666f\u4e0b\u5177\u6709\u5e7f\u6cdb\u7684\u5e94\u7528\u6f5c\u529b\u3002\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\u548c\u8d44\u6e90\uff0c\u7528\u6237\u53ef\u4ee5\u65b9\u4fbf\u5730\u90e8\u7f72\u548c\u4f7f\u7528\u8be5\u6a21\u578b\uff0c\u4ee5\u5b9e\u73b0\u9ad8\u8d28\u91cf\u7684\u8bed\u8a00\u751f\u6210\u4efb\u52a1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Qwen1.5-32B-Chat \u662f Qwen2 \u7684\u6d4b\u8bd5\u7248\u672c\uff0c\u662f\u4e00\u4e2a\u57fa\u4e8e Transformer \u67b6\u6784\u7684\u89e3\u7801\u5668\u8bed\u8a00\u6a21\u578b\uff0c\u4e13\u4e3a\u5bf9\u8bdd\u751f\u6210\u800c\u4f18\u5316\u3002\u5b83\u5728\u591a\u8bed\u8a00\u652f\u6301\u3001\u4e0a\u4e0b\u6587\u957f\u5ea6\u7a33\u5b9a\u6027\u548c\u4eba\u7c7b\u504f\u597d\u65b9\u9762\u8fdb\u884c\u4e86\u663e\u8457\u6539\u8fdb\u3002\u8be5\u6a21\u578b\u63d0\u4f9b\u4e868\u79cd\u4e0d\u540c\u5c3a\u5bf8\u7684\u7248\u672c\uff0c\u5305\u62ec\u4e00\u4e2a32B\u7684\u5bc6\u96c6\u6a21\u578b\uff0c\u652f\u6301\u9ad8\u8fbe32K\u7684\u4e0a\u4e0b\u6587\u957f\u5ea6\uff0c\u65e0\u9700\u8fdc\u7a0b\u4ee3\u7801\u4fe1\u4efb\u3002 \u6a21\u578b\u8bc4\u6d4b Qwen1.5-32B-Chat \u5728\u591a\u4e2a\u8bed\u8a00\u6a21\u578b\u8bc4\u6d4b\u6307\u6807\u4e0a\u8868\u73b0\u51fa\u8272\uff0c\u7279\u522b\u662f\u5728\u5bf9\u8bdd\u751f\u6210\u548c\u591a\u8bed\u8a00\u7406\u89e3\u65b9\u9762\u3002\u5b83\u901a\u8fc7\u76d1\u7763\u5fae\u8c03\u548c\u76f4\u63a5\u504f\u597d\u4f18\u5316\u8fdb\u884c\u4e86\u540e\u8bad\u7ec3\uff0c\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002\u5c3d\u7ba1\u5177\u4f53\u7684\u8bc4\u6d4b\u6570\u636e\u672a\u5728\u6587\u6863\u4e2d\u63d0\u4f9b\uff0c\u4f46\u6a21\u578b\u7684\u6539\u8fdb<\/p>\n","protected":false},"author":1,"featured_media":214,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"collection":[42],"company":[6],"rank":[53],"class_list":["post-213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-llm","collection-qwen1-5","company-alibaba","rank-china-llm-ranking"],"_links":{"self":[{"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":1,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"predecessor-version":[{"id":215,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/posts\/213\/revisions\/215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/media\/214"}],"wp:attachment":[{"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/tags?post=213"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/collection?post=213"},{"taxonomy":"company","embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/company?post=213"},{"taxonomy":"rank","embeddable":true,"href":"https:\/\/www.onetts.com\/ai\/wp-json\/wp\/v2\/rank?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}