MCPcopy Create free account
hub / github.com/MichSchli/AVeriTeC / validation_step

Method validation_step

models/NaiveSeqClassModule.py:64–80  ·  view source on GitHub ↗
(self, batch, batch_idx)

Source from the content-addressed store, hash-verified

62 self.log('train_f1_epoch', self.train_f1)
63
64 def validation_step(self, batch, batch_idx):
65 x, x_mask, y = batch
66
67 outputs = self(x, attention_mask=x_mask, labels=y)
68 logits = outputs.logits
69 loss = outputs.loss
70
71 preds = torch.argmax(logits, axis=1)
72
73 if not self.use_question_stance_approach:
74 self.val_acc(preds, y)
75 self.log('val_acc_step', self.val_acc)
76
77 self.val_f1(preds, y)
78 self.log("val_loss", loss)
79
80 return {'val_loss':loss, "src": x, "pred": preds, "target": y}
81
82 def validation_epoch_end(self, outs):
83 if self.use_question_stance_approach:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected