tanaymehta
commited on
Make loss calculation possible during eval mode
Browse filesPreviously, the loss was 0.0 during eval model which was faulty. Now the loss will be calculated during both training and eval modes.
- 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
|
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()
|