"use strict";(self.webpackChunkelementary_public_docs=self.webpackChunkelementary_public_docs||[]).push([[86359],{15680:(e,n,t)=>{t.d(n,{xA:()=>c,yg:()=>_});var r=t(96540);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(t),u=o,_=d["".concat(p,".").concat(u)]||d[u]||m[u]||a;return t?r.createElement(_,i(i({ref:n},c),{},{components:t})):r.createElement(_,i({ref:n},c))}));function _(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var r=t(58168),o=(t(96540),t(15680));const a={sidebar_position:2,product:"\u9ad8\u6027\u80fdAI\u7b97\u529b\u6c60(ACP)"},i="MindSpore InternLM2-20B 32\u5361 \u5fae\u8c03\u6700\u4f73\u5b9e\u8df5",l={unversionedId:"cloud-foundation/compute/acp/acpBestPractices/Job-Mindspore-InternLM",id:"cloud-foundation/compute/acp/acpBestPractices/Job-Mindspore-InternLM",title:"MindSpore InternLM2-20B 32\u5361 \u5fae\u8c03\u6700\u4f73\u5b9e\u8df5",description:"\u6846\u67b6\u4ecb\u7ecd",source:"@site/docs/cloud-foundation/compute/acp/acpBestPractices/Job-Mindspore-InternLM.md",sourceDirName:"cloud-foundation/compute/acp/acpBestPractices",slug:"/cloud-foundation/compute/acp/acpBestPractices/Job-Mindspore-InternLM",permalink:"/help/docs/cloud-foundation/compute/acp/acpBestPractices/Job-Mindspore-InternLM",draft:!1,editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/docs/cloud-foundation/compute/acp/acpBestPractices/Job-Mindspore-InternLM.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,product:"\u9ad8\u6027\u80fdAI\u7b97\u529b\u6c60(ACP)"},sidebar:"tutorialSidebar",previous:{title:"\u6700\u4f73\u5b9e\u8df5",permalink:"/help/docs/cloud-foundation/compute/acp/acpBestPractices/"},next:{title:"\u63d0\u4ea4\u4e00\u4e2aPytorch DDP\u5206\u5e03\u5f0f\u4efb\u52a1",permalink:"/help/docs/cloud-foundation/compute/acp/acpBestPractices/Job-PyTorchDDP"}},p={},s=[{value:"\u6846\u67b6\u4ecb\u7ecd",id:"\u6846\u67b6\u4ecb\u7ecd",level:2},{value:"\u6a21\u578b\u4ecb\u7ecd",id:"\u6a21\u578b\u4ecb\u7ecd",level:2},{value:"\u4f7f\u7528\u524d\u63d0",id:"\u4f7f\u7528\u524d\u63d0",level:2},{value:"MindSpore\u955c\u50cf\u4f7f\u7528",id:"mindspore\u955c\u50cf\u4f7f\u7528",level:2},{value:"InternLM2-20B\u6a21\u578b32\u5361\u5fae\u8c03\uff08\u968f\u673a\u521d\u59cb\u5316\u6743\u91cd\uff09",id:"internlm2-20b\u6a21\u578b32\u5361\u5fae\u8c03\u968f\u673a\u521d\u59cb\u5316\u6743\u91cd",level:2},{value:"InternLM2-20B\u6a21\u578b32\u5361\u5fae\u8c03\uff08\u52a0\u8f7d\u6a21\u578b\u6743\u91cd\uff09",id:"internlm2-20b\u6a21\u578b32\u5361\u5fae\u8c03\u52a0\u8f7d\u6a21\u578b\u6743\u91cd",level:2},{value:"\u6743\u91cd\u914d\u7f6e",id:"\u6743\u91cd\u914d\u7f6e",level:3},{value:"\u7b97\u529b\u6c60\u6a21\u578b\u5fae\u8c03\u4efb\u52a1\u914d\u7f6e",id:"\u7b97\u529b\u6c60\u6a21\u578b\u5fae\u8c03\u4efb\u52a1\u914d\u7f6e",level:3},{value:"Tips\uff1a\u6570\u636e\u9884\u5904\u7406",id:"tips\u6570\u636e\u9884\u5904\u7406",level:3}],c={toc:s},d="wrapper";function m(e){let{components:n,...a}=e;return(0,o.yg)(d,(0,r.A)({},c,a,{components:n,mdxType:"MDXLayout"}),(0,o.yg)("h1",{id:"mindspore-internlm2-20b-32\u5361-\u5fae\u8c03\u6700\u4f73\u5b9e\u8df5"},"MindSpore InternLM2-20B 32\u5361 \u5fae\u8c03\u6700\u4f73\u5b9e\u8df5"),(0,o.yg)("h2",{id:"\u6846\u67b6\u4ecb\u7ecd"},"\u6846\u67b6\u4ecb\u7ecd"),(0,o.yg)("p",null,"MindSpore \u662f\u534e\u4e3a\u63a8\u51fa\u7684\u4e00\u4e2a\u5168\u573a\u666f\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\uff0c\u65e8\u5728\u5b9e\u73b0\u6613\u5f00\u53d1\u3001\u9ad8\u6548\u6267\u884c\u548c\u5168\u573a\u666f\u8986\u76d6\u3002\u652f\u6301\u52a8\u6001\u56fe\u548c\u9759\u6001\u56fe\u7edf\u4e00\u7684\u7f16\u7801\u65b9\u5f0f\uff0c\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u5207\u6362\u6a21\u5f0f\uff0c\u65e0\u9700\u7f16\u5199\u591a\u5957\u4ee3\u7801\u3002MindSpore \u7684\u8bbe\u8ba1\u4f7f\u5f97 AI \u7f16\u7a0b\u53d8\u5f97\u7b80\u5355\uff0c\u7528\u6237\u53ef\u4ee5\u4f7f\u7528 Python \u539f\u751f\u63a7\u5236\u903b\u8f91\u6784\u5efa\u590d\u6742\u7684\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u3002\u5b83\u8fd8\u652f\u6301\u81ea\u52a8\u5fae\u5206\uff0c\u7528\u6237\u65e0\u9700\u624b\u52a8\u6c42\u5bfc\uff0c\u4ece\u800c\u51cf\u5c11\u9519\u8bef\u3002\u6b64\u5916\uff0cMindSpore \u7edf\u4e00\u4e86\u5355\u673a\u548c\u5206\u5e03\u5f0f\u8bad\u7ec3\u7684\u7f16\u7801\u65b9\u5f0f\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u6dfb\u52a0\u5c11\u91cf\u4ee3\u7801\u5373\u53ef\u5b9e\u73b0\u5206\u5e03\u5f0f\u8bad\u7ec3\uff0c\u5927\u5927\u964d\u4f4e\u4e86 AI \u5f00\u53d1\u7684\u95e8\u69db\u3002MindSpore \u63d0\u4f9b\u4e86\u4e0d\u540c\u5c42\u6b21\u7684 API\uff0c\u4ece\u4f4e\u9636\u7684\u5f20\u91cf\u5b9a\u4e49\u548c\u57fa\u7840\u7b97\u5b50\u5230\u9ad8\u9636\u7684\u8bad\u7ec3\u63a8\u7406\u7ba1\u7406\uff0c\u6ee1\u8db3\u4e0d\u540c\u7528\u6237\u7684\u9700\u6c42\u3002"),(0,o.yg)("p",null,"\u5b98\u7f51\u94fe\u63a5\uff1a",(0,o.yg)("a",{parentName:"p",href:"https://www.mindspore.cn/tutorial/zh-CN/r1.2/introduction.html"},"https://www.mindspore.cn/tutorial/zh-CN/r1.2/introduction.html")),(0,o.yg)("h2",{id:"\u6a21\u578b\u4ecb\u7ecd"},"\u6a21\u578b\u4ecb\u7ecd"),(0,o.yg)("p",null,"\u7b2c\u4e8c\u4ee3\u6d66\u8bed\u6a21\u578b\uff0c InternLM2 \u5305\u542b 7B \u548c 20B \u4e24\u4e2a\u91cf\u7ea7\u7684\u6a21\u578b\u3002InternLM2 \u7684\u57fa\u7840\u6a21\u578b\u5177\u5907\u4ee5\u4e0b\u7684\u6280\u672f\u7279\u70b9\uff1a"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"\u6709\u6548\u652f\u630120\u4e07\u5b57\u8d85\u957f\u4e0a\u4e0b\u6587\uff1a\u6a21\u578b\u572820\u4e07\u5b57\u957f\u8f93\u5165\u4e2d\u51e0\u4e4e\u5b8c\u7f8e\u5730\u5b9e\u73b0\u957f\u6587\u201c\u5927\u6d77\u635e\u9488\u201d\uff0c\u800c\u4e14\u5728 LongBench \u548c L-Eval \u7b49\u957f\u6587\u4efb\u52a1\u4e2d\u7684\u8868\u73b0\u4e5f\u8fbe\u5230\u5f00\u6e90\u6a21\u578b\u4e2d\u7684\u9886\u5148\u6c34\u5e73\uff1b"),(0,o.yg)("li",{parentName:"ul"},"\u7efc\u5408\u6027\u80fd\u5168\u9762\u63d0\u5347\uff1a\u5404\u80fd\u529b\u7ef4\u5ea6\u76f8\u6bd4\u4e0a\u4e00\u4ee3\u6a21\u578b\u5168\u9762\u8fdb\u6b65\uff0c\u5728\u63a8\u7406\u3001\u6570\u5b66\u3001\u4ee3\u7801\u7b49\u65b9\u9762\u7684\u80fd\u529b\u63d0\u5347\u663e\u8457\u3002")),(0,o.yg)("h2",{id:"\u4f7f\u7528\u524d\u63d0"},"\u4f7f\u7528\u524d\u63d0"),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"\u524d\u7f6e\u52a8\u4f5c1\uff1a\u5728\u5f39\u6027\u8ba1\u7b97\u96c6\u7fa4\uff08AEC2\uff09\u521b\u5efa\u5de5\u4f5c\u7a7a\u95f4 --\x3e \u521b\u5efa\u8282\u70b9 --\x3e \u5c06\u8282\u70b9\u7ed1\u5b9a\u5230\u76ee\u6807\u96c6\u7fa4\u3002\u5982\u60a8\u5df2\u7ecf\u6709\u53ef\u7528\u96c6\u7fa4\u5219\u53ef\u4ee5\u5ffd\u89c6\u672c\u6b65\u9aa4\u3002\u524d\u7f6e\u52a8\u4f5c2\uff1a\u5728\u6587\u4ef6\u5b58\u50a8AFS\u521b\u5efa\u6587\u4ef6\u7cfb\u7edf\uff08\u82e5\u91c7\u53d6\u968f\u673a\u521d\u59cb\u5316\u6743\u91cd\u5219\u65e0\u9700\u521b\u5efaAFS\u6587\u4ef6\u7cfb\u7edf\uff09")),(0,o.yg)("h2",{id:"mindspore\u955c\u50cf\u4f7f\u7528"},"MindSpore\u955c\u50cf\u4f7f\u7528"),(0,o.yg)("p",null,"\u955c\u50cf\u4e2d\u5305\u542b\u4e86MindSpore\u7684\u57fa\u7840\u73af\u5883\u548cmindformer\u7684\u811a\u672c\uff1a"),(0,o.yg)("p",null,"\u6fc0\u6d3bMindSpore\u73af\u5883\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"source activate mindspore_dev\n")),(0,o.yg)("p",null,"mindformers\u811a\u672c\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"/root/workspace/mindformers\n")),(0,o.yg)("h2",{id:"internlm2-20b\u6a21\u578b32\u5361\u5fae\u8c03\u968f\u673a\u521d\u59cb\u5316\u6743\u91cd"},"InternLM2-20B\u6a21\u578b32\u5361\u5fae\u8c03\uff08\u968f\u673a\u521d\u59cb\u5316\u6743\u91cd\uff09"),(0,o.yg)("ol",null,(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u70b9\u51fb\u8fdb\u5165ACP\u9ad8\u6027\u80fd\u7b97\u529b\u6c60;")),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u9009\u5b9a\u5de5\u4f5c\u7a7a\u95f4;")),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u70b9\u51fb\u5de6\u4fa7\u680f\u4efb\u52a1\u5217\u8868;")),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u70b9\u51fb\u65b0\u5efa\u4efb\u52a1;")),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u9009\u62e9MindSpore\u955c\u50cf\n",(0,o.yg)("img",{src:t(4052).A,width:"1338",height:"311"})))),(0,o.yg)("p",null,"\u5728\u5b8c\u6210\u57fa\u672c\u7b97\u529b\u6c60\u4efb\u52a1\u914d\u7f6e\u540e\uff0c\u590d\u5236\u4ee5\u4e0b\u8bad\u7ec3\u542f\u52a8\u547d\u4ee4\uff0c\u521b\u5efa\u4efb\u52a1\u5373\u53ef\u542f\u52a820B 32\u5361\u968f\u673a\u521d\u59cb\u5316\u6743\u91cd\u7684\u5fae\u8c03"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},'export HCCL_RDMA_TC=104\nexport HCCL_BUFFSIZE=300\nexport HCCL_IF_BASE_PORT=30000\nexport HCCL_INTRA_ROCE_ENABLE=1\nexport HCCL_INTRA_PCIE_ENABLE=0\nexport HCCL_CONNECT_TIMEOUT=1600\n\nsource activate mindspore_dev\n\n# the root directory of run package\nLOCAL_ASCEND=/usr/local/Ascend \nexport LD_LIBRARY_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/lib64:${LOCAL_ASCEND}/driver/lib64:${LOCAL_ASCEND}/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling:${LD_LIBRARY_PATH}\nexport TBE_IMPL_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe\nexport ASCEND_OPP_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp\nexport ASCEND_AICPU_PATH=${ASCEND_OPP_PATH}/..\nexport PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/compiler/ccec_compiler/bin/:${PATH}\nexport PYTHONPATH=${TBE_IMPL_PATH}:${PYTHONPATH}\n\n#source cann\u7684\u73af\u5883\u53d8\u91cf\uff0cmsprof\u751f\u6548\uff1b\nsource /usr/local/Ascend/ascend-toolkit/set_env.sh \n\nmaster_IP=$(nslookup "$MASTER_ADDR" | awk \'/^Address: / {print $2}\')\necho "master_IP address of $MASTER_ADDR is: $master_IP"\n\nsed -i \'3a bbb\' /usr/local/Ascend/ascend-toolkit/latest/opp/built-in/fusion_pass/config/fusion_config.json\nsed -i \'s/bbb/ "ZZMatMulToMatmulV3FusionPass": "off",/g\' /usr/local/Ascend/ascend-toolkit/latest/opp/built-in/fusion_pass/config/fusion_config.json\n\nexport GLOG_v=2\nexport ENABLE_CELL_REUSE=1\nexport SHARED_PATHS="/root/workspace/mindformers/output_20b,/root/workspace/mindformers/checkpoint_download"\n\nsed -i \'s/\\r$//\' mindformers/scripts/msrun_launcher_20b.sh\nsed -i \'s/epochs: 2/epochs: 0.1/g\' mindformers/research/internlm2/finetune_internlm2_20b_32p_old.yaml\n\nbash mindformers/scripts/msrun_launcher_20b.sh \\\n"python mindformers/research/internlm2/run_internlm2.py \\\n--config mindformers/research/internlm2/finetune_internlm2_20b_32p_old.yaml \\\n--train_dataset mindformers/data/alpaca_zh_51k_4096.mindrecord \\\n--run_mode finetune \\\n--use_parallel True" \\\n32 16 $master_IP $MASTER_PORT $RANK mindformers/output_20b/msrun_log False 1600\n\ntail -f mindformers/output_20b/msrun_log/worker_$RANK.log\n')),(0,o.yg)("p",null,"\u53c2\u6570\u8bf4\u660e\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},'\u542f\u52a8\u811a\u672c\u5165\u53e3\uff1a\nmindformers/scripts/msrun_launcher_20b.sh\n\n\u53c2\u6570\uff1a\u5f53\u524d\u968f\u673a\u521d\u59cb\u5316\u6743\u91cd\uff0c\u4e0d\u52a0\u8f7d\u9884\u8bad\u7ec3\u6743\u91cd\uff0c\u91c7\u7528mindformers/data/\u5185\u6240\u6709\u6570\u636e\u96c6\u8fdb\u884c\u5fae\u8c03\n"python mindformers/research/internlm2/run_internlm2.py #internlm2\u7684\u5165\u53e3python\u811a\u672c\n--config mindformers/research/internlm2/finetune_internlm2_20b_32p_old.yaml #intenrlm2\u7684\u6a21\u578b\u914d\u7f6e\uff0c\u5e76\u884c\u7b56\u7565\u914d\u7f6e\u7b49\n--train_dataset mindformers/data/ #\u9884\u5904\u7406\u597d\u7684\u8bad\u7ec3\u6570\u636e\u76ee\u5f55\n--run_mode finetune #\u8bad\u7ec3\u6a21\u5f0f\n--use_parallel True" #\u5f00\u542f\u5e76\u884c\u7b56\u7565\n\n#\u53ef\u4ee5\u6307\u5b9a\u8bad\u7ec3\u6570\u636e\u96c6\uff0c\u5982\u6307\u5b9aalpaca\uff1a\n"python mindformers/research/internlm2/run_internlm2.py #internlm2\u7684\u5165\u53e3python\u811a\u672c\n--config mindformers/research/internlm2/finetune_internlm2_20b_32p_old.yaml #intenrlm2\u7684\u6a21\u578b\u914d\u7f6e\uff0c\u5e76\u884c\u7b56\u7565\u914d\u7f6e\u7b49\n--train_dataset mindformers/data/alpaca_zh_51k_4096.mindrecord\n--run_mode finetune #\u8bad\u7ec3\u6a21\u5f0f\n--use_parallel True" #\u5f00\u542f\u5e76\u884c\u7b56\u7565\n')),(0,o.yg)("h2",{id:"internlm2-20b\u6a21\u578b32\u5361\u5fae\u8c03\u52a0\u8f7d\u6a21\u578b\u6743\u91cd"},"InternLM2-20B\u6a21\u578b32\u5361\u5fae\u8c03\uff08\u52a0\u8f7d\u6a21\u578b\u6743\u91cd\uff09"),(0,o.yg)("h3",{id:"\u6743\u91cd\u914d\u7f6e"},"\u6743\u91cd\u914d\u7f6e"),(0,o.yg)("ol",null,(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u4f7f\u7528\u4e0a\u8ff0MindSpore\u955c\u50cf\u521b\u5efaCCI\uff0c\u5e76\u5c06\u7528\u4e8e\u4e0b\u8f7d\u6a21\u578b\u6743\u91cd\u7684AFS\u6302\u8f7d\u5230/data\u76ee\u5f55\u4e0b\uff08\u6216\u901a\u8fc7\u7b97\u529b\u6c60\u521b\u5efa\u4efb\u52a1\uff0c\u5c06AFS\u6302\u8f7d\u5230/data\u76ee\u5f55\u4e0b\uff0c\u5f85\u4efb\u52a1\u8fd0\u884c\u540e\uff0c\u8fdb\u5165web terminal\uff09;")),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u6743\u91cd\u4e0b\u8f7d;"))),(0,o.yg)("p",null,"\u901a\u8fc7\u4e0b\u65b9\u94fe\u63a5\u4e0b\u8f7d\u6a21\u578b\u6743\u91cd\n",(0,o.yg)("a",{parentName:"p",href:"https://www.modelscope.cn/Shanghai_AI_Laboratory/internlm2-20b.git"},"https://www.modelscope.cn/Shanghai_AI_Laboratory/internlm2-20b.git")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"# mount AFS to /data\nmkdir -p /data/checkpoint_download/ #\u6216\u66ff\u6362\u4e3a\u5176\u4ed6\u76ee\u5f55\ncd /data/checkpoint_download/\n\napt update\napt install git #\u82e5\u8fd8\u672a\u4e0b\u8f7dgit\uff0c\u9700\u5148install\n\ngit init #\u82e5git clone\u65e0\u6cd5clone\u5b8c\u6574\u7684\u6743\u91cd\uff0c\u53ef\u80fd\u9700\u8981\u5148\u4e0b\u8f7dlfs\uff08git\u6269\u5c55\uff1aLarge File Storage\uff09\napt-get install git-lfs\ngit lfs install\n\ngit clone https://www.modelscope.cn/Shanghai_AI_Laboratory/internlm2-20b.git #clone\u6a21\u578b\n")),(0,o.yg)("p",null,(0,o.yg)("img",{src:t(17671).A,width:"1855",height:"450"})),(0,o.yg)("ol",{start:3},(0,o.yg)("li",{parentName:"ol"},"\u6743\u91cd\u8f6c\u6362;")),(0,o.yg)("p",null,"\u4e0b\u8f7d\u6743\u91cd\u540e\uff0c\u9700\u8981\u7ecf\u8fc7\u6a21\u578b\u6743\u91cd\u8f6c\u6362\u540e\u518d\u52a0\u8f7d\u5165mindformers\u8fdb\u884c\u8bad\u7ec3\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"source activate mindspore_dev\ncd /root/workspace/mindformers\n#\u82e5\u62a5\u9519\uff0c\u9700\u5148\u4e0b\u8f7d\u90e8\u5206\u5305\npython convert_weight.py \\\n --model internlm2 \\\n --input_path /data/checkpoint_download/internlm2-20b \\ # \u53ef\u66ff\u6362\u4e3a\u6a21\u578b\u4e0b\u8f7d\u76ee\u5f55\n --output_path /data/checkpoint_download/internlm2-20b_ms_noqkv/internlm2_weight_ms_noqkv.ckpt \\ #\u53ef\u66ff\u6362\u4e3a\u81ea\u5b9a\u4e49\u8f93\u51fa\u76ee\u5f55\n --qkv_concat False #True \u89e3\u51b3\u52a8\u6001shape \u5173\u95edqkv_concat\n")),(0,o.yg)("h3",{id:"\u7b97\u529b\u6c60\u6a21\u578b\u5fae\u8c03\u4efb\u52a1\u914d\u7f6e"},"\u7b97\u529b\u6c60\u6a21\u578b\u5fae\u8c03\u4efb\u52a1\u914d\u7f6e"),(0,o.yg)("ol",null,(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u8fdb\u5165\u63a7\u5236\u53f0\uff0c\u70b9\u51fbACP\uff0c\u5e76\u65b0\u5efa\u4efb\u52a1")),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u9009\u62e9MindSpore\u955c\u50cf\n",(0,o.yg)("img",{src:t(4052).A,width:"1338",height:"311"}))),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u5c06AFS\u6302\u8f7d\u5230/data\u76ee\u5f55\u4e0b\n",(0,o.yg)("img",{src:t(35610).A,width:"4290",height:"2191"}))),(0,o.yg)("li",{parentName:"ol"},(0,o.yg)("p",{parentName:"li"},"\u542f\u52a8\u547d\u4ee4"))),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},'export HCCL_RDMA_TC=104\nexport HCCL_BUFFSIZE=300\nexport HCCL_IF_BASE_PORT=30000\nexport HCCL_INTRA_ROCE_ENABLE=1\nexport HCCL_INTRA_PCIE_ENABLE=0\nexport HCCL_CONNECT_TIMEOUT=1600\n\nsource activate mindspore_dev\n\n# the root directory of run package\nLOCAL_ASCEND=/usr/local/Ascend \nexport LD_LIBRARY_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/lib64:${LOCAL_ASCEND}/driver/lib64:${LOCAL_ASCEND}/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling:${LD_LIBRARY_PATH}\nexport TBE_IMPL_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe\nexport ASCEND_OPP_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp\nexport ASCEND_AICPU_PATH=${ASCEND_OPP_PATH}/..\nexport PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/compiler/ccec_compiler/bin/:${PATH}\nexport PYTHONPATH=${TBE_IMPL_PATH}:${PYTHONPATH}\n\n#source cann\u7684\u73af\u5883\u53d8\u91cf\uff0cmsprof\u751f\u6548\uff1b\nsource /usr/local/Ascend/ascend-toolkit/set_env.sh \n\nmaster_IP=$(nslookup "$MASTER_ADDR" | awk \'/^Address: / {print $2}\')\necho "master_IP address of $MASTER_ADDR is: $master_IP"\n\nsed -i \'3a bbb\' /usr/local/Ascend/ascend-toolkit/latest/opp/built-in/fusion_pass/config/fusion_config.json\nsed -i \'s/bbb/ "ZZMatMulToMatmulV3FusionPass": "off",/g\' /usr/local/Ascend/ascend-toolkit/latest/opp/built-in/fusion_pass/config/fusion_config.json\n\nexport GLOG_v=2\nexport ENABLE_CELL_REUSE=1\nexport SHARED_PATHS="/root/workspace/mindformers/output_20b,/root/workspace/mindformers/checkpoint_download"\n\nsed -i \'s/\\r$//\' mindformers/scripts/msrun_launcher_20b.sh\n\nbash mindformers/scripts/msrun_launcher_20b.sh \\\n"python mindformers/research/internlm2/run_internlm2.py \\\n--config mindformers/research/internlm2/finetune_internlm2_20b_32p_old.yaml \\\n--train_dataset mindformers/data/ \\\n--load_checkpoint /data/checkpoint_download/internlm2-20b_ms_noqkv \\\n--run_mode finetune \\\n--use_parallel True"\n32 16 $master_IP $MASTER_PORT $RANK mindformers/output_20b/msrun_log False 1600\n\ntail -f mindformers/output_20b/msrun_log/worker_$RANK.log\n')),(0,o.yg)("p",null,"\u53c2\u6570\u8bf4\u660e"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},'#\u542f\u52a8\u811a\u672c\u5165\u53e3\nmindformers/scripts/msrun_launcher_20b.sh\n\n#\u811a\u672c\u53c2\u6570\n"python mindformers/research/internlm2/run_internlm2.py #internlm2\u7684\u5165\u53e3python\u811a\u672c\n--config mindformers/research/internlm2/finetune_internlm2_20b_32p_old.yaml #intenrlm2\u7684\u6a21\u578b\u914d\u7f6e\uff0c\u5e76\u884c\u7b56\u7565\u914d\u7f6e\u7b49\n--train_dataset mindformers/data/ #\u9884\u5904\u7406\u597d\u7684\u8bad\u7ec3\u6570\u636e\u76ee\u5f55\n--load_checkpoint output/x_tran_ckpt_copy_chat_20b_32p_48l_242_noqkv/internlm2-20b-ms-noqkv #\u5fae\u8c03\u521d\u59cb\u6743\u91cd\n--run_mode finetune #\u8bad\u7ec3\u6a21\u5f0f\n--use_parallel True" #\u5f00\u542f\u5e76\u884c\u7b56\u7565\n\n')),(0,o.yg)("h3",{id:"tips\u6570\u636e\u9884\u5904\u7406"},"Tips\uff1a\u6570\u636e\u9884\u5904\u7406"),(0,o.yg)("p",null,"MindSpore\u4f7f\u7528\u79c1\u6709\u7684mindrecrd\u6570\u636e\u683c\u5f0f\uff0c\u5fae\u8c03\u524d\u9700\u8981\u9884\u5904\u7406\u6570\u636e\u3002\n\u4ee5alpaca\u4f5c\u4e3a\u5fae\u8c03\u6570\u636e\u96c6\u3002"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"wget https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Ftatsu-lab%2Fstanford_alpaca%2Fblob%2Fmain%2Falpaca_data.json \n")),(0,o.yg)("p",null,"\u4e0b\u8f7d\u6570\u636e\u96c6\u540e\uff0c\u4f7f\u7528\u9884\u5904\u7406\u811a\u672cresearch/internlm2/alpaca_data_preprocess.py\u751f\u6210mindrecord\u8bad\u7ec3\u6570\u636e:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre"},"python alpaca_data_preprocess.py \\\n --mindrecord_schema internlm2_alpaca \\\n --input_glob {path}/alpaca_data.json \\\n --output_file {path}/alpaca_processed/alpaca.mindrecord \\\n --model_file {path}/tokenizer.model \\\n --seq_length 2048\n")),(0,o.yg)("p",null,"\u5bf9\u4e8epacked\u6570\u636e\uff1a\n\u53c2\u8003mindformers/scripts/pack\u4e0b\u7684\u6570\u636e\u96c6\u9884\u5904\u7406\u811a\u672c"))}m.isMDXComponent=!0},35610:(e,n,t)=>{t.d(n,{A:()=>r});const r=t.p+"assets/images/afs_data_new-949ba29db79545f7fadef84c6aba57b1.png"},17671:(e,n,t)=>{t.d(n,{A:()=>r});const r=t.p+"assets/images/gitclone_model-87ccbadc7aa77e1164600544f304e304.png"},4052:(e,n,t)=>{t.d(n,{A:()=>r});const r=t.p+"assets/images/mindspore\u955c\u50cf-97ff787b52e158e86ef1c2689f6a2ef2.png"}}]);