tanaymehta commited on
Commit
68c8d4a
·
verified ·
1 Parent(s): 38fc872

Make loss calculation possible during eval mode

Browse files

Previously, the loss was 0.0 during eval model which was faulty. Now the loss will be calculated during both training and eval modes.

Files changed (1) hide show
  1. modeling_pharia.py +1 -1
modeling_pharia.py CHANGED
@@ -771,7 +771,7 @@ class PhariaForCausalLM(PhariaPreTrainedModel):
771
  "You have to specify the `labels` tensor when training the model."
772
  )
773
 
774
- if self.training and labels is not None:
775
  # Shift logits and labels for causal language modeling
776
  shift_logits = logits[..., :-1, :].contiguous()
777
  shift_labels = labels[..., 1:].contiguous()
 
771
  "You have to specify the `labels` tensor when training the model."
772
  )
773
 
774
+ if labels is not None:
775
  # Shift logits and labels for causal language modeling
776
  shift_logits = logits[..., :-1, :].contiguous()
777
  shift_labels = labels[..., 1:].contiguous()