liujch1998
commited on
Commit
•
796aa1e
1
Parent(s):
7dd829b
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,129 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text2text-generation
|
6 |
+
arxiv: 2210.03078
|
7 |
+
---
|
8 |
+
|
9 |
+
# Model Card for Rainier
|
10 |
+
|
11 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
12 |
+
|
13 |
+
Rainier is a knowledge introspection model for commonsense QA. See our paper at: <https://arxiv.org/abs/2210.03078>.
|
14 |
+
|
15 |
+
## Model Details
|
16 |
+
|
17 |
+
### Model Description
|
18 |
+
|
19 |
+
<!-- Provide a longer summary of what this model is. -->
|
20 |
+
|
21 |
+
Given a commonsense question as input, Rainier generates a knowledge statement that is related to the question and (hopefully) helpful for answering it.
|
22 |
+
By sampling from the output, Rainier can generate a diverse set of related knowledge.
|
23 |
+
The *introspected* knowledge can be further prompted to a QA model and improves its prediction accuracy.
|
24 |
+
|
25 |
+
- **Developed by:** Jiacheng Liu, Skyler Hallinan, Ximing Lu, Pengfei He, Sean Welleck, Hannaneh Hajishirzi, Yejin Choi
|
26 |
+
- **Shared by [optional]:** Jiacheng Liu
|
27 |
+
- **Model type:** Transformers
|
28 |
+
- **Language(s) (NLP):** English
|
29 |
+
- **License:** MIT
|
30 |
+
- **Finetuned from model [optional]:** T5-large
|
31 |
+
|
32 |
+
### Model Sources [optional]
|
33 |
+
|
34 |
+
<!-- Provide the basic links for the model. -->
|
35 |
+
|
36 |
+
- **Repository:** <https://github.com/liujch1998/rainier>
|
37 |
+
- **Paper [optional]:** <https://arxiv.org/abs/2210.03078>
|
38 |
+
- **Demo [optional]:** <https://huggingface.co/spaces/liujch1998/rainier>
|
39 |
+
|
40 |
+
## Uses
|
41 |
+
|
42 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
43 |
+
|
44 |
+
### Direct Use
|
45 |
+
|
46 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
47 |
+
|
48 |
+
Rainier is intended to generate commonsense knowledge statements related to answering a given commonsense question.
|
49 |
+
|
50 |
+
### Out-of-Scope Use
|
51 |
+
|
52 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
53 |
+
|
54 |
+
Rainier is a research prototype and may generate incorrect or irrelevant knowledge. Do not use for making critical decisions. It is intended to generate knowledge statements for questions about commonsense, and may be unreliable when taking input out of this scope.
|
55 |
+
|
56 |
+
## Bias, Risks, and Limitations
|
57 |
+
|
58 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
59 |
+
|
60 |
+
See the **Limitations** section of our paper.
|
61 |
+
|
62 |
+
### Recommendations
|
63 |
+
|
64 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
65 |
+
|
66 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
67 |
+
|
68 |
+
## How to Get Started with the Model
|
69 |
+
|
70 |
+
Use the code below to get started with the model.
|
71 |
+
|
72 |
+
```python
|
73 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
74 |
+
|
75 |
+
tokenizer = T5Tokenizer.from_pretrained('t5-large')
|
76 |
+
model = T5ForConditionalGeneration.from_pretrained('liujch1998/rainier-large')
|
77 |
+
|
78 |
+
question = "Sydney rubbed Addison’s head because she had a horrible headache. " \
|
79 |
+
"What will happen to Sydney? \\n " \
|
80 |
+
"(A) drift to sleep (B) receive thanks (C) be reprimanded"
|
81 |
+
input_ids = tokenizer(question, return_tensors='pt').input_ids
|
82 |
+
output_ids = model.generate(input_ids, do_sample=True, top_p=0.5, num_return_sequences=10)
|
83 |
+
knowledges = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
|
84 |
+
print(list(set(knowledges)))
|
85 |
+
```
|
86 |
+
|
87 |
+
Outputs:
|
88 |
+
> Sydney is a good friend to Addison.
|
89 |
+
>
|
90 |
+
> Sydney is a kind person.
|
91 |
+
>
|
92 |
+
> One should be thankful for the help of others.
|
93 |
+
>
|
94 |
+
> Rubbed head is a good way to relieve headaches.
|
95 |
+
>
|
96 |
+
> The head is a very sensitive area.
|
97 |
+
>
|
98 |
+
> One should be grateful for the help of others.
|
99 |
+
>
|
100 |
+
> The head is the most sensitive part of the body.
|
101 |
+
>
|
102 |
+
> The person who rubs the head is a good person.
|
103 |
+
>
|
104 |
+
> Sydney will be grateful.
|
105 |
+
>
|
106 |
+
> The head is a sensitive area.
|
107 |
+
|
108 |
+
You may also refer to <https://huggingface.co/spaces/liujch1998/rainier/blob/main/app.py#L16-L100> for implementation.
|
109 |
+
|
110 |
+
## Citation [optional]
|
111 |
+
|
112 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
113 |
+
|
114 |
+
**BibTeX:**
|
115 |
+
|
116 |
+
```
|
117 |
+
@article{Liu2022RainierRK,
|
118 |
+
title={Rainier: Reinforced Knowledge Introspector for Commonsense Question Answering},
|
119 |
+
author={Jiacheng Liu and Skyler Hallinan and Ximing Lu and Pengfei He and Sean Welleck and Hannaneh Hajishirzi and Yejin Choi},
|
120 |
+
journal={ArXiv},
|
121 |
+
year={2022},
|
122 |
+
volume={abs/2210.03078},
|
123 |
+
url={https://api.semanticscholar.org/CorpusID:252735191}
|
124 |
+
}
|
125 |
+
```
|
126 |
+
|
127 |
+
## Model Card Contact
|
128 |
+
|
129 |
+
Jiacheng Liu
|