开源python-向transformers学习

python开源系列文章

如何去阅读并学习一些优秀的开源框架的源码?

向transformers学习

https://github.com/huggingface/transformers

功能:支持NLP BERT时代的各种任务与模型

结构

测试

以tensorflow的模型为例

  • 测试TF model

    • 准备工作
  • UtilsFunctions测试

    • 测试无网链接时,使用cached file
    • 测试从文件中加载
    • 测试从url加载预训练模型
    • 测试unpack输入
    • 测试xla,softmax在cpu是否稳定
    • 测试从hub中checkpoint分区
    • 测试checkpiunt 分区
  • 检查上传到hub

    • push to hub
    • push to hub中的组织

详细

以AutoModel为中心,加上不同的head用于不同任务

  • ForCausalLM (解码器加上语言模型head,可用于文本生成)
  • ForSequenceClassification (解码器加上分类head,可用于文本分类)

config

参考

  • https://zhuanlan.zhihu.com/p/64770086

猜你喜欢

转载自blog.csdn.net/weixin_38812492/article/details/126437077