pkshatech/simcse-ja-bert-base-clcmlp

Model

Japanese SimCSE (BERT-base)

15

20 commits

1 repos using this model

3 linked in READMEs

updated Jan 27, 2023

See the code

README

Japanese SimCSE (BERT-base)

日本語のREADME/Japanese README

summary

model name: pkshatech/simcse-ja-bert-base-clcmlp

This is a Japanese SimCSE model. You can easily extract sentence embedding representations from Japanese sentences. This model is based on cl-tohoku/bert-base-japanese-v2 and trained on JSNLI dataset, which is a Japanese natural language inference dataset.

Usage (Sentence-Transformers)

You can use this model easily with sentence-transformers.

You need fugashi and unidic-lite for tokenization.

Please install sentence-transformers, fugashi, and unidic-lite with pip as follows:

pip install -U fugashi[unidic-lite] sentence-transformers

You can load the model and convert sentences to dense vectors as follows:

from sentence_transformers import SentenceTransformer
sentences = [
    "PKSHA Technologyは機械学習/深層学習技術に関わるアルゴリズムソリューションを展開している。",
    "この深層学習モデルはPKSHA Technologyによって学習され、公開された。",
    "広目天は、仏教における四天王の一尊であり、サンスクリット語の「種々の眼をした者」を名前の由来とする。",
]

model = SentenceTransformer('pkshatech/simcse-ja-bert-base-clcmlp')
embeddings = model.encode(sentences)
print(embeddings)

Since the loss function used during training is cosine similarity, we recommend using cosine similarity for downstream tasks.

Model Detail

Tokenization

We use the same tokenizer as tohoku/bert-base-japanese-v2. Please see the README of tohoku/bert-base-japanese-v2 for details.

Training

We set tohoku/bert-base-japanese-v2 as the initial value and trained it on the train set of JSNLI. We trained 20 epochs and published the checkpoint of the model with the highest Spearman's correlation coefficient on the validation set 1 of the train set of JSTS

Training Parameters

ParameterValue
pooling_strategy[CLS] -> single fully-connected layer
max_seq_length128
with hard negativetrue
temperature of contrastive loss0.05
Batch size200
Learning rate1e-5
Weight decay0.01
Max gradient norm1.0
Warmup steps2012
SchedulerWarmupLinear
Epochs20
Evaluation steps250

Licenses

This models are distributed under the terms of the Creative Creative Commons Attribution-ShareAlike 4.0.

Footnotes

  1. When we trained this model, the test data of JGLUE was not released, so we used the dev set of JGLUE as a private evaluation data. Therefore, we selected the checkpoint on the train set of JGLUE insted of its dev set. ↩

bert
feature-extraction
pytorch
sentence-similarity
sentence-transformers
transformers

pkshatech/simcse-ja-bert-base-clcmlp

Model

Japanese SimCSE (BERT-base)

15

20 commits

1 repos using this model

3 linked in READMEs

updated Jan 27, 2023

See the code

README

Japanese SimCSE (BERT-base)

日本語のREADME/Japanese README

summary

model name: pkshatech/simcse-ja-bert-base-clcmlp

This is a Japanese SimCSE model. You can easily extract sentence embedding representations from Japanese sentences. This model is based on cl-tohoku/bert-base-japanese-v2 and trained on JSNLI dataset, which is a Japanese natural language inference dataset.

Usage (Sentence-Transformers)

You can use this model easily with sentence-transformers.

You need fugashi and unidic-lite for tokenization.

Please install sentence-transformers, fugashi, and unidic-lite with pip as follows:

pip install -U fugashi[unidic-lite] sentence-transformers

You can load the model and convert sentences to dense vectors as follows:

from sentence_transformers import SentenceTransformer
sentences = [
    "PKSHA Technologyは機械学習/深層学習技術に関わるアルゴリズムソリューションを展開している。",
    "この深層学習モデルはPKSHA Technologyによって学習され、公開された。",
    "広目天は、仏教における四天王の一尊であり、サンスクリット語の「種々の眼をした者」を名前の由来とする。",
]

model = SentenceTransformer('pkshatech/simcse-ja-bert-base-clcmlp')
embeddings = model.encode(sentences)
print(embeddings)

Since the loss function used during training is cosine similarity, we recommend using cosine similarity for downstream tasks.

Model Detail

Tokenization

We use the same tokenizer as tohoku/bert-base-japanese-v2. Please see the README of tohoku/bert-base-japanese-v2 for details.

Training

We set tohoku/bert-base-japanese-v2 as the initial value and trained it on the train set of JSNLI. We trained 20 epochs and published the checkpoint of the model with the highest Spearman's correlation coefficient on the validation set 1 of the train set of JSTS

Training Parameters

ParameterValue
pooling_strategy[CLS] -> single fully-connected layer
max_seq_length128
with hard negativetrue
temperature of contrastive loss0.05
Batch size200
Learning rate1e-5
Weight decay0.01
Max gradient norm1.0
Warmup steps2012
SchedulerWarmupLinear
Epochs20
Evaluation steps250

Licenses

This models are distributed under the terms of the Creative Creative Commons Attribution-ShareAlike 4.0.

Footnotes

  1. When we trained this model, the test data of JGLUE was not released, so we used the dev set of JGLUE as a private evaluation data. Therefore, we selected the checkpoint on the train set of JGLUE insted of its dev set. ↩

bert
feature-extraction
pytorch
sentence-similarity
sentence-transformers
transformers