计算火车历元函数的损失

问题描述

in train_epoch function

我们有三种损失

  1. 损失
  2. 批次损失
  3. train_loss

据我所知,损失是张量,批次损失是张量的值,train_loss是batch_loss的累积值,对我来说是可以的。

我的问题是,为什么AllenNLP考虑批次中的batch_loss而没有计算batch_group的累积损失?

我也不了解在纪元内需要batch_group,在batch_group内需要批处理

这是我的理解 我们里面有一个纪元,我们在batch_group中有一个batch_group我们有一个批次batch_loss是为批次计算的,而不是不是batch_group为什么?

解决方法

我的问题是,为什么AllenNLP考虑批次中的batch_loss而没有计算batch_group的累积损失?

这实际上是一个错误,因此感谢您指出!现在有一个PR可以修复它:https://github.com/allenai/allennlp/pull/4706

我也不了解在纪元内对batch_group的需要,并且 批处理组内的批处理

batch_group始终仅由一个batch组成,除非您使用的num_gradient_accumulation_steps大于1,即使用的是梯度累积,这是一种获得更大有效值的方法批次大小。

例如,参见https://medium.com/ai2-blog/tutorial-training-on-larger-batches-with-less-memory-in-allennlp-1cd2047d92ad

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...