Mizuiro-sakura commited on
Commit
21636a5
·
1 Parent(s): 753e139

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md CHANGED
@@ -1,3 +1,66 @@
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-base-liteをファインチューニングして、Question-Answeringに用いれるようにしたものです。
15
+ このモデルはluke-japanese-base-liteをJSQuAD ( https://github.com/yahoojapan/JGLUE
16
+ )を用いてファインチューニングしたものです。
17
+
18
+ Question-Answeringタスク(SQuAD)に用いることができます。
19
+
20
+ # This model is fine-tuned model for Question-Answering which is based on luke-japanese-base-lite
21
+
22
+ This model is fine-tuned by using JSQuAD dataset.
23
+
24
+ You could use this model for Question-Answering tasks.
25
+
26
+ # モデルの精度 accuracy of model
27
+ 'em(厳密一致)': 0.7582170193606483, 'f1': 0.8761199970544952
28
+
29
+ # How to use 使い方
30
+ 以下のコードを実行することで、Question-Answeringタスクを解かせることができます。
31
+ please execute this code.
32
+ ```python
33
+ import torch
34
+ from transformers import MLukeTokenizer, AutoModelForQuestionAnswering
35
+
36
+ tokenizer = MLukeTokenizer.from_pretrained('Mizuiro-sakura/luke-japanese-base-lite-jsquad')
37
+ model=AutoModelForQuestionAnswering.from_pretrained('Mizuiro-sakura/luke-japanese-base-lite-jsquad')# 学習済みモデルの読み込み
38
+
39
+ text={
40
+ 'context':'私の名前はEIMIです。好きな食べ物は苺です。 趣味は皆さんと会話することです。',
41
+ 'question' :'好きな食べ物は何ですか'
42
+ }
43
+
44
+ input_ids=tokenizer.encode(text['question'],text['context']) # tokenizerで形態素解析しつつコードに変換する
45
+ con=tokenizer.encode(text['question'])
46
+ output= model(torch.tensor([input_ids])) # 学習済みモデルを用いて解析
47
+ prediction = tokenizer.decode(input_ids[torch.argmax(output.start_logits)-2: torch.argmax(output.end_logits)-1]) # 答えに該当する部分を抜き取る
48
+ prediction=prediction.replace('</s>','')
49
+ print(prediction)
50
+ ```
51
+
52
+
53
+ # what is Luke? Lukeとは?[1]
54
+ 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.
55
+
56
+ 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 は単語とエンティティを独立したトークンとして扱い、これらの文脈を考慮した表現を出力します。
57
+
58
+ # Acknowledgments 謝辞
59
+ Lukeの開発者である山田先生とStudio ousiaさんには感謝いたします。 I would like to thank Mr.Yamada @ikuyamada and Studio ousia @StudioOusia.
60
+
61
+ # Citation
62
+ [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} }
63
+
64
+
65
+
66
+