MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / _train

Method _train

NLP/Text2SQL-BASELINE/text2sql/models/enc_dec.py:80–92  ·  view source on GitHub ↗

Args: inputs (TYPE): NULL labels (TYPE)

(self, inputs, labels)

Source from the content-addressed store, hash-verified

78 return self._inference(inputs, db)
79
80 def _train(self, inputs, labels):
81 """
82 Args:
83 inputs (TYPE): NULL
84 labels (TYPE)
85 """
86 enc_results = self.encoder(inputs)
87 lst_loss = []
88 for orig_inputs, label_info, enc_result in zip(inputs['orig_inputs'], labels, enc_results):
89 loss = self.decoder.compute_loss(orig_inputs, label_info, enc_result)
90 lst_loss.append(loss)
91
92 return paddle.mean(paddle.stack(lst_loss, axis=0), axis=0)
93
94 def _inference(self, inputs, db):
95 """

Callers 1

forwardMethod · 0.95

Calls 2

compute_lossMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected