A: Same as you would do without it enabled except without using learning rate dropout which is not needed with AB enabled.
Whether you're starting to pretrain a new model, starting training on a pretrained model or want to carry on training with old model but use AdaBelief to improve quality of your fakes enable it and remember to never turn it off once it's enabled.
Don't use LRD, this option should disable itself but just to be sure run your model once, disable LRD, save and then start it again, select Y to enable AdaBelief optimizer and pretrain or train as usual.
There is no need to enable LRD before GAN, once you've disabled RW and are ready to start GAN simply enable it, no need to run LRD and wait for the model to reach lower loss, AB will ensure the model trains more accurately and naturally reaches lower loss values.
If it's a pretrained model or one that was heavily trained before and you want to use it with AB make sure to enable it and RW, let the model relearn everything, if you instead just enable AB and carry on with RW disabled or some other options enabled it may not improve or it will get worse.
"without using learning rate dropout which is not needed with AB enabled"
源码验证:代码中 AdaBelief 和 RMSprop 都接受lr_dropout参数,并没有自动互斥。但从算法原理看:
AdaBelief 的 (g - m_t)² 已经对每个参数做了自适应步长归一化-------梯度稳定的参数自动获得大步长,梯度波动的参数自动获得小步长
LRD 通过随机置零 70% 参数的更新来制造稀疏性,本质是一种正则化 + 锐化手段
AdaBelief 的自适应特性已经部分覆盖了 LRD 的 "精细调节" 作用,两者叠加反而可能导致更新过于稀疏、收敛变慢 "never turn it off once it's enabled"
源码层面的根本原因 ------优化器状态文件不兼容:
AdaBelief 的 src_dst_opt.npy 保存:iterations + ms_dict(m_t) + vs_dict(v_t)
RMSprop 的 src_dst_opt.npy 保存:iterations + accumulators_dict(a)
他的加载逻辑中,如果从 AdaBelief 切回 RMSprop,RMSprop 找不到对应的 accumulator 变量,load_weights()会失败-----触发init_weights()---优化器状态从零开始
动量从零开始意味着模型失去了之前累积的梯度方向信息,训练会出现明显的质量回退 "this option should disable itself but just to be sure run your model once, disable LRD, save and then start it again"
源码验证:当前版本并没有自动禁用 LRD的逻辑。问答中的 "should disable itself" 更像是一种经验性建议或旧版本行为。安全做法确实是手动确认:
启动训练--------进入选项询问→将 LRD 设为'n'
保存配置后退出
重新启动,确认 LRD 为'n'后再开始训练 "There is no need to enable LRD before GAN"
因为 AdaBelief 本身就能让模型 "更准确、自然地达到更低 loss"(问答原文)。 "If it's a pretrained model... make sure to enable it and RW, let the model relearn everything"
源码层面的原因:
优化器状态重置:从 RMSprop 切换到 AdaBelief 时,ms_dict和vs_dict都是全新初始化的零值,相当于优化器 "失忆"
random_warp 的作用,源码中明确说明:"Random warp is required to generalize facial expressions"---- 在数据增强下重新训练,让模型在更丰富的样本分布中重新适应 AdaBelief 的更新动态
如果 RW 关闭直接切:模型在固定的、无扭曲的样本分布上用一个 "失忆" 的优化器微调,AdaBelief 的二阶动量需要数千次迭代才能积累到有意义的值,这段时间内模型可能出现不稳定或质量下降
总结:源码层面的操作建议
全新训练 adabelief=True, lr_dropout='n' 默认就是这样,直接训练即可
从 RMSprop 旧模型切换 开启 AdaBelief + 保持 RW=True 优化器状态会重置,需要重新 warm up
预训练 代码自动强制 LRD='n', RW=False, GAN=0 预训练结束后切回正常训练时 iter 会归零
开启 GAN 确保 LRD='n', RW=False GAN 判别器也用同一个优化器类