I am having the same issue when applying the loss function in this GitHub:
  
      github.com
  
  
    alexa/dialoglue/blob/master/bert_models.py 5
import torch
import torch.nn.functional as F

from collections import defaultdict
from torch import nn
from torch.nn import CrossEntropyLoss, NLLLoss 
from torch.nn import Dropout
from transformers import BertConfig, BertModel, BertForMaskedLM
from typing import Any

class BertPretrain(torch.nn.Module):
    def __init__(self,
                 model_name_or_path: str):
        super(BertPretrain, self).__init__()
        self.bert_model = BertForMaskedLM.from_pretrained(model_name_or_path)

    def forward(self, 
                input_ids: torch.tensor,
                mlm_labels: torch.tensor):
        outputs = self.bert_model(input_ids, masked_lm_labels=mlm_labels)


  This file has been truncated. show original

  
  
    
    
  
  


I have tried changing the types by no luck. what do you think the issue is
Screen Shot 2021-04-20 at 10.14.36 PM|690x254 14