(text)
| 134 | from transformers.models.roberta.modeling_roberta import create_position_ids_from_input_ids |
| 135 | |
| 136 | def _encode(text): |
| 137 | encoded_input = tokenizer(text, max_length=args.sample_length, padding='max_length', truncation='only_first') |
| 138 | position_ids = create_position_ids_from_input_ids(torch.tensor([encoded_input['input_ids']]), 1, 0) |
| 139 | return dict(input_ids=encoded_input['input_ids'], position_ids=position_ids[0].numpy(), attention_mask=encoded_input['attention_mask']) |
| 140 | |
| 141 | import spacy |
| 142 |
nothing calls this directly
no outgoing calls
no test coverage detected