[{"data":1,"prerenderedAt":381},["ShallowReactive",2],{"content-query-vmMysr6if4":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"body":13,"_type":375,"_id":376,"_source":377,"_file":378,"_stem":379,"_extension":380},"/news/zh/2712","zh",false,"","北京昇腾人工智能计算中心率先实现基于MindSpore的Baichuan大模型训练、微调、推理和部署","北京昇腾人工智能计算中心基于国产自主创新框昇思MindSpore以及大模型开发套件MindFormers成功完成国产开源大模型Baichuan的训练、微调和推理部署，并支持某行业客户使用计算中心160张卡训练集群完成二次预训练，Loss稳定收敛，成功孵化行业大模型。","2023-08-22","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/08/28/ceda4a4d026b4ce38d4da66927b6b633.png","news",{"type":14,"children":15,"toc":372},"root",[16,24,34,38,45,50,59,64,72,77,85,90,95,100,108,113,118,128,136,144,149,159,167,175,180,188,196,205,213,223,232,240,251,260,268,279,288,296,307,316,324,335,344,352,363],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"北京昇腾人工智能计算中心率先实现基于mindspore的baichuan大模型训练微调推理和部署",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"p",{},[28],{"type":17,"tag":29,"props":30,"children":33},"img",{"alt":31,"src":32},"image.png","https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230823023559.58123874443013611206007262336330:50540827021532:2400:587D2F008D714C29BEA653F03A7742A9DFAF5436BA65772E209F51F1205FCD9D.png",[],{"type":17,"tag":25,"props":35,"children":36},{},[37],{"type":23,"value":9},{"type":17,"tag":25,"props":39,"children":40},{},[41],{"type":17,"tag":29,"props":42,"children":44},{"alt":31,"src":43},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230823024133.12404101228309826770340873428423:50540827021532:2400:EC4F8D3C8EC4C84B099D43ADBF4DB57B70C663C30374CBABE6912010B7C44D2B.png",[],{"type":17,"tag":25,"props":46,"children":47},{},[48],{"type":23,"value":49},"（用户实测集群训练Loss曲线以及学习率）",{"type":17,"tag":25,"props":51,"children":52},{},[53],{"type":17,"tag":54,"props":55,"children":56},"strong",{},[57],{"type":23,"value":58},"MindFormers套件",{"type":17,"tag":25,"props":60,"children":61},{},[62],{"type":23,"value":63},"MindFormers是一款强大而全面的大模型训练、推理和部署全流程开发套件。它不仅提供了丰富的的基础知识，还具备多种训练方式、多种推理算法和多种部署方式。同时，MindFormers还具有易用性和可扩展性的特点，让用户可以快速上手，一行代码实现从单卡到大规模集群训练的无缝切换，高效地融合数据并行和模型并行策略；同时可以根据用户的实际需求进行功能扩展和定制。",{"type":17,"tag":25,"props":65,"children":66},{},[67],{"type":17,"tag":54,"props":68,"children":69},{},[70],{"type":23,"value":71},"Baichuan大模型",{"type":17,"tag":25,"props":73,"children":74},{},[75],{"type":23,"value":76},"Baichuan大模型是由百川智能开发的一系列开源可商用的大规模预训练语言模型。包含了70亿、130亿、530亿参数的模型。",{"type":17,"tag":25,"props":78,"children":79},{},[80],{"type":17,"tag":54,"props":81,"children":82},{},[83],{"type":23,"value":84},"具体优势如下：",{"type":17,"tag":25,"props":86,"children":87},{},[88],{"type":23,"value":89},"1. 基于海量的中英文数据训练，具有很强的语言通用性和跨语言能力。它们可以处理各种类型和风格的文本，无论是正式叙述还是口语化表述，无论中文还是英文。",{"type":17,"tag":25,"props":91,"children":92},{},[93],{"type":23,"value":94},"2 . 基于Transformer结构，具有很高的并行性和可扩展性。它们可以利用大规模的计算资源，实现高效的训练和推理。也可以通过模型压缩和优化技术，适应不同的硬件和环境。",{"type":17,"tag":25,"props":96,"children":97},{},[98],{"type":23,"value":99},"3 . 基于自回归，具有很强的生成能力和连贯性。它们可以根据上下文生成流畅和有意义的文本，无论文本的长短。它们均可通过控制参数和策略，实现不同的生成目标和效果。",{"type":17,"tag":25,"props":101,"children":102},{},[103],{"type":17,"tag":54,"props":104,"children":105},{},[106],{"type":23,"value":107},"北京昇腾人工智能计算中心",{"type":17,"tag":25,"props":109,"children":110},{},[111],{"type":23,"value":112},"北京昇腾人工智能计算中心由门头沟政府牵头，中关村发展集团投资建设，并由北京昇腾创新人工智能科技中心有限公司独立运营，计算中心基于昇腾AI基础软硬件平台，一期100P算力规模，年底将扩容到400P，可以为企业和科研高校提供昇腾AI澎湃的算力服务。",{"type":17,"tag":25,"props":114,"children":115},{},[116],{"type":23,"value":117},"大模型时代，为了帮助各行业客户更好的使用大模型和大算力的能力，北京昇腾人工智能计算中心，已经将Baichuan、GLM、Llama、Bloom 、T5、BERT、GPT2、PanGuAlpha、MAE、VIT、Swin、CLIP等模型完成了训练、微调、推理和部署，未来还将逐步增加更多基础大模型，方便行业客户基于基础大模型，快速孵化专属的行业模型。",{"type":17,"tag":25,"props":119,"children":120},{},[121,123],{"type":23,"value":122},"**附：**",{"type":17,"tag":54,"props":124,"children":125},{},[126],{"type":23,"value":127},"基于北京昇腾人工智能计算中心进行Baichuan模型单机多卡训练的操作指导",{"type":17,"tag":25,"props":129,"children":130},{},[131],{"type":17,"tag":54,"props":132,"children":133},{},[134],{"type":23,"value":135},"1",{"type":17,"tag":25,"props":137,"children":138},{},[139],{"type":17,"tag":54,"props":140,"children":141},{},[142],{"type":23,"value":143},"注册镜像",{"type":17,"tag":25,"props":145,"children":146},{},[147],{"type":23,"value":148},"1、首先打开modelarts，进入镜像管理选项，进行注册镜像",{"type":17,"tag":25,"props":150,"children":151},{},[152],{"type":17,"tag":153,"props":154,"children":156},"code",{"className":155},[],[157],{"type":23,"value":158},"swr.cn-north-309.mtgascendic.cn/bj-aicc/mindformers_0.6rc1_mindspore_2_0_update1:mindformers_0.6rc1_mindspore_2_0_modelarts",{"type":17,"tag":25,"props":160,"children":161},{},[162],{"type":17,"tag":54,"props":163,"children":164},{},[165],{"type":23,"value":166},"2",{"type":17,"tag":25,"props":168,"children":169},{},[170],{"type":17,"tag":54,"props":171,"children":172},{},[173],{"type":23,"value":174},"基于注册的镜像创建notebook",{"type":17,"tag":25,"props":176,"children":177},{},[178],{"type":23,"value":179},"1、打开开发环境选项，创建notebook，选择镜像进行创建",{"type":17,"tag":25,"props":181,"children":182},{},[183],{"type":17,"tag":54,"props":184,"children":185},{},[186],{"type":23,"value":187},"3",{"type":17,"tag":25,"props":189,"children":190},{},[191],{"type":17,"tag":54,"props":192,"children":193},{},[194],{"type":23,"value":195},"拉取mindformers并安装依赖",{"type":17,"tag":25,"props":197,"children":198},{},[199],{"type":17,"tag":153,"props":200,"children":202},{"className":201},[],[203],{"type":23,"value":204},"git clone -b dev https://gitee.com/mindspore/mindformers.gitcd mindformersbash build.shpip3 install -r requirements.txt",{"type":17,"tag":25,"props":206,"children":207},{},[208],{"type":17,"tag":54,"props":209,"children":210},{},[211],{"type":23,"value":212},"4",{"type":17,"tag":25,"props":214,"children":215},{},[216],{"type":17,"tag":54,"props":217,"children":218},{},[219],{"type":17,"tag":54,"props":220,"children":221},{},[222],{"type":23,"value":195},{"type":17,"tag":25,"props":224,"children":225},{},[226],{"type":17,"tag":153,"props":227,"children":229},{"className":228},[],[230],{"type":23,"value":231},"wget https://baichuan.obs.cn-north-309.mtgascendic.cn/wiki.train.tokens wget https://baichuan.obs.cn-north-309.mtgascendic.cn/baichuan/tokenizer.model wget https://baichuan.obs.cn-north-309.mtgascendic.cn/baichuan/pytorch_model.bin",{"type":17,"tag":25,"props":233,"children":234},{},[235],{"type":17,"tag":54,"props":236,"children":237},{},[238],{"type":23,"value":239},"5",{"type":17,"tag":25,"props":241,"children":242},{},[243],{"type":17,"tag":54,"props":244,"children":245},{},[246],{"type":17,"tag":54,"props":247,"children":248},{},[249],{"type":23,"value":250},"下载配置文件",{"type":17,"tag":25,"props":252,"children":253},{},[254],{"type":17,"tag":153,"props":255,"children":257},{"className":256},[],[258],{"type":23,"value":259},"wget https://baichuan.obs.cn-north-309.mtgascendic.cn/run_baichuan7b.yamlwget https://baichuan.obs.cn-north-309.mtgascendic.cn/run_baichuan7b_lora.yaml",{"type":17,"tag":25,"props":261,"children":262},{},[263],{"type":17,"tag":54,"props":264,"children":265},{},[266],{"type":23,"value":267},"6",{"type":17,"tag":25,"props":269,"children":270},{},[271],{"type":17,"tag":54,"props":272,"children":273},{},[274],{"type":17,"tag":54,"props":275,"children":276},{},[277],{"type":23,"value":278},"使用预处理脚本生成mindrecord训练数据",{"type":17,"tag":25,"props":280,"children":281},{},[282],{"type":17,"tag":153,"props":283,"children":285},{"className":284},[],[286],{"type":23,"value":287},"cd mindformers/tools/dataset_preprocess/llama python llama_preprocess.py --input_glob /home/ma-user/work/mindformers/wiki.train.tokens --model_file /home/mauser/work/mindformers/tokenizer.model --seq_length 2048 --output_file /home/mauser/work/mindformers/wiki2048.mindrecord",{"type":17,"tag":25,"props":289,"children":290},{},[291],{"type":17,"tag":54,"props":292,"children":293},{},[294],{"type":23,"value":295},"7",{"type":17,"tag":25,"props":297,"children":298},{},[299],{"type":17,"tag":54,"props":300,"children":301},{},[302],{"type":17,"tag":54,"props":303,"children":304},{},[305],{"type":23,"value":306},"更改训练数据路径",{"type":17,"tag":25,"props":308,"children":309},{},[310],{"type":17,"tag":153,"props":311,"children":313},{"className":312},[],[314],{"type":23,"value":315},"/home/ma-user/work/mindformers/wiki2048.mindrecord",{"type":17,"tag":25,"props":317,"children":318},{},[319],{"type":17,"tag":54,"props":320,"children":321},{},[322],{"type":23,"value":323},"8",{"type":17,"tag":25,"props":325,"children":326},{},[327],{"type":17,"tag":54,"props":328,"children":329},{},[330],{"type":17,"tag":54,"props":331,"children":332},{},[333],{"type":23,"value":334},"单机多卡启动(训练)",{"type":17,"tag":25,"props":336,"children":337},{},[338],{"type":17,"tag":153,"props":339,"children":341},{"className":340},[],[342],{"type":23,"value":343},"cp /user/config/nbstart_hccl.json /home/ma-user/work/mindformerscd scriptsbash run_distribute.sh /home/ma-user/work/mindformers/nbstart_hccl.json /home/mauser/work/mindformers/run_baichuan7b.yaml [0,8] train",{"type":17,"tag":25,"props":345,"children":346},{},[347],{"type":17,"tag":54,"props":348,"children":349},{},[350],{"type":23,"value":351},"9",{"type":17,"tag":25,"props":353,"children":354},{},[355],{"type":17,"tag":54,"props":356,"children":357},{},[358],{"type":17,"tag":54,"props":359,"children":360},{},[361],{"type":23,"value":362},"查看运行效果",{"type":17,"tag":25,"props":364,"children":365},{},[366],{"type":17,"tag":153,"props":367,"children":369},{"className":368},[],[370],{"type":23,"value":371},"tail -f ../../mindformers/output/log/rank_0/info.l",{"title":7,"searchDepth":373,"depth":373,"links":374},4,[],"markdown","content:news:zh:2712.md","content","news/zh/2712.md","news/zh/2712","md",1776506071603]