MCPcopy Create free account
hub / github.com/awslabs/gap-text2sql / eval_on_batch

Method eval_on_batch

rat-sql-gap/seq2struct/models/enc_dec.py:111–115  ·  view source on GitHub ↗
(self, batch)

Source from the content-addressed store, hash-verified

109 return torch.mean(torch.stack(losses, dim=0), dim=0)
110
111 def eval_on_batch(self, batch):
112 mean_loss = self.compute_loss(batch).item()
113 batch_size = len(batch)
114 result = {'loss': mean_loss * batch_size, 'total': batch_size}
115 return result
116
117 def begin_inference(self, orig_item, preproc_item):
118 ## TODO: Don't hardcode train

Callers 1

_eval_modelMethod · 0.80

Calls 1

compute_lossMethod · 0.45

Tested by

no test coverage detected