FrankC0st1e commited on
Commit
fc345c8
1 Parent(s): 65d6b09

fix loss in modeling_minicpm.py

Browse files
Files changed (1) hide show
  1. modeling_minicpm.py +1 -1
modeling_minicpm.py CHANGED
@@ -1343,7 +1343,7 @@ class MiniCPM3ForCausalLM(MiniCPM3PreTrainedModel):
1343
  shift_logits = logits[..., :-1, :].contiguous()
1344
  shift_labels = labels[..., 1:].contiguous()
1345
  # Flatten the tokens
1346
- loss_fct = CrossEntropyLoss(reduction="none")
1347
  shift_logits = shift_logits.view(-1, self.config.vocab_size)
1348
  shift_labels = shift_labels.view(-1)
1349
  # Enable model parallelism
 
1343
  shift_logits = logits[..., :-1, :].contiguous()
1344
  shift_labels = labels[..., 1:].contiguous()
1345
  # Flatten the tokens
1346
+ loss_fct = CrossEntropyLoss()
1347
  shift_logits = shift_logits.view(-1, self.config.vocab_size)
1348
  shift_labels = shift_labels.view(-1)
1349
  # Enable model parallelism