def METHOD_NAME(self, test_data, device, args):
    model = self.model
    model.to(device)
    model.eval()
    metrics = {"test_correct": 0, "test_loss": 0, "test_total": 0, "perplexity_loss": 0.}
    criterion = nn.CrossEntropyLoss().to(device)
    with torch.no_grad():
        for batch_idx, (x, _) in enumerate(test_data):
            # if args.mlm else (data, data)
            x, target = mask_tokens(
                x, self.tokenizer, args, device=device)
            x = x.to(device)
            target = target.to(device)
            outputs = model(x, labels=target)
            loss = outputs[0]
            outputs = model(x, labels=target)
            loss = outputs[0]
            test_loss = loss.data.item()
            perplexity_loss = loss.data.item()
            acc = accuracy(
                outputs[1].reshape(-1, outputs[1].shape[2]), target.reshape(-1), topk=(1, 5))
            correct = acc[0].item()
            top_5 = acc[1].item()
            metrics["test_correct"] += correct
            metrics["test_loss"] += test_loss * target.size(0)
            metrics["test_total"] += target.size(0)
            metrics["perplexity_loss"] += perplexity_loss * target.size(0)
    return metrics