Make loss calculation possible during eval mode
#7
by
tanaymehta
- opened
- 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()
|