Hello everyone,
I am working on sequence classification where I have created my own Dataset class and using that to train.
Here is the dataset class:
class BERTDataset:
    
    def __init__(self, input_ids, attention_masks, token_type_ids, targets):
        self.input_ids = input_ids
        self.attention_masks = attention_masks
        self.token_type_ids = token_type_ids
        self.targets = targets
        
    def __getitem__(self, index):
        ids = torch.tensor(self.input_ids, dtype=torch.long)
        masks = torch.tensor(self.attention_masks, dtype=torch.long)
        token_type_ids = torch.tensor(self.token_type_ids, dtype=torch.long)
        targets = torch.tensor(self.targets, dtype=torch.long)
        
        return {
            'ids': ids,
            'mask': masks,
            'token_type_ids': token_type_ids,
            'targets': self.targets[index]
        }
    
    def __len__(self,):
        return len(self.input_ids)

The way I fetching for train is as follows:
model.train()

y_preds = []

for epoch in range(epochs):
    for i, sample in enumerate(train_dataloader):
        ids = sample["ids"]
        masks = sample["mask"]
        token_type_ids = sample["token_type_ids"]
        target = sample["targets"]
        
        ids = ids.to(device, dtype=torch.long)
        masks = masks.to(device, dtype=torch.long)
        token_type_ids = token_type_ids.to(device, dtype=torch.long)
        target = target.to(device, dtype=torch.long)
        
        y_pred = model(tokens,
                      masks,
                      token_type_ids)

I am getting the following error: too many values to unpack (expected 2)
This is for the last line where I am calculating y_pred from model() object.
What am I missing here?