Create README.md
Browse filesFirst draft of README
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Question Answering NLU
|
| 2 |
+
|
| 3 |
+
Question Answering NLU (QANLU) is an approach that maps the NLU task into question answering,
|
| 4 |
+
leveraging pre-trained question-answering models to perform well on few-shot settings. Instead of
|
| 5 |
+
training an intent classifier or a slot tagger, for example, we can ask the model intent- and
|
| 6 |
+
slot-related questions in natural language:
|
| 7 |
+
|
| 8 |
+
```
|
| 9 |
+
Context : I'm looking for a cheap flight to Boston.
|
| 10 |
+
|
| 11 |
+
Question: Is the user looking to book a flight?
|
| 12 |
+
Answer : Yes
|
| 13 |
+
|
| 14 |
+
Question: Is the user asking about departure time?
|
| 15 |
+
Answer : No
|
| 16 |
+
|
| 17 |
+
Question: What price is the user looking for?
|
| 18 |
+
Answer : cheap
|
| 19 |
+
|
| 20 |
+
Question: Where is the user flying from?
|
| 21 |
+
Answer : (empty)
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
Thus, by asking questions for each intent and slot in natural language, we can effectively construct an NLU hypothesis. For more details,
|
| 25 |
+
please read the paper:
|
| 26 |
+
[Language model is all you need: Natural language understanding as question answering](https://assets.amazon.science/33/ea/800419b24a09876601d8ab99bfb9/language-model-is-all-you-need-natural-language-understanding-as-question-answering.pdf).
|
| 27 |
+
|
| 28 |
+
To see how to train a QANLU model, visit the [Amazon Science repository](https://github.com/amazon-research/question-answering-nlu)
|
| 29 |
+
|
| 30 |
+
## Use in transformers:
|
| 31 |
+
|
| 32 |
+
'''
|
| 33 |
+
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
|
| 34 |
+
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
|
| 36 |
+
|
| 37 |
+
model = AutoModelForQuestionAnswering.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
|
| 38 |
+
'''
|
| 39 |
+
|
| 40 |
+
## Citation
|
| 41 |
+
If you use this work, please cite:
|
| 42 |
+
|
| 43 |
+
```
|
| 44 |
+
@inproceedings{namazifar2021language,
|
| 45 |
+
title={Language model is all you need: Natural language understanding as question answering},
|
| 46 |
+
author={Namazifar, Mahdi and Papangelis, Alexandros and Tur, Gokhan and Hakkani-T{\"u}r, Dilek},
|
| 47 |
+
booktitle={ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
|
| 48 |
+
pages={7803--7807},
|
| 49 |
+
year={2021},
|
| 50 |
+
organization={IEEE}
|
| 51 |
+
}
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## License
|
| 55 |
+
|
| 56 |
+
This library is licensed under the CC BY NC License.
|