【发布时间】:2021-05-23 05:13:04
【问题描述】:
在 PyTorch Lighting 中将我的验证丢失记录在 validation_step() 中时,如下所示:
def validation_step(self, batch: Tuple[Tensor, Tensor], _batch_index: int) -> None:
inputs_batch, labels_batch = batch
outputs_batch = self(inputs_batch)
loss = self.criterion(outputs_batch, labels_batch)
self.log('loss (valid)', loss.item())
然后,我得到一个 epoch-wise 损失曲线:
如果我想要逐步损失曲线,我可以设置on_step=True:
def validation_step(self, batch: Tuple[Tensor, Tensor], _batch_index: int) -> None:
inputs_batch, labels_batch = batch
outputs_batch = self(inputs_batch)
loss = self.criterion(outputs_batch, labels_batch)
self.log('loss', loss.item(), on_step=True)
这会导致每个时期的逐步损失曲线:
我怎样才能获得所有时期的单一图表?当我运行数千个时期的训练时,这会变得混乱。
【问题讨论】: