|
发表于 2024-8-9 23:00:49
|
显示全部楼层
本帖最后由 wtxx8888 于 2024-8-9 23:46 编辑
1,"DeepFaceLab\_internal\DeepFaceLab\models\ModelBase.py" 文件的
def should_save_preview_history(self):
return (not io.is_colab() and self.iter % 10 == 0) or (io.is_colab() and self.iter % 100 == 0)
解释: 不是colab环境,迭代数被10整除. colab环境,迭代数被100整除。
2,"DeepFaceLab\_internal\DeepFaceLab\models\Model_SAEHD\Model.py" 文件的
def should_save_preview_history(self):
return (not io.is_colab() and self.iter % ( 10*(max(1,self.resolution // 64)) ) == 0) or \
(io.is_colab() and self.iter % 100 == 0)
解释: 不是colab环境 ,迭代数整除 (10乘以,后面两数的最大值,1 或 分辨率整除64), colab环境,需要被100整除
上代码,触发下代码,是否进行记录。
"DeepFaceLab\_internal\DeepFaceLab\models\ModelBase.py" 文件的
def train_one_iter(self):
iter_time = time.time()
losses = self.onTrainOneIter()
iter_time = time.time() - iter_time
self.loss_history.append ( [float(loss[1]) for loss in losses] )
if self.should_save_preview_history():
plist = []
if io.is_colab():
previews = self.get_previews()
for i in range(len(previews)):
name, bgr = previews
plist += [ (bgr, self.get_strpath_storage_for_file('preview_%s.jpg' % (name) ) ) ]
if self.write_preview_history:
previews = self.get_history_previews()
for i in range(len(previews)):
name, bgr = previews
path = self.preview_history_path / name
plist += [ ( bgr, str ( path / ( f'{self.iter:07d}.jpg') ) ) ]
if not io.is_colab():
plist += [ ( bgr, str ( path / ( '_last.jpg' ) )) ]
if len(plist) != 0:
self.get_preview_history_writer().post(plist, self.loss_history, self.iter)
self.iter += 1
return self.iter, iter_time
解释不一定对,哈哈。
大概应该是这个。。。学的是C/C++, Python 只能看懂大概
个人意见是,改红字分辨率那个,你50存盘,应该用的是10X5 (320 左右的丹整除64等5,然后5乘以10,可不就50次迭代,一存盘喽)
把64改小,即可提高预览图的存盘间隔。
|
|