Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
xiangy 161794e910 | 1 year ago | |
---|---|---|
ernie_model | 1 year ago | |
pic | 1 year ago | |
task_afqmc | 1 year ago | |
task_csl | 1 year ago | |
task_ocnli | 1 year ago | |
task_tnews | 1 year ago | |
README.md | 1 year ago |
鹏城-百度·文心(ERNIE 3.0 Titan)是鹏城实验室与百度联合研发的具有2600亿参数的中文预训练语言模型。它是全球第一个知识增强的千亿参数模型,也是中国最大的单例模型。该模型在海量知识图谱和海量非结构化数据上进行训练,在自然语言理解(NLU)和生成(NLG)方面表现出色。Titan在60多个NLP任务中取得了SOTA成果,包括机器阅读理解、文本分类和语义相似性等。该模型在30个少样本和零样本基准测试中也表现良好。这表明它可以用少量标记数据泛化各种下游任务,并降低识别阈值。
在该大模型的基础上,蒸馏出了110M参数通用模型ERNIE 3.0 Base、 280M参数重量级通用模型ERNIE 3.0 XBase和74M轻量级通用模型ERNIE 3.0 Medium三个模型并开源。项目地址可见https://github.com/PaddlePaddle/ERNIE/tree/ernie-kit-open-v1.0。
上述项目是基于百度PaddlePaddle深度学习框架构建,本项目提供了上述三个ERNIE模型的PyTorch框架支持,并提供了四个CLUE数据集的示例,实验证明,本项目基本可以复现PaddlePaddle的效果。
|--ernie_model
|--ernie.py # ERNIE模型结构代码
|--ernie_config.py # ERNIE配置解析
|--task_csl
|--config.py # 微调任务的配置项
|--data.py # 微调任务的数据处理
|--model.py # 微调任务的模型定义
|--train.py # 微调任务的训练
...
三个模型的文件和示例用的数据集的下载地址均在在本项目的数据集资源中
模型 | 下载地址 |
---|---|
ERNIE 3.0 Base | download |
ERNIE 3.0 XBase | download |
ERNIE 3.0 Medium | download |
from transformers import BertTokenizerFast
from ernie_model.ernie import ErnieModel
from ernie_model.ernie_config import ErnieConfig
text = "测试文本样例"
tokenizer = BertTokenizerFast("ernie vocab path")
encoded_text = tokenizer(text, return_tensor="pt")
cfg_dict = ErnieConfig("ernie config path")
ernie_model = ErnieModel(cfg_dict)
out = ernie_model(src_ids=encoded_text["input_ids])
本地运行:下载代码、数据和预训练文件,进入到对应任务文件夹下,执行python train.py --pretrain_dir={ernie_model_directory} --data_dir={data_directory} --save_path={model_save_path} --log_path={log_path}
云脑运行:新建训练任务,启动文件栏填写 {任务名}/train.py (eg. task_csl/train.py),并配置好环境、数据和硬件,即可开始训练。可以参考本项目训练成功的配置(云脑-训练任务-修改,如图所示)
云脑使用可以参见 基于CPU、GPU调试和训练任务
模型 | TNEWS | AFQMC | OCNLI | CSL |
---|---|---|---|---|
ERNIE3.0-XBase-Paddle | 60.34 | 76.95 | 82.07 | 84.27 |
ERNIE3.0-XBase-PyTorch | 60.51 ↑ | 81.55 ↑ | 81.66 ↓ | 87.67 ↑ |
ERNIE3.0-Base-Paddle | 58.73 | 76.53 | 80.31 | 83.30 |
ERNIE3.0-Base-PyTorch | 58.84 ↑ | 76.41 ↓ | 79.76 ↓ | 85.63 ↑ |
ERNIE3.0-Medium-Paddle | 57.16 | 74.56 | 77.02 | 81.23 |
ERNIE3.0-Medium-PyTorch | 57.20 ↑ | 75.72 ↑ | 76.71 ↓ | 84.83 ↑ |
百度文心ERNIE3.0模型的PyTorch版本。
Python
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》