DREAM / README.md
SaveBertAndGpt's picture
Update README.md
db17066
---
language: "en" # Example: en
license: "cc-by-4.0" # Example: apache-2.0 or any license from https://hf.co/docs/hub/repositories-licenses
library_name: "transformers" # Optional. Example: keras or any library from https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Libraries.ts
---
This is the T5-11B model described in our paper DREAM: Improving Situational QA by First Elaborating the Situation, NAACL 2022 (Arxiv link: https://arxiv.org/abs/2112.08656, ACL Anthology link: https://aclanthology.org/2022.naacl-main.82/)
# What is DREAM πŸ’­?
DREAM can be used to:
* Build scene elaborations in a dataset-neutral way πŸ–ΌοΈ
* πŸ“ˆ Improve QA performance across different end-tasks and on different models πŸ“ˆ
When people πŸ§‘β€πŸ’» answer questions about a specific situation, cognitive science 🧠 suggests that they form a mental picture πŸ–ΌοΈ of that situation. Will language models πŸ€– answer such questions more accurately if provided with additional details about the question situation πŸ–ΌοΈ ?
We train a new model, DREAM πŸ’­ , to answer questions that elaborate the scenes πŸ–ΌοΈ that situated questions are about, and then provide those elaborations as additional context πŸ“„ to a QA model πŸ€– . Our results show that DREAM πŸ’­ is able to create more βœ… accurate, βœ… useful, and βœ… consistent scene elaborations than a representative
SOTA 🌟, zero-shot model (Macaw 🦜 ).
Remarkably, using DREAM’s πŸ’­ scene elaborations πŸ–ΌοΈ as additional context improvesπŸ“ˆ the answer accuracy across different downstream QA systems πŸ€– and on different end-tasks πŸ“ (including beyond that obtainable by further fine-tuning the QA system on DREAM’s training data πŸ“š). Our approach is question-agnostic πŸ’«, leaves end-task QA models unchanged ✨, and thus easily portable to other QA models 🌟, suggesting exciting opportunities for further improving and exploiting scene elaborations to better solve new problems. πŸ’‘
We invite you to try out DREAM πŸ’­ for your own application!
# How to use DREAM πŸ’­?
We provide a quick example of how you can try out DREAM with just a few lines of code:
```
>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
>>> model = AutoModelForSeq2SeqLM.from_pretrained("allenai/DREAM")
>>> tokenizer = AutoTokenizer.from_pretrained("t5-11b")
>>> input_string = "$answer$ ; $question$ = [SITUATION] hitting someones car in the drive thru on purpose. [QUERY] rot"
>>> input_ids = tokenizer.encode(input_string, return_tensors="pt")
>>> output = model.generate(input_ids, max_length=200)
>>> tokenizer.batch_decode(output, skip_special_tokens=True)
["$answer$ = It's wrong to damage other people's property."]
```
As discussed in our paper, DREAM supports the following possible dimensions for each input situation S:
```
1. M : motivation of character(s) before S.
2. E: emotion of character(s) after S.
3. ROT : general Rule of Thumb (ROT) about whether action described in S is socially acceptable or not (also known as social norm).
4. Con: likely consequence of action in S.
```
To get DREAM's output for these dimensions, use the corresponding terms below after the "[QUERY] " tag in your input string:
```
motivation
emotion
rot
consequence
```
# More details about DREAM πŸ’­ ...
For more details about DREAM, please refer to our:
* πŸ“„Paper: https://aclanthology.org/2022.naacl-main.82/
* πŸ’»Dataset & Model: https://github.com/allenai/dream/
For additional instructions about using the DREAM model and sample commands, please refer to https://github.com/allenai/dream/blob/main/model/README_DREAM_model.md.