当前位置:网站首页>预训练语言模型的使用方法
预训练语言模型的使用方法
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预训练模型库)
边栏推荐
- MySql统计函数COUNT详解
- [ml] PMML of machine learning model -- Overview
- Flink connector Oracle CDC synchronizes data to MySQL in real time (oracle19c)
- Ribbon学习笔记二
- 【图像分类】如何使用 mmclassification 训练自己的分类模型
- Centos7 silently installs Oracle
- 第三周周报 ResNet+ResNext
- 虚假新闻检测论文阅读(一):Fake News Detection using Semi-Supervised Graph Convolutional Network
- 微信小程序源码获取(附工具的下载)
- 【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
猜你喜欢

Lock lock of concurrent programming learning notes and its implementation basic usage of reentrantlock, reentrantreadwritelock and stampedlock

微信小程序源码获取(附工具的下载)

【Attention】Visual Attention Network

GA-RPN:引导锚点的建议区域网络

主流实时流处理计算框架Flink初体验。

Android Studio 实现登录注册-源代码 (连接MySql数据库)

迁移学习——Transitive Transfer Learning

Ribbon learning notes II

Ribbon learning notes 1

ROS常用指令
随机推荐
Spring, summer, autumn and winter with Miss Zhang (3)
迁移学习——Transfer Joint Matching for Unsupervised Domain Adaptation
[semantic segmentation] overview of semantic segmentation
并发编程学习笔记 之 工具类Semaphore(信号量)
Operation commands in anaconda, such as removing old environment, adding new environment, viewing environment, installing library, cleaning cache, etc
Detailed explanation of atomic operation classes atomicreference and atomicstampedreference in learning notes of concurrent programming
Spring, summer, autumn and winter with Miss Zhang (1)
迁移学习—— Transfer Feature Learning with Joint Distribution Adaptation
[convolution kernel design] scaling up your kernels to 31x31: revising large kernel design in CNN
一、Focal Loss理论及代码实现
【Transformer】TransMix: Attend to Mix for Vision Transformers
虚假新闻检测论文阅读(一):Fake News Detection using Semi-Supervised Graph Convolutional Network
【Attention】Visual Attention Network
简单聊聊 PendingIntent 与 Intent 的区别
主流实时流处理计算框架Flink初体验。
[tensorrt] convert pytorch into deployable tensorrt
Exploration of flutter drawing skills: draw arrows together (skill development)
Flutter 绘制技巧探索:一起画箭头(技巧拓展)
Rsync+inotyfy realize real-time synchronization of single data monitoring
【bug】XLRDError: Excel xlsx file; not supported