Downloads · 30 days
124
7% of all-time downloads
Mizuiro-sakura/luke-japanese-base-finetuned-jsts
luke-japanese-base-finetuned-jsts is a sentence similarity model from Mizuiro-sakura. Use it when you need a score for how close two texts are. It is set up for transformers. The card lists the license as mit.
このモデルはluke-japanese-baseを yahoo japan/JGLUEのJSTS( https://github.com/yahoojapan/JGLUE ) を用いてファインチューニングしたものです。
Downloads · 30 days
124
7% of all-time downloads
All-time downloads
1.7K
Public
Parameters
279M
2.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.bin1.1 GB · 49%
From the Hugging Face model README
このモデルはluke-japanese-baseを yahoo japan/JGLUEのJSTS( https://github.com/yahoojapan/JGLUE ) を用いてファインチューニングしたものです。
文章の類似度(5が最高値)を計算するタスクに用いることができます。
This model is fine-tuned by using yahoo japan JGLUE JSTS dataset.
You could use this model for calculating sentence-similarity.
モデルの精度は
Pearson (ピアソンの積率相関係数) : 0.8971
transformers, sentencepieceをinstallして、以下のコードを実行することで、jsts(文章の類似度計算)タスクを解かせることができます。 please execute this code.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import numpy as np
tokenizer=AutoTokenizer.from_pretrained('Mizuiro-sakura/luke-japanese-base-finetuned-jsts')
model=AutoModelForSequenceClassification.from_pretrained('Mizuiro-sakura/luke-japanese-base-finetuned-jsts')
sentence1='今日は銀座に買い物に出かけた'
sentence2='今日は銀座に服を買いに出かけた'
token=tokenizer(sentence1,sentence2)
import torch
tensor_input_ids = torch.tensor(token["input_ids"])
tensor_attention_masks = torch.tensor(token["attention_mask"])
outputs=model(tensor_input_ids.unsqueeze(0), tensor_attention_masks.unsqueeze(0))
print(outputs.logits[0][1]*5)
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.
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 は単語とエンティティを独立したトークンとして扱い、これらの文脈を考慮した表現を出力します。
Lukeの開発者である山田先生とStudio ousiaさんには感謝いたします。 I would like to thank Mr.Yamada @ikuyamada and Studio ousia @StudioOusia.
[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} }