赞
踩
在阿里云的机器学习平台PAI上跑的
机器学习PAI_机器学习建模训练部署_智能推荐_人工智能_阿里云 (aliyun.com)
获取预训练模型时出现问题(error:104 Connection reset by peer)所以修改部分代码
- #import 相关库
- #导入前置依赖
- from transformers import BertTokenizer # 使用离线bert
- #获取Bert预训练模型
- # tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
- tokenizer = BertTokenizer.from_pretrained('./bert-base-uncased')
下载bert
git clone https://huggingface.co/bert-base-uncased # 终端
使用时还会报错:OSError: You seem to have cloned a repository without having git-lfs installed. Please install git
- apt-get update
- apt-get install git-lfs
- git init
- git lfs install
- cd ./bert-base-uncased # 进入bert所在文件夹
- git lfs pull
重启一下环境就可以运行啦(当然如果刚进入就完成这些操作,也不用重启了)
- # test['Keywords'] = test['title'].fillna('')
- test_data['Keywords'] = test_data['title'].fillna('')
然后,就开始跑啦——
validation loss前期有低有高,后期一路升高,有待仔细研究
total随训练次数增加而降低,在epoch==90,step==167的时候,total loss就为0.0000了
感觉努努力还可以再高点(flag)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。