chujiezheng
commited on
Commit
•
881e7fc
1
Parent(s):
d805257
Update README.md
Browse files
README.md
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
import torch
|
5 |
from transformers.models.bert import BertTokenizer, BertForSequenceClassification
|
6 |
|
7 |
-
tokenizer = BertTokenizer.from_pretrained('
|
8 |
-
model = BertForSequenceClassification.from_pretrained('
|
9 |
model.eval()
|
10 |
|
11 |
turn1 = [
|
@@ -22,7 +22,7 @@ text2 = turn2[1]
|
|
22 |
model_input = tokenizer(text1, text2, return_tensors='pt', return_token_type_ids=True, return_attention_mask=True)
|
23 |
model_output = model(**model_input, return_dict=False)
|
24 |
prediction = torch.argmax(model_output[0].cpu(), dim=-1)[0].item()
|
25 |
-
print(prediction) # 0 for non-contradiction, 1 for contradiction
|
26 |
```
|
27 |
|
28 |
This fine-tuned model obtains 75.7 accuracy and 72.3 macro-F1 on the test set.
|
|
|
4 |
import torch
|
5 |
from transformers.models.bert import BertTokenizer, BertForSequenceClassification
|
6 |
|
7 |
+
tokenizer = BertTokenizer.from_pretrained('thu-coai/roberta-base-cdconv')
|
8 |
+
model = BertForSequenceClassification.from_pretrained('thu-coai/roberta-base-cdconv')
|
9 |
model.eval()
|
10 |
|
11 |
turn1 = [
|
|
|
22 |
model_input = tokenizer(text1, text2, return_tensors='pt', return_token_type_ids=True, return_attention_mask=True)
|
23 |
model_output = model(**model_input, return_dict=False)
|
24 |
prediction = torch.argmax(model_output[0].cpu(), dim=-1)[0].item()
|
25 |
+
print(prediction) # output 1. 0 for non-contradiction, 1 for contradiction
|
26 |
```
|
27 |
|
28 |
This fine-tuned model obtains 75.7 accuracy and 72.3 macro-F1 on the test set.
|