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

Function CrossEntropy

codegeex/megatron/model/codegeex_model.py:116–124  ·  view source on GitHub ↗
(output, labels)

Source from the content-addressed store, hash-verified

114
115
116def CrossEntropy(output, labels):
117 labels, loss_mask = labels[0], labels[1]
118
119 args = get_args()
120
121 losses = mpu.vocab_parallel_cross_entropy(output.contiguous().float(), labels)
122 loss_mask = loss_mask.view(-1)
123 loss = torch.sum(losses.view(-1) * loss_mask) / loss_mask.sum()
124 return loss
125
126
127class CodeGeeXModelPipe(PipelineModule, MegatronModule):

Callers

nothing calls this directly

Calls 1

get_argsFunction · 0.90

Tested by

no test coverage detected