---
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:104687
- loss:BinaryCrossEntropyLoss
base_model: hotchpotch/japanese-reranker-cross-encoder-small-v1
pipeline_tag: text-ranking
library_name: sentence-transformers
---
# CrossEncoder based on hotchpotch/japanese-reranker-cross-encoder-small-v1
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [hotchpotch/japanese-reranker-cross-encoder-small-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-small-v1) using the [sentence-transformers](https://www.SBERT.net) library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
## Model Details
### Model Description
- **Model Type:** Cross Encoder
- **Base model:** [hotchpotch/japanese-reranker-cross-encoder-small-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-small-v1)
- **Maximum Sequence Length:** 514 tokens
- **Number of Output Labels:** 1 label
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
- **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("Miya67/aiq-scoring-e5-small-wiki-absolute")
# Get scores for pairs of texts
pairs = [
['問題: 俳優の哀川翔、女優の小西真奈美、歌手の長渕剛の出身都道府県はどこでしょう? / 想定解: 鹿児島県', '熊毛地域'],
['問題: 和名を「トウショウブ」や「オランダショウブ」という、剣のように尖った葉が特徴的なアヤメ科の植物は何でしょう? / 想定解: グラジオラス', 'グラジオラス属'],
['問題: 月見そばで、卵の黄身が表しているものは月ですが、白身が表しているものは何でしょう? / 想定解: 雲', '分子雲'],
['問題: 1950年に第1回日本シリーズの第1戦が行われた、現在はヤクルトスワローズが本拠地とする野球場はどこでしょう? / 想定解: 明治神宮野球場', '明治神宮野球大会'],
['問題: オーストラリアの6つの州の中で、最も面積が大きいのは西オーストラリア州ですが、最も面積が小さいのは何州でしょう? / 想定解: タスマニア州', 'たすまにあしゅうそうとく'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'問題: 俳優の哀川翔、女優の小西真奈美、歌手の長渕剛の出身都道府県はどこでしょう? / 想定解: 鹿児島県',
[
'熊毛地域',
'グラジオラス属',
'分子雲',
'明治神宮野球大会',
'たすまにあしゅうそうとく',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 104,687 training samples
* Columns: sentence_0, sentence_1, and label
* Approximate statistics based on the first 1000 samples:
| | sentence_0 | sentence_1 | label |
|:--------|:-----------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details |
問題: 俳優の哀川翔、女優の小西真奈美、歌手の長渕剛の出身都道府県はどこでしょう? / 想定解: 鹿児島県 | 熊毛地域 | 1.0 |
| 問題: 和名を「トウショウブ」や「オランダショウブ」という、剣のように尖った葉が特徴的なアヤメ科の植物は何でしょう? / 想定解: グラジオラス | グラジオラス属 | 1.0 |
| 問題: 月見そばで、卵の黄身が表しているものは月ですが、白身が表しているものは何でしょう? / 想定解: 雲 | 分子雲 | 0.0 |
* Loss: [BinaryCrossEntropyLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
```json
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 32
- `num_train_epochs`: 4
- `per_device_eval_batch_size`: 32
#### All Hyperparameters