1082ba352c5f1d524b1fcba43ee611280b169224,fairseq/trainer.py,Trainer,valid_step,#Trainer#Any#,310
Before Change
logging_outputs = [logging_output]
// aggregate stats and logging outputs
ntokens = sum(log.get("ntokens", 0) for log in logging_outputs)
grad_denom = self.criterion.__class__.grad_denom(sample_sizes)
agg_logging_output = self.criterion.__class__.aggregate_logging_outputs(logging_outputs)
After Change
self.model.eval()
logging_output, sample_size = {}, 0
with torch.no_grad():
sample = self._prepare_sample(sample)
if sample is None:
sample = self._prepare_sample(self._dummy_batch)
_loss, sample_size, logging_output = self.task.get_loss(
self.model, self.criterion, sample,
)
// gather logging outputs from all replicas
if self.args.distributed_world_size > 1:
logging_output, sample_size = zip(*distributed_utils.all_gather_list(
[logging_output, sample_size],
))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: pytorch/fairseq
Commit Name: 1082ba352c5f1d524b1fcba43ee611280b169224
Time: 2018-09-25
Author: edunov@apache.org
File Name: fairseq/trainer.py
Class Name: Trainer
Method Name: valid_step
Project Name: huggingface/neuralcoref
Commit Name: 70cab1d286a8717185e5b342f1923a80fc9a90a0
Time: 2019-10-22
Author: svlandeg@users.noreply.github.com
File Name: neuralcoref/train/evaluator.py
Class Name: ConllEvaluator
Method Name: get_max_score