domenicrosati commited on
Commit
d0551f1
·
1 Parent(s): 1543302

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Question-Answer to Statement Converter
2
+
3
+ A question answer pair to statement converter from https://github.com/jifan-chen/QA-Verification-Via-NLI
4
+
5
+ See:
6
+ ```
7
+ @article{chen2021can,
8
+ title={Can NLI Models Verify QA Systems' Predictions?},
9
+ author={Chen, Jifan and Choi, Eunsol and Durrett, Greg},
10
+ journal={EMNLP Findings},
11
+ year={2021}
12
+ }
13
+ ```
14
+
15
+ **Note:** I am not the maintainer or orginal author just keeping it here to use huggingface APIs to produce statements from question answer pair for downstream applications.
16
+
17
+ ## TL;DR:
18
+ We fine-tune a seq2seq model,
19
+ T5-3B (Raffel et al., 2020), using the $(a, q, d)$ pairs
20
+ annotated by Demszky et al. (2018).
21
+
22
+ Where a is answer, q is question, and d is declerative sentence (i.e. a statement).
23
+
24
+ See Appendex B.2 of Chen et al. for more.
25
+
26
+ ## Usage
27
+
28
+ ```python
29
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
30
+
31
+ tokenizer = AutoTokenizer.from_pretrained('domenicrosati/question_converter-3b')
32
+ model = AutoModelForSeq2SeqLM.from_pretrained('domenicrosati/question_converter-3b')
33
+
34
+ question = "Where in the world is Carmen Sandiego?"
35
+ answer = "She is in D'Abruzzo"
36
+
37
+ prompt = f'{question} </s> {answer}'
38
+ input_ids = tokenizer(prompt, return_tensors='pt').input_ids
39
+ output_ids = model.generate(input_ids)
40
+ responses = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
41
+ ```