HYDARIM7 commited on
Commit
bb765a1
·
verified ·
1 Parent(s): d1d6f56

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -4
README.md CHANGED
@@ -28,7 +28,7 @@ WWM ensures that all subword tokens of a selected word are masked together, enco
28
 
29
  - **Developed by:** [Mohammad Mahdi Heydari Asl / infocube]
30
  - **Funded by [optional]:** [More Information Needed]
31
- - **Shared by:** [[HYDARIM7](https://huggingface.co/InfocubeSrl/LexCube)]
32
  - **Model type:** Transformer, BERT-based Masked Language Model
33
  - **Language(s) (NLP):** Italian
34
  - **License:** Apache-2.0
@@ -71,9 +71,11 @@ text = "La legge [MASK] approvata dal parlamento."
71
  inputs = tokenizer(text, return_tensors="pt")
72
  outputs = model(**inputs)
73
 
74
- mask_token_index = torch.where(inputs["input_ids"][0] == tokenizer.mask_token_id)[0]
75
- predicted_token_id = outputs.logits[0, mask_token_index].argmax(axis=-1)
76
- print("Prediction:", tokenizer.decode(predicted_token_id))
 
 
77
  ```
78
 
79
 
 
28
 
29
  - **Developed by:** [Mohammad Mahdi Heydari Asl / infocube]
30
  - **Funded by [optional]:** [More Information Needed]
31
+ - **Shared by:** [[HYDARIM7](https://huggingface.co/HYDARIM7)]
32
  - **Model type:** Transformer, BERT-based Masked Language Model
33
  - **Language(s) (NLP):** Italian
34
  - **License:** Apache-2.0
 
71
  inputs = tokenizer(text, return_tensors="pt")
72
  outputs = model(**inputs)
73
 
74
+ mask_index = (inputs["input_ids"][0] == tokenizer.mask_token_id).nonzero()[0]
75
+ predicted_id = outputs.logits[0, mask_index].argmax()
76
+ predicted_token = tokenizer.decode(predicted_id)
77
+
78
+ print("Prediction:", predicted_token)
79
  ```
80
 
81