Mizuiro-sakura
commited on
Commit
•
1feb6fd
1
Parent(s):
7b43b48
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,69 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language: ja
|
4 |
+
tags:
|
5 |
+
- luke
|
6 |
+
- pytorch
|
7 |
+
- transformers
|
8 |
+
- jnli
|
9 |
+
- natural-language-inference
|
10 |
+
- NaturalLanguageInference
|
11 |
+
|
12 |
---
|
13 |
+
|
14 |
+
# このモデルはluke-japanese-baseをファインチューニングして、JNLI(文章の関係性判別)に用いれるようにしたものです。
|
15 |
+
このモデルはluke-japanese-baseを
|
16 |
+
yahoo japan/JGLUEのJNLI( https://github.com/yahoojapan/JGLUE )
|
17 |
+
を用いてファインチューニングしたものです。
|
18 |
+
|
19 |
+
文章の関係性(矛盾 contradiction, 中立 neutral, 含意 entailment)を計算するタスクに用いることができます。
|
20 |
+
|
21 |
+
# This model is fine-tuned model for JNLI which is based on luke-japanese-base
|
22 |
+
|
23 |
+
This model is fine-tuned by using yahoo japan JGLUE JNLI dataset.
|
24 |
+
|
25 |
+
You could use this model for calculating natural language inference.
|
26 |
+
|
27 |
+
# モデルの精度 accuracy of model
|
28 |
+
モデルの精度は
|
29 |
+
0.8976992604765818
|
30 |
+
|
31 |
+
# How to use 使い方
|
32 |
+
transformers, sentencepieceをinstallして、以下のコードを実行することで、JNLI(文章の関係性判別)タスクを解かせることができます。
|
33 |
+
please execute this code.
|
34 |
+
```python
|
35 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
36 |
+
import torch
|
37 |
+
|
38 |
+
tokenizer=AutoTokenizer.from_pretrained('Mizuiro-sakura/luke-japanese-base-finetuned-jnli')
|
39 |
+
model=AutoModelForSequenceClassification.from_pretrained('Mizuiro-sakura/luke-japanese-base-finetuned-jnli')
|
40 |
+
|
41 |
+
token=tokenizer.encode('時計がついている場所にパブリックマーケットセンターとかかれた看板が設置されています。', '屋根の上に看板があり時計もついています。')
|
42 |
+
result=model(torch.tensor(token).unsqueeze(0))
|
43 |
+
max_index=torch.argmax(result.logits)
|
44 |
+
|
45 |
+
if max_index==0:
|
46 |
+
print('contradiction')
|
47 |
+
elif max_index==1:
|
48 |
+
print('neutral')
|
49 |
+
elif max_index==2:
|
50 |
+
print('entailment')
|
51 |
+
```
|
52 |
+
|
53 |
+
|
54 |
+
# what is Luke? Lukeとは?[1]
|
55 |
+
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.
|
56 |
+
|
57 |
+
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 は単語とエンティティを独立したトークンとして扱い、これらの文脈を考慮した表現を出力します。
|
58 |
+
|
59 |
+
# Acknowledgments 謝辞
|
60 |
+
Lukeの開発者である山田先生とStudio ousiaさんには感謝いたします。 I would like to thank Mr.Yamada @ikuyamada and Studio ousia @StudioOusia.
|
61 |
+
|
62 |
+
# Citation
|
63 |
+
[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} }
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
|