Mizuiro-sakura
commited on
Commit
•
57a03f9
1
Parent(s):
d35b032
Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,71 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# モデルの精度 accuracy of model
|
5 |
precision : 0.967
|
6 |
accuracy : 0.967
|
7 |
recall : 0.967
|
8 |
f1 : 0.967
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language: ja
|
4 |
+
tags:
|
5 |
+
- luke
|
6 |
+
- pytorch
|
7 |
+
- transformers
|
8 |
+
- marcja
|
9 |
+
- marc-ja
|
10 |
+
- sentiment-analysis
|
11 |
+
- SentimentAnalysis
|
12 |
+
|
13 |
---
|
14 |
+
|
15 |
+
# このモデルはluke-japanese-baseをファインチューニングして、MARC-ja(positive or negativeの二値分類)に用いれるようにしたものです。
|
16 |
+
このモデルはluke-japanese-baseを
|
17 |
+
yahoo japan/JGLUEのMARC-ja( https://github.com/yahoojapan/JGLUE )
|
18 |
+
を用いてファインチューニングしたものです。
|
19 |
+
|
20 |
+
positive or negativeの二値分類タスクに用いることができます。
|
21 |
+
|
22 |
+
# This model is fine-tuned model for MARC-ja which is based on luke-japanese-base
|
23 |
+
|
24 |
+
This model is fine-tuned by using yahoo japan JGLUE MARC-ja dataset.
|
25 |
+
|
26 |
+
You could use this model for binary classification (positive or negative) tasks.
|
27 |
+
|
28 |
# モデルの精度 accuracy of model
|
29 |
precision : 0.967
|
30 |
accuracy : 0.967
|
31 |
recall : 0.967
|
32 |
f1 : 0.967
|
33 |
+
|
34 |
+
# How to use 使い方
|
35 |
+
sentencepieceとtransformersをインストールして (pip install sentencepiece , pip install transformers)
|
36 |
+
以下のコードを実行することで、MARC-jaタスクを解かせることができます。
|
37 |
+
After install transformers and sentencepiec, please execute this code.
|
38 |
+
```python
|
39 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
40 |
+
import torch
|
41 |
+
|
42 |
+
tokenizer = AutoTokenizer.from_pretrained('Mizuiro-sakura/luke-japanese-base-marcja')
|
43 |
+
model = AutoModelForSequenceClassification.from_pretrained('Mizuiro-sakura/luke-japanese-base-marcja')
|
44 |
+
|
45 |
+
text = 'この商品は素晴らしい!とても匂いが良く、満足でした。'
|
46 |
+
|
47 |
+
token = tokenizer.encode_plus(text, truncation=True, max_length=128, padding="max_length", return_tenosr='pt')
|
48 |
+
result = model(torch.tensor(token['input_ids']).unsqueeze(0), torch.tensor(token['attention_mask']).unsqueeze(0))
|
49 |
+
|
50 |
+
if torch.argmax(result['logits'])==0:
|
51 |
+
print('positive')
|
52 |
+
if torch.argmax(result['logits'])==1:
|
53 |
+
print('negative')
|
54 |
+
```
|
55 |
+
|
56 |
+
|
57 |
+
# what is Luke? Lukeとは?[1]
|
58 |
+
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.
|
59 |
+
|
60 |
+
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 は単語とエンティティを独立したトークンとして扱い、これらの文脈を考慮した表現を出力します。
|
61 |
+
|
62 |
+
# Acknowledgments 謝辞
|
63 |
+
Lukeの開発者である山田先生とStudio ousiaさんには感謝いたします。 I would like to thank Mr.Yamada @ikuyamada and Studio ousia @StudioOusia.
|
64 |
+
|
65 |
+
# Citation
|
66 |
+
[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} }
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
|