Commit ·
2e1b617
1
Parent(s): 1a527c7
Update README.md
Browse files
README.md
CHANGED
|
@@ -22,16 +22,16 @@ This is a mbert-based model for multiple-choice question answering.
|
|
| 22 |
Here is an example of how you can run this model:
|
| 23 |
|
| 24 |
```python
|
| 25 |
-
from transformers import
|
| 26 |
-
|
| 27 |
-
model_name = "persiannlp/mbert-base-parsinlu-multiple-choice"
|
| 28 |
-
tokenizer = BertTokenizer.from_pretrained(model_name)
|
| 29 |
-
model = BertModel.from_pretrained(model_name)
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def run_model(input_string):
|
| 33 |
input_ids = tokenizer(input_string, return_tensors="pt")
|
| 34 |
-
output = model(input_ids)
|
| 35 |
print(output)
|
| 36 |
return output
|
| 37 |
|
|
|
|
| 22 |
Here is an example of how you can run this model:
|
| 23 |
|
| 24 |
```python
|
| 25 |
+
from transformers import AutoConfig, AutoModelForMultipleChoice, AutoTokenizer
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
model_name = "mbert-base-parsinlu-multiple-choice"
|
| 28 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 29 |
+
config = AutoConfig.from_pretrained(model_name)
|
| 30 |
+
model = AutoModelForMultipleChoice.from_pretrained(model_name, config = config)
|
| 31 |
|
| 32 |
def run_model(input_string):
|
| 33 |
input_ids = tokenizer(input_string, return_tensors="pt")
|
| 34 |
+
output = model(input_ids['input_ids'])
|
| 35 |
print(output)
|
| 36 |
return output
|
| 37 |
|