Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LX)
- import torch
- from pytorch_transformers import RobertaTokenizer, RobertaForSequenceClassification
- # RoBERTa tokenizer and model loaded from saved checkpoint
- tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
- model = RobertaForSequenceClassification.from_pretrained("roberta-base")
- # Sequence encoded with the correct special separation tokens
- sequence_0 = "Is this Jacksonville?"
- sequence_1 = "No it is not."
- input_ids = torch.tensor([tokenizer.encode(sequence_0, sequence_l, add_special_tokens=True)])
- # Returns the loss and the associated logits
- output = model(input_ids)
Advertisement
Add Comment
Please, Sign In to add comment