def __getitem__(self, index):
        """
        Generates one sample of data. We assume that the last column is label here. We use
        linecache to load files lazily.

        Args:
            index(int): Index of the test case.

        Returns(list, list, int): Returns the tokens, mask and label for a single item.

        """
        line = linecache.getline(self._filename, index + 1)
        row = next(csv.reader([line]))

        tokens = self._cast(row[0][1:-1].split(","))
        mask = self._cast(row[1][1:-1].split(","))

        data = {
            "token_ids": torch.tensor(tokens, dtype=torch.long),
            "input_mask": torch.tensor(mask, dtype=torch.long),
            "labels": torch.tensor(int(row[2]), dtype=torch.long),
        }

        return data

        Generates one sample of data. We assume that the last column is label here. We use
        linecache to load files lazily.

        Args:
            index(int): Index of the test case.

        Returns(list, list, int): Returns the tokens, mask and label for a single item.

        
utils_nlp/models/bert/common.py