|
发表于 2022-8-10 20:36:08
|
显示全部楼层
本帖最后由 wtxx8888 于 2022-8-10 21:02 编辑
可以单独偷来这个选项的我偷到了猫汉化上。
1号文件 "_internal\DeepFaceLab\models\ModelBase.py" 插入两处
self.retraining_samples = self.options.get('retraining_samples', False)
def ask_retraining_samples(self, default_value=False):
default_retraining_samples = self.load_or_def_option('retraining_samples', default_value)
self.options['retraining_samples'] = io.input_bool("ME版选项 周期性训练 高LOSS脸图样本 (retraining_samples)", default_retraining_samples, help_message="打开这个选项 将会周期性训练 高LOSS脸图样本")
2号文件 "_internal\DeepFaceLab\models\Model_SAEHD\Model.py" 插入3处
self.ask_retraining_samples()
if self.options['retraining_samples']:
self.last_src_samples_loss = []
self.last_dst_samples_loss = []
if self.options['retraining_samples']:
bs = self.get_batch_size()
for i in range(bs):
self.last_src_samples_loss.append ( (target_src, target_srcm, target_srcm_em, src_loss ) )
self.last_dst_samples_loss.append ( (target_dst, target_dstm, target_dstm_em, dst_loss ) )
if len(self.last_src_samples_loss) > bs*9:
src_samples_loss = sorted(self.last_src_samples_loss, key=operator.itemgetter(3), reverse=True)
dst_samples_loss = sorted(self.last_dst_samples_loss, key=operator.itemgetter(3), reverse=True)
target_src = np.stack( [ x[0] for x in src_samples_loss[:bs] ] )
target_srcm = np.stack( [ x[1] for x in src_samples_loss[:bs] ] )
target_srcm_em = np.stack( [ x[2] for x in src_samples_loss[:bs] ] )
target_dst = np.stack( [ x[0] for x in dst_samples_loss[:bs] ] )
target_dstm = np.stack( [ x[1] for x in dst_samples_loss[:bs] ] )
target_dstm_em = np.stack( [ x[2] for x in dst_samples_loss[:bs] ] )
src_loss, dst_loss = self.src_dst_train (target_src, target_src, target_srcm, target_srcm_em, target_dst, target_dst, target_dstm, target_dstm_em)
self.last_src_samples_loss = []
self.last_dst_samples_loss = []
看截图行数插进去,DX12可能跟20系行数不一样,附近语句我也截进图里了。
if len(self.last_src_samples_loss) > bs*9: 这句的数字9,代表隔几次迭代跑一次大LOSS,你可以自定间隔,ME版是16,我定的9。
|
评分
-
查看全部评分
|