当前位置:网站首页>预训练语言模型的使用方法
预训练语言模型的使用方法
2022-07-29 05:21:00 【Quinn-ntmy】
如何使用预训练模型
一、思路
首先要考虑目标模型的数据量及目标数据与源数据的相关性。
一般要根据数据集与预训练模型数据集的不同相似度,采用不同的处理方法。
上图中
1、数据集小,数据相似度高
理想情况,可以将预训练模型当做特征提取器使用,所以有时候称为特征抽取。
做法:去掉输出层,将剩下的整个网络当做一个固定的特征提取机,应用到新的数据集中。
2、数据集大,数据相似度高
冻结预处理模型中少量较低层,修改分类器,然后在新数据集的基础上重新开始训练。
3、数据集小,数据相似度不高
冻结预训练模型中较少的网络高层,然后重新训练后面的网络,修改分类器。相似度不高,so 重新训练的过程很关键!!
数据集大小不足这方面通过冻结预训练模型中一些较低的网络层进行弥补。
4、数据集大,数据相似度不大
大数据集,NN的训练过程比较有效率。但相似度不高时,预训练模型会很不高效,to do:将预训练模型中的权重全都初始化后再到新数据集的基础上重新开始训练。
【注】具体操作时,往往会同时尝试多种方法,从其中选最优。
二、获取预训练模型
1、PyTorch的工具包torchvision中的models模块(torchvision.models
),使用时需设置 pretrained=True
。
2、tensorflow.keras.application
或 可以在TensorFlowHub网站(https://tfhub.dev/google/)上下载。
3、huggingFace-transformers(NLP预训练模型库)
边栏推荐
- torch.nn.Parameter()函数理解
- 【TensorRT】将 PyTorch 转化为可部署的 TensorRT
- Tear the ORM framework by hand (generic + annotation + reflection)
- [image classification] how to use mmclassification to train your classification model
- torch.nn.Embedding()详解
- Windos下安装pyspider报错:Please specify --curl-dir=/path/to/built/libcurl解决办法
- [go] use of defer
- [semantic segmentation] setr_ Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer
- [ml] PMML of machine learning model -- Overview
- Ribbon学习笔记二
猜你喜欢
【Transformer】SegFormer:Simple and Efficient Design for Semantic Segmentation with Transformers
【语义分割】Fully Attentional Network for Semantic Segmentation
Lock lock of concurrent programming learning notes and its implementation basic usage of reentrantlock, reentrantreadwritelock and stampedlock
【综述】图像分类网络
Android studio login registration - source code (connect to MySQL database)
pip安装后仍有解决ImportError: No module named XX
Reporting service 2016 custom authentication
虚假新闻检测论文阅读(五):A Semi-supervised Learning Method for Fake News Detection in Social Media
Ribbon learning notes II
Ribbon learning notes 1
随机推荐
第2周学习:卷积神经网络基础
yum本地源制作
Spring, summer, autumn and winter with Miss Zhang (2)
【语义分割】Mapillary 数据集简介
【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
Reporting service 2016 custom authentication
Tear the ORM framework by hand (generic + annotation + reflection)
Ribbon learning notes II
【卷积核设计】Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs
这些你一定要知道的进程知识
二、深度学习数据增强方法汇总
Flutter 绘制技巧探索:一起画箭头(技巧拓展)
Exploration of flutter drawing skills: draw arrows together (skill development)
Lock lock of concurrent programming learning notes and its implementation basic usage of reentrantlock, reentrantreadwritelock and stampedlock
Windos下安装pyspider报错:Please specify --curl-dir=/path/to/built/libcurl解决办法
研究生新生培训第一周:深度学习和pytorch基础
The difference between asyncawait and promise
[semantic segmentation] setr_ Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer
Is flutter being quietly abandoned? On the future of flutter
初探fastJson的AutoType