guihu commited on
Commit
ba1e592
1 Parent(s): 2ec841c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md CHANGED
@@ -1,3 +1,61 @@
1
  ---
2
  license: mit
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ datasets:
4
+ - web_nlg
5
+ language:
6
+ - en
7
  ---
8
+ # Model card for Inria-CEDAR/FactSpotter-DeBERTaV3-Large
9
+
10
+ ## Model description
11
+
12
+ This model is related to the paper **"FactSpotter: Evaluating the Factual Faithfulness of Graph-to-Text Generation"**.
13
+
14
+ Given a triple of format "subject | predicate | object" and a text, the model determines if the triple is present in the text.
15
+
16
+ ## How to use the model
17
+
18
+ ```
19
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
20
+
21
+ def sentence_cls_score(input_strings, predicate_cls_model, predicate_cls_tokenizer):
22
+ tokenized_cls_input = predicate_cls_tokenizer(input_strings, truncation=True, padding=True,
23
+ return_token_type_ids=True)
24
+ input_ids = torch.Tensor(tokenized_cls_input['input_ids']).long().to(torch.device("cuda"))
25
+ token_type_ids = torch.Tensor(tokenized_cls_input['token_type_ids']).long().to(torch.device("cuda"))
26
+ attention_mask = torch.Tensor(tokenized_cls_input['attention_mask']).long().to(torch.device("cuda"))
27
+ prev_cls_output = predicate_cls_model(input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)
28
+ softmax_cls_output = torch.softmax(prev_cls_output.logits, dim=1, )
29
+ return softmax_cls_output
30
+
31
+ tokenizer = AutoTokenizer.from_pretrained("Inria-CEDAR/FactSpotter-DeBERTaV3-Large")
32
+ model = AutoModelForSequenceClassification.from_pretrained("Inria-CEDAR/FactSpotter-DeBERTaV3-Large")
33
+
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")]
37
+ cls_scores = sentence_cls_score(cls_texts, model, tokenizer)
38
+ # Dimensions: 0-entailment, 1-neutral, 2-contradiction
39
+ label_names = ["entailment", "neutral", "contradiction"]
40
+ ```
41
+ ## Citation
42
+ If the model is useful to you, please cite the paper
43
+
44
+ ```
45
+ @inproceedings{zhang:hal-04257838,
46
+ TITLE = {{FactSpotter: Evaluating the Factual Faithfulness of Graph-to-Text Generation}},
47
+ AUTHOR = {Zhang, Kun and Balalau, Oana and Manolescu, Ioana},
48
+ URL = {https://hal.science/hal-04257838},
49
+ BOOKTITLE = {{Findings of EMNLP 2023 - Conference on Empirical Methods in Natural Language Processing}},
50
+ ADDRESS = {Singapore, Singapore},
51
+ YEAR = {2023},
52
+ MONTH = Dec,
53
+ KEYWORDS = {Graph-to-Text Generation ; Factual Faithfulness ; Constrained Text Generation},
54
+ PDF = {https://hal.science/hal-04257838/file/_EMNLP_2023__Evaluating_the_Factual_Faithfulness_of_Graph_to_Text_Generation_Camera.pdf},
55
+ HAL_ID = {hal-04257838},
56
+ HAL_VERSION = {v1},
57
+ }
58
+ ```
59
+
60
+ ## Questions
61
+ If you have some questions, please contact through my email [email protected] or [email protected]