当前位置:网站首页>预训练语言模型的使用方法
预训练语言模型的使用方法
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预训练模型库)
边栏推荐
- 2021-06-10
- 迁移学习——Transfer Joint Matching for Unsupervised Domain Adaptation
- The differences and reasons between MySQL with and without quotation marks when querying string types
- [competition website] collect machine learning / deep learning competition website (continuously updated)
- 【bug】XLRDError: Excel xlsx file; not supported
- Valuable blog and personal experience collection (continuous update)
- torch.nn.Parameter()函数理解
- Activity交互问题,你确定都知道?
- A preliminary study on fastjason's autotype
- 【Transformer】TransMix: Attend to Mix for Vision Transformers
猜你喜欢
【Transformer】TransMix: Attend to Mix for Vision Transformers
These process knowledge you must know
Anr Optimization: cause oom crash and corresponding solutions
[go] use of defer
【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
Flink, the mainstream real-time stream processing computing framework, is the first experience.
研究生新生培训第一周:深度学习和pytorch基础
备份谷歌或其他浏览器插件
PyTorch的数据读取机制
虚假新闻检测论文阅读(三):Semi-supervised Content-based Detection of Misinformation via Tensor Embeddings
随机推荐
虚假新闻检测论文阅读(四):A novel self-learning semi-supervised deep learning network to detect fake news on...
【目标检测】6、SSD
【DL】搭建卷积神经网络用于回归预测(数据+代码详细教程)
ROS常用指令
【pycharm】pycharm远程连接服务器
微信小程序源码获取(附工具的下载)
PyTorch基础知识(可入门)
Realize the scheduled backup of MySQL database in Linux environment through simple script (mysqldump command backup)
Transformer回顾+理解
Yum local source production
Configuration and use of Nacos external database
The difference between asyncawait and promise
Flink connector Oracle CDC synchronizes data to MySQL in real time (oracle19c)
【语义分割】SETR_Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer
Detailed explanation of MySQL statistical function count
ABSA1: Attentional Encoder Network for Targeted Sentiment Classification
【卷积核设计】Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs
[image classification] how to use mmclassification to train your classification model
【网络设计】ConvNeXt:A ConvNet for the 2020s
并发编程学习笔记 之 工具类Semaphore(信号量)