MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / eval

Method eval

codegeex/mindspore/src/metrics.py:53–64  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

51 self.tokens_count += 1
52
53 def eval(self):
54 if not self.is_last_stage:
55 return 0
56 if self.tokens_count == 0:
57 print("Warning: tokens_count is 0")
58 return 0
59 val_loss = sum(self.PPL) / (self.tokens_count * self.data_length)
60 ppl = math.exp(min(20, val_loss))
61 # print("====" * 20 + " ppl end")
62 # print("====" * 20 + " ppl: {}".format(ppl))
63 # return ppl
64 return val_loss
65
66
67class ValidationLoss(Metric):

Callers 15

sample_sequence_batchFunction · 0.45
generate_samples_evalFunction · 0.45
sample_topk_tokensFunction · 0.45
nuclear_sample_tokensFunction · 0.45
sample_sequence_batchFunction · 0.45
evaluateFunction · 0.45
sample_sequence_batchFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by 4

mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36