JonasGeiping commited on
Commit
94dcd7c
·
verified ·
1 Parent(s): adef816

Update raven_modeling_minimal.py

Browse files
Files changed (1) hide show
  1. raven_modeling_minimal.py +1 -1
raven_modeling_minimal.py CHANGED
@@ -431,7 +431,7 @@ class RavenForCausalLM(RavenPreTrainedModel, GenerationMixin):
431
  if labels is not None:
432
  logits = self.lm_head(x).float()
433
  loss = torch.nn.functional.cross_entropy(logits.view(-1, logits.shape[-1]), labels.view(-1))
434
- log_ppl = loss.clone().detach()
435
  else:
436
  logits = self.lm_head(x).float()
437
  loss, log_ppl = torch.as_tensor(0.0), torch.as_tensor(0.0)
 
431
  if labels is not None:
432
  logits = self.lm_head(x).float()
433
  loss = torch.nn.functional.cross_entropy(logits.view(-1, logits.shape[-1]), labels.view(-1))
434
+ log_ppl = loss.clone().detach().exp()
435
  else:
436
  logits = self.lm_head(x).float()
437
  loss, log_ppl = torch.as_tensor(0.0), torch.as_tensor(0.0)