a58bb4244b3b5ffbf7ffb1994926fcbe8cfa0c1d,src/trainer.py,SamplingMultiTaskTrainer,_validate,#SamplingMultiTaskTrainer#Any#Any#Any#Any#Any#Any#Any#,515
Before Change
log.info("Batch %d/%d: %s", batch_num, n_val_batches, description)
task_info["last_log"] = time.time()
if "labels" in batch:
n_examples += batch["labels"].size()[0]
elif "targs" in batch:
n_examples += batch["targs"]["words"].nelement()
assert batch_num == n_val_batches
// Get task validation metrics and store in all_val_metrics
task_metrics = task.get_metrics(reset=True)
for name, value in task_metrics.items():
all_val_metrics["%s_%s" % (task.name, name)] = value
all_val_metrics["%s_loss" % task.name] /= batch_num // n_val_batches
all_val_metrics["micro_avg"] += \
all_val_metrics[task.val_metric] * n_examples
all_val_metrics["macro_avg"] += \
all_val_metrics[task.val_metric]
n_examples_overall += n_examples
// Reset training progress
task_info["n_batches_since_val"] = 0
task_info["loss"] = 0
all_val_metrics["micro_avg"] /= n_examples_overall
all_val_metrics["macro_avg"] /= len(tasks)
// Track per task patience
After Change
out = self._forward(batch, task=task, for_training=False)
loss = out["loss"]
all_val_metrics["%s_loss" % task.name] += loss.data.cpu().numpy()
n_examples += out["n_exs"]
// log
if time.time() - task_info["last_log"] > self._log_interval:
task_metrics = task.get_metrics()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: jsalt18-sentence-repl/jiant
Commit Name: a58bb4244b3b5ffbf7ffb1994926fcbe8cfa0c1d
Time: 2018-07-05
Author: wang.alex.c@gmail.com
File Name: src/trainer.py
Class Name: SamplingMultiTaskTrainer
Method Name: _validate
Project Name: tensorly/tensorly
Commit Name: f41ae3bce45a4cf2f101d610704838d335b1f586
Time: 2018-02-03
Author: csw@amazon.com
File Name: tensorly/backend/pytorch_backend.py
Class Name:
Method Name: where
Project Name: jsalt18-sentence-repl/jiant
Commit Name: a58bb4244b3b5ffbf7ffb1994926fcbe8cfa0c1d
Time: 2018-07-05
Author: wang.alex.c@gmail.com
File Name: src/evaluate.py
Class Name:
Method Name: evaluate