eli4s commited on
Commit
63245ee
1 Parent(s): 0460b94

Update README.md

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