import torch


def preprocess(tokens, tokenizer):
    """ Preprocess the sentence by tokenizing and converting to tensor. """
    tok_ids = tokenizer.convert_tokens_to_ids(tokens)
    tok_tensor = torch.tensor([tok_ids]).cuda() # pylint: disable=not-callable
    return tok_tensor