Update README.md
Browse files
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/
|
| 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 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
| 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 |
|