fix CausalLM
Browse files- modeling_ltgbert.py +3 -2
modeling_ltgbert.py
CHANGED
@@ -415,7 +415,7 @@ class LtgbertForMaskedLM(LtgbertModel):
|
|
415 |
|
416 |
sequence_output, contextualized_embeddings, attention_probs = self.get_contextualized_embeddings(input_ids, attention_mask)
|
417 |
subword_prediction = self.classifier(sequence_output)
|
418 |
-
subword_prediction[:, :, :16+1] = float("-inf")
|
419 |
|
420 |
masked_lm_loss = None
|
421 |
if labels is not None:
|
@@ -494,6 +494,7 @@ class LtgbertForCausalLM(LtgbertModel):
|
|
494 |
input_ids: torch.LongTensor = None,
|
495 |
attention_mask: Optional[torch.Tensor] = None,
|
496 |
position_ids: Optional[torch.LongTensor] = None,
|
|
|
497 |
past_key_values = None,
|
498 |
inputs_embeds: Optional[torch.FloatTensor] = None,
|
499 |
labels: Optional[torch.LongTensor] = None,
|
@@ -511,7 +512,7 @@ class LtgbertForCausalLM(LtgbertModel):
|
|
511 |
|
512 |
sequence_output, contextualized_embeddings, attention_probs = self.get_contextualized_embeddings(input_ids, attention_mask)
|
513 |
subword_prediction = self.classifier(sequence_output)
|
514 |
-
subword_prediction[:, :, :16+1] = float("-inf")
|
515 |
|
516 |
masked_lm_loss = None
|
517 |
if labels is not None:
|
|
|
415 |
|
416 |
sequence_output, contextualized_embeddings, attention_probs = self.get_contextualized_embeddings(input_ids, attention_mask)
|
417 |
subword_prediction = self.classifier(sequence_output)
|
418 |
+
# subword_prediction[:, :, :16+1] = float("-inf")
|
419 |
|
420 |
masked_lm_loss = None
|
421 |
if labels is not None:
|
|
|
494 |
input_ids: torch.LongTensor = None,
|
495 |
attention_mask: Optional[torch.Tensor] = None,
|
496 |
position_ids: Optional[torch.LongTensor] = None,
|
497 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
498 |
past_key_values = None,
|
499 |
inputs_embeds: Optional[torch.FloatTensor] = None,
|
500 |
labels: Optional[torch.LongTensor] = None,
|
|
|
512 |
|
513 |
sequence_output, contextualized_embeddings, attention_probs = self.get_contextualized_embeddings(input_ids, attention_mask)
|
514 |
subword_prediction = self.classifier(sequence_output)
|
515 |
+
# subword_prediction[:, :, :16+1] = float("-inf")
|
516 |
|
517 |
masked_lm_loss = None
|
518 |
if labels is not None:
|