eli4s commited on
Commit
5ed85ef
1 Parent(s): 516ac05

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -5
README.md CHANGED
@@ -27,12 +27,10 @@ import torch
27
  sentence = "Let's have a [MASK]."
28
 
29
  model.eval()
30
- encoded_inputs = tokenizer([sentence], padding='longest')
31
- input_ids = torch.tensor(encoded_inputs['input_ids'])
32
- attention_mask = torch.tensor(encoded_inputs['attention_mask'])
33
- output = model(input_ids, attention_mask=attention_mask)
34
 
35
- mask_index = input_ids.tolist()[0].index(103)
36
  masked_token = output['logits'][0][mask_index].argmax(axis=-1)
37
  predicted_token = tokenizer.decode(masked_token)
38
 
 
27
  sentence = "Let's have a [MASK]."
28
 
29
  model.eval()
30
+ inputs = tokenizer([sentence], padding='longest', return_tensors='pt')
31
+ output = model(inputs['input_ids'], attention_mask=inputs['attention_mask'])
 
 
32
 
33
+ mask_index = inputs['input_ids'].tolist()[0].index(103)
34
  masked_token = output['logits'][0][mask_index].argmax(axis=-1)
35
  predicted_token = tokenizer.decode(masked_token)
36