Update README.md
Browse files
README.md
CHANGED
@@ -19,6 +19,8 @@ Different from the paper using ELECTRA, this model is finetuned on DeBERTaV3.
|
|
19 |
|
20 |
```
|
21 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
|
|
|
22 |
def sentence_cls_score(input_strings, predicate_cls_model, predicate_cls_tokenizer):
|
23 |
tokenized_cls_input = predicate_cls_tokenizer(input_strings, truncation=True, padding=True,
|
24 |
return_token_type_ids=True)
|
@@ -28,9 +30,12 @@ def sentence_cls_score(input_strings, predicate_cls_model, predicate_cls_tokeniz
|
|
28 |
prev_cls_output = predicate_cls_model(input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)
|
29 |
softmax_cls_output = torch.softmax(prev_cls_output.logits, dim=1, )
|
30 |
return softmax_cls_output
|
|
|
|
|
31 |
tokenizer = AutoTokenizer.from_pretrained("Inria-CEDAR/FactSpotter-DeBERTaV3-Small")
|
32 |
model = AutoModelForSequenceClassification.from_pretrained("Inria-CEDAR/FactSpotter-DeBERTaV3-Small")
|
33 |
model.to(torch.device("cuda"))
|
|
|
34 |
# pairs of texts (as premises) and triples (as hypotheses)
|
35 |
cls_texts = [("the aarhus is the airport of aarhus, denmark", "aarhus airport | city served | aarhus, denmark"),
|
36 |
("aarhus airport is 25.0 metres above the sea level", "aarhus airport | elevation above the sea level | 1174")]
|
|
|
19 |
|
20 |
```
|
21 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
22 |
+
|
23 |
+
|
24 |
def sentence_cls_score(input_strings, predicate_cls_model, predicate_cls_tokenizer):
|
25 |
tokenized_cls_input = predicate_cls_tokenizer(input_strings, truncation=True, padding=True,
|
26 |
return_token_type_ids=True)
|
|
|
30 |
prev_cls_output = predicate_cls_model(input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)
|
31 |
softmax_cls_output = torch.softmax(prev_cls_output.logits, dim=1, )
|
32 |
return softmax_cls_output
|
33 |
+
|
34 |
+
|
35 |
tokenizer = AutoTokenizer.from_pretrained("Inria-CEDAR/FactSpotter-DeBERTaV3-Small")
|
36 |
model = AutoModelForSequenceClassification.from_pretrained("Inria-CEDAR/FactSpotter-DeBERTaV3-Small")
|
37 |
model.to(torch.device("cuda"))
|
38 |
+
|
39 |
# pairs of texts (as premises) and triples (as hypotheses)
|
40 |
cls_texts = [("the aarhus is the airport of aarhus, denmark", "aarhus airport | city served | aarhus, denmark"),
|
41 |
("aarhus airport is 25.0 metres above the sea level", "aarhus airport | elevation above the sea level | 1174")]
|