• bert fine tuning方法


    1、使用很小的学习率进行学习,且:

    for l in bert_model.layers:

      l.trainable = True

    2、由于bert模型巨大,我们每次训练只能取batch=4进行训练,而训练4个epoch之后,可以freeze bert模型,单独训练softmax

    for l in bert_model.layers:

      l.trainable = False

    __________________________________________________________________________________________________
    Layer (type) Output Shape Param # Connected to
    ==================================================================================================
    input_1 (InputLayer) (None, None) 0
    __________________________________________________________________________________________________
    input_2 (InputLayer) (None, None) 0
    __________________________________________________________________________________________________
    model_2 (Model) multiple 101677056 input_1[0][0]
    input_2[0][0]
    __________________________________________________________________________________________________
    lambda_1 (Lambda) (None, 768) 0 model_2[1][0]
    __________________________________________________________________________________________________
    dense_1 (Dense) (None, 50) 38450 lambda_1[0][0]
    ==================================================================================================
    Total params: 101,715,506
    Trainable params: 38,450
    Non-trainable params: 101,677,056

    调整学习率,单独训练几个epoch

    尤其是我们有一个类是其他,这种类别不确定的分类问题的时候,单独训练softmax有很大的帮助

  • 相关阅读:
    任意数字 保留 两位 小数 PHP
    在JavaScript中处理JSON数据 jquery js 定义 json 格式
    相对定位 绝对定位 relative absolute position 图片定位a标签
    oracle: listener.ora 、sqlnet.ora 、tnsnames.ora的配置及例子
    python
    python
    python-判断alter是否存在
    python-IE浏览器调用
    Python语言编写脚本时,对日期控件的处理方式
    python报错UnicodeDecodeError:
  • 原文地址:https://www.cnblogs.com/yjybupt/p/11881689.html
Copyright © 2020-2023  润新知