update readme
Browse files
README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
| 1 |
---
|
| 2 |
license: afl-3.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: afl-3.0
|
| 3 |
---
|
| 4 |
+
```
|
| 5 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 6 |
+
|
| 7 |
+
# load model
|
| 8 |
+
model = AutoModelForSequenceClassification.from_pretrained('dmrau/bow-bert')
|
| 9 |
+
# load tokenizer
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
|
| 11 |
+
|
| 12 |
+
# tokenize query and passage and concatenate them
|
| 13 |
+
inp = tokenizer(['this is a query'], ['this is a passage'], return_tensors='pt')
|
| 14 |
+
|
| 15 |
+
# get estimated score
|
| 16 |
+
print('score', model(**inp).logits[:, 1])
|
| 17 |
+
|
| 18 |
+
```
|