[{"data":1,"prerenderedAt":358},["ShallowReactive",2],{"content-query-3ywPqawj1v":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"body":13,"_type":352,"_id":353,"_source":354,"_file":355,"_stem":356,"_extension":357},"/news/zh/2538","zh",false,"","【昇思MindSpore技术公开课】第六节代码预训练课程回顾来啦！","上周六（5月27日）我们邀请到清华大学知识工程实验室的夏箫同学进行代码大模型的技术分析，讲解了代码预训练模型发展历程中，并从数据预处理到模型性能评估完整地回顾了开源大规模多语言代码生成模型CodeGeeX的开发过程。不知大家通过这节课是否对代码大模型有了更深刻的了解了呢？接下来我们对课程进行简单的回顾，迎接下一节公开课的进一步深入。","2023-05-31","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/06/08/7021d57a7583488795e070ed16dea1a4.png","news",{"type":14,"children":15,"toc":349},"root",[16,24,29,38,46,51,82,87,92,97,102,107,112,117,122,127,135,140,145,150,155,160,173,182,190,195,200,207,220,225,243,248,253,258,263,268,273,281,286,291,296,301,306,311,319,327,332,337,342],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"昇思mindspore技术公开课第六节代码预训练课程回顾来啦",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"p",{},[28],{"type":23,"value":9},{"type":17,"tag":25,"props":30,"children":31},{},[32],{"type":17,"tag":33,"props":34,"children":35},"strong",{},[36],{"type":23,"value":37},"一、",{"type":17,"tag":25,"props":39,"children":40},{},[41],{"type":17,"tag":33,"props":42,"children":43},{},[44],{"type":23,"value":45},"课程回顾",{"type":17,"tag":25,"props":47,"children":48},{},[49],{"type":23,"value":50},"代码与训练的发展历程：",{"type":17,"tag":52,"props":53,"children":54},"ul",{},[55,77],{"type":17,"tag":56,"props":57,"children":58},"li",{},[59,61,65,67,70,72,75],{"type":23,"value":60},"代码预训练任务",{"type":17,"tag":62,"props":63,"children":64},"br",{},[],{"type":23,"value":66},"1、程序生成",{"type":17,"tag":62,"props":68,"children":69},{},[],{"type":23,"value":71},"2、注释生成/代码解释",{"type":17,"tag":62,"props":73,"children":74},{},[],{"type":23,"value":76},"3、代码翻译",{"type":17,"tag":56,"props":78,"children":79},{},[80],{"type":23,"value":81},"代码预训练模型：",{"type":17,"tag":25,"props":83,"children":84},{},[85],{"type":23,"value":86},"1、针对代码的Transformer",{"type":17,"tag":25,"props":88,"children":89},{},[90],{"type":23,"value":91},"1）CodeBER",{"type":17,"tag":25,"props":93,"children":94},{},[95],{"type":23,"value":96},"2）GraphCodeBERT",{"type":17,"tag":25,"props":98,"children":99},{},[100],{"type":23,"value":101},"2、大模型生成模型",{"type":17,"tag":25,"props":103,"children":104},{},[105],{"type":23,"value":106},"1）CodeX",{"type":17,"tag":25,"props":108,"children":109},{},[110],{"type":23,"value":111},"2）InCoder",{"type":17,"tag":25,"props":113,"children":114},{},[115],{"type":23,"value":116},"3） CodeGen",{"type":17,"tag":25,"props":118,"children":119},{},[120],{"type":23,"value":121},"4）CodeGeex",{"type":17,"tag":25,"props":123,"children":124},{},[125],{"type":23,"value":126},"CodeGeex——开源的大规模多语言代码生成模型：",{"type":17,"tag":52,"props":128,"children":129},{},[130],{"type":17,"tag":56,"props":131,"children":132},{},[133],{"type":23,"value":134},"代码预训练模型处理",{"type":17,"tag":25,"props":136,"children":137},{},[138],{"type":23,"value":139},"1、数据集选取",{"type":17,"tag":25,"props":141,"children":142},{},[143],{"type":23,"value":144},"2、数据清洗：文件去重、去除无效文件",{"type":17,"tag":25,"props":146,"children":147},{},[148],{"type":23,"value":149},"3、编程语言标签：标记编程语言，添加复杂元信息",{"type":17,"tag":25,"props":151,"children":152},{},[153],{"type":23,"value":154},"4、标识符化：基于GPT-2 BPE tokenizer分词，并将连续空格转换为特殊空格词符",{"type":17,"tag":25,"props":156,"children":157},{},[158],{"type":23,"value":159},"5、序列切分：文件切分为登场序列",{"type":17,"tag":52,"props":161,"children":162},{},[163],{"type":17,"tag":56,"props":164,"children":165},{},[166,168,171],{"type":23,"value":167},"CodeGeeX模型架构：基于GPT架构的自回归模型",{"type":17,"tag":62,"props":169,"children":170},{},[],{"type":23,"value":172},"模型并行是算子层面的并行，它利用某些算子的特性将算子拆分到多个设备上进行计算。",{"type":17,"tag":25,"props":174,"children":175},{},[176],{"type":17,"tag":177,"props":178,"children":181},"img",{"alt":179,"src":180},"image.png","https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230608022702.58798003924056810385260016189443:50540607064953:2400:ECFC4B5B068CBB7AB33C55B113BDB0E632E2CD023F2776EF3569DEF19E4AEB78.png",[],{"type":17,"tag":52,"props":183,"children":184},{},[185],{"type":17,"tag":56,"props":186,"children":187},{},[188],{"type":23,"value":189},"CodeGeeX模型预训练：使用昇思MindSpore + 昇腾910组合进行训练，使用自然语言活代码token作为输入，输出下一个token的概率。",{"type":17,"tag":25,"props":191,"children":192},{},[193],{"type":23,"value":194},"1、混合精度",{"type":17,"tag":25,"props":196,"children":197},{},[198],{"type":23,"value":199},"2、并行训练：数据并行+模型并行",{"type":17,"tag":25,"props":201,"children":202},{},[203],{"type":17,"tag":177,"props":204,"children":206},{"alt":179,"src":205},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230608022723.33476095950050129539951438689504:50540607064953:2400:FD3D9D77FFE011E02CCFF977E26719B53D1F793484F05B552594919E4B04EF04.png",[],{"type":17,"tag":52,"props":208,"children":209},{},[210],{"type":17,"tag":56,"props":211,"children":212},{},[213,215,218],{"type":23,"value":214},"CodeGeeX模型优化策略",{"type":17,"tag":62,"props":216,"children":217},{},[],{"type":23,"value":219},"1、算子融合",{"type":17,"tag":25,"props":221,"children":222},{},[223],{"type":23,"value":224},"2、矩阵乘算子自动搜索出效率最高的计算维度组合",{"type":17,"tag":52,"props":226,"children":227},{},[228],{"type":17,"tag":56,"props":229,"children":230},{},[231,233,236,238,241],{"type":23,"value":232},"代码生成模型性能评估",{"type":17,"tag":62,"props":234,"children":235},{},[],{"type":23,"value":237},"1、语义相似性无法正确反应生成代码的质量，需要同时考虑代码功能的正确性。",{"type":17,"tag":62,"props":239,"children":240},{},[],{"type":23,"value":242},"1）基于相似性（参考生成对比）：BLEU、Rouge、CodeBLEU",{"type":17,"tag":25,"props":244,"children":245},{},[246],{"type":23,"value":247},"2）InCoder基于正确性（运行测试用例）：通过率",{"type":17,"tag":25,"props":249,"children":250},{},[251],{"type":23,"value":252},"2、目前的基准从多任务及多语言两个方面对模型进行评价",{"type":17,"tag":25,"props":254,"children":255},{},[256],{"type":23,"value":257},"1）多任务：通过不同应用场景进行评价，多使用CodeBLEU/BLEU评价相似性",{"type":17,"tag":25,"props":259,"children":260},{},[261],{"type":23,"value":262},"2）多语言：在不同编程语言下评价代码正确性，如HumanEval（仅支持Python）、MultiPL-E（支持16种语言，但为自动翻译并不支持多任务）",{"type":17,"tag":25,"props":264,"children":265},{},[266],{"type":23,"value":267},"3、HumanEval-X：新的多语言代码生成基准",{"type":17,"tag":25,"props":269,"children":270},{},[271],{"type":23,"value":272},"1）支持五种编程语言，保证正确性，可进行多语言代码生成及跨语言代码翻译两种下游任务",{"type":17,"tag":52,"props":274,"children":275},{},[276],{"type":17,"tag":56,"props":277,"children":278},{},[279],{"type":23,"value":280},"CodeGeeX代码生成插件",{"type":17,"tag":25,"props":282,"children":283},{},[284],{"type":23,"value":285},"1、自动模式",{"type":17,"tag":25,"props":287,"children":288},{},[289],{"type":23,"value":290},"2、交互模式",{"type":17,"tag":25,"props":292,"children":293},{},[294],{"type":23,"value":295},"3、翻译模式",{"type":17,"tag":25,"props":297,"children":298},{},[299],{"type":23,"value":300},"4、解释模式",{"type":17,"tag":25,"props":302,"children":303},{},[304],{"type":23,"value":305},"5、提示模式",{"type":17,"tag":25,"props":307,"children":308},{},[309],{"type":23,"value":310},"6、Chat模式",{"type":17,"tag":25,"props":312,"children":313},{},[314],{"type":17,"tag":33,"props":315,"children":316},{},[317],{"type":23,"value":318},"二、",{"type":17,"tag":25,"props":320,"children":321},{},[322],{"type":17,"tag":33,"props":323,"children":324},{},[325],{"type":23,"value":326},"下节课预告",{"type":17,"tag":25,"props":328,"children":329},{},[330],{"type":23,"value":331},"本周六（6月3日）我们将会带来Prompt Tuning课程的讲解。在大模型的发展过程中，我们发现随着模型参数规模的不断增大，finetune的效果逐渐变得并不理想。由此发展出来另一个微调的技术路线——prompt tuning。通过针对特定任务设计一组有效的输入提示，知道模型更好地理解下游任务，从而生成更准确的输出。",{"type":17,"tag":25,"props":333,"children":334},{},[335],{"type":23,"value":336},"此外，为响应大家学习多模态大模型的需求，我们将在下周六（6月10日）额外增加一节课程进行紫东·太初大模型，以及语音识别理论与实践的讲解，详情将会在下周进行预告，大家敬请期待！",{"type":17,"tag":25,"props":338,"children":339},{},[340],{"type":23,"value":341},"本周的直播课程内容详见下方海报：",{"type":17,"tag":25,"props":343,"children":344},{},[345],{"type":17,"tag":177,"props":346,"children":348},{"alt":179,"src":347},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230608022751.99072281361500254601155362559273:50540607064953:2400:5B3259AE53A67EB756EFA31128DE52DDA6605514FEA5B0B4B1F0B736FAA9F953.png",[],{"title":7,"searchDepth":350,"depth":350,"links":351},4,[],"markdown","content:news:zh:2538.md","content","news/zh/2538.md","news/zh/2538","md",1776506066502]