Mizuiro-sakura
commited on
Commit
•
279e201
1
Parent(s):
8f89b85
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,62 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language: ja
|
4 |
+
tags:
|
5 |
+
- luke
|
6 |
+
- question-answering
|
7 |
+
- squad
|
8 |
+
- pytorch
|
9 |
+
- transformers
|
10 |
+
- question answering
|
11 |
+
|
12 |
---
|
13 |
+
|
14 |
+
# このモデルはluke-japanese-large-liteをファインチューニングして、Question-Answeringに用いれるようにしたものです。
|
15 |
+
このモデルはluke-japanese-large-liteを運転ドメインQAデータセット(DDQA)( https://nlp.ist.i.kyoto-u.ac.jp/index.php?Driving%20domain%20QA%20datasets )を用いてファインチューニングしたものです。
|
16 |
+
|
17 |
+
Question-Answeringタスク(SQuAD)に用いることができます。
|
18 |
+
|
19 |
+
# This model is fine-tuned model for Question-Answering which is based on luke-japanese-large-lite
|
20 |
+
|
21 |
+
This model is fine-tuned by using DDQA dataset.
|
22 |
+
|
23 |
+
You could use this model for Question-Answering tasks.
|
24 |
+
|
25 |
+
# モデルの精度 accuracy of model
|
26 |
+
'em(厳密一致)': 0.8631578947368421, 'f1': 0.9302271135164113
|
27 |
+
|
28 |
+
# How to use 使い方
|
29 |
+
以下のコードを実行することで、Question-Answeringタスクを解かせることができます。
|
30 |
+
please execute this code.
|
31 |
+
```python
|
32 |
+
import torch
|
33 |
+
from transformers import AutoTokenizer, LukeForQuestionAnswering
|
34 |
+
|
35 |
+
tokenizer = AutoTokenizer.from_pretrained('Mizuiro-sakura/luke-japanese-large-finetuned-QA')
|
36 |
+
model=LukeForQuestionAnswering.from_pretrained('Mizuiro-sakura/luke-japanese-large-finetuned-QA') # 学習済みモデルの読み込み
|
37 |
+
text={
|
38 |
+
'context':'私の名前はEIMIです。好きな食べ物は苺です。 趣味は皆さんと会話することです。',
|
39 |
+
'question' :'好きな食べ物は何ですか'
|
40 |
+
}
|
41 |
+
|
42 |
+
input_ids=tokenizer.encode(text['question'],text['context']) # tokenizerで形態素解析しつつコードに変換する
|
43 |
+
output= model(torch.tensor([input_ids])) # 学習済みモデルを用いて解析
|
44 |
+
prediction = tokenizer.decode(input_ids[torch.argmax(output.start_logits): torch.argmax(output.end_logits)]) # 答えに該当する部分を抜き取る
|
45 |
+
print(prediction)
|
46 |
+
```
|
47 |
+
|
48 |
+
|
49 |
+
# what is Luke? Lukeとは?[1]
|
50 |
+
LUKE (Language Understanding with Knowledge-based Embeddings) is a new pre-trained contextualized representation of words and entities based on transformer. LUKE treats words and entities in a given text as independent tokens, and outputs contextualized representations of them. LUKE adopts an entity-aware self-attention mechanism that is an extension of the self-attention mechanism of the transformer, and considers the types of tokens (words or entities) when computing attention scores.
|
51 |
+
|
52 |
+
LUKE achieves state-of-the-art results on five popular NLP benchmarks including SQuAD v1.1 (extractive question answering), CoNLL-2003 (named entity recognition), ReCoRD (cloze-style question answering), TACRED (relation classification), and Open Entity (entity typing). luke-japaneseは、単語とエンティティの知識拡張型訓練済み Transformer モデルLUKEの日本語版です。LUKE は単語とエンティティを独立したトークンとして扱い、これらの文脈を考慮した表現を出力します。
|
53 |
+
|
54 |
+
# Acknowledgments 謝辞
|
55 |
+
Lukeの開発者である山田先生とStudio ousiaさんには感謝いたします。 I would like to thank Mr.Yamada @ikuyamada and Studio ousia @StudioOusia.
|
56 |
+
|
57 |
+
# Citation
|
58 |
+
[1]@inproceedings{yamada2020luke, title={LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention}, author={Ikuya Yamada and Akari Asai and Hiroyuki Shindo and Hideaki Takeda and Yuji Matsumoto}, booktitle={EMNLP}, year={2020} }
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
|