---
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:14287
- loss:BinaryCrossEntropyLoss
base_model: yoriis/GTE-tydi-tafseer-quqa-haqa
pipeline_tag: text-ranking
library_name: sentence-transformers
metrics:
- accuracy
- accuracy_threshold
- f1
- f1_threshold
- precision
- recall
- average_precision
model-index:
- name: CrossEncoder based on yoriis/GTE-tydi-tafseer-quqa-haqa
results:
- task:
type: cross-encoder-classification
name: Cross Encoder Classification
dataset:
name: eval
type: eval
metrics:
- type: accuracy
value: 0.97544080604534
name: Accuracy
- type: accuracy_threshold
value: 0.02913171425461769
name: Accuracy Threshold
- type: f1
value: 0.8446215139442231
name: F1
- type: f1_threshold
value: 0.02913171425461769
name: F1 Threshold
- type: precision
value: 0.828125
name: Precision
- type: recall
value: 0.8617886178861789
name: Recall
- type: average_precision
value: 0.8740056534530515
name: Average Precision
---
# CrossEncoder based on yoriis/GTE-tydi-tafseer-quqa-haqa
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [yoriis/GTE-tydi-tafseer-quqa-haqa](https://huggingface.co/yoriis/GTE-tydi-tafseer-quqa-haqa) 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:** [yoriis/GTE-tydi-tafseer-quqa-haqa](https://huggingface.co/yoriis/GTE-tydi-tafseer-quqa-haqa)
- **Maximum Sequence Length:** 512 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/UKPLab/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("yoriis/GTE-tydi-tafseer-quqa-haqa-task-70")
# Get scores for pairs of texts
pairs = [
['أين يقع الجودي؟', '[PASSAGE_NOT_FOUND]'],
['ما هي الآيات التي تتحدث عن موضوع الوصية في سورة المائدة؟', 'ولما جاءهم كتاب من عند الله مصدق لما معهم وكانوا من قبل يستفتحون على الذين كفروا فلما جاءهم ما عرفوا كفروا به فلعنة الله على الكافرين. بئسما اشتروا به أنفسهم أن يكفروا بما أنزل الله بغيا أن ينزل الله من فضله على من يشاء من عباده فباءوا بغضب على غضب وللكافرين عذاب مهين.'],
['هل ورد في القرآن إشارة لصوت ذي تأثير إيجابي على جسم الإنسان؟', 'والمؤمنون والمؤمنات بعضهم أولياء بعض يأمرون بالمعروف وينهون عن المنكر ويقيمون الصلاة ويؤتون الزكاة ويطيعون الله ورسوله أولئك سيرحمهم الله إن الله عزيز حكيم. وعد الله المؤمنين والمؤمنات جنات تجري من تحتها الأنهار خالدين فيها ومساكن طيبة في جنات عدن ورضوان من الله أكبر ذلك هو الفوز العظيم.'],
['كم فترة رضاعة المولود؟', '[PASSAGE_NOT_FOUND]'],
['ما هي الآيات التي تتحدث عن موضوع الوصية في سورة المائدة؟', '[PASSAGE_NOT_FOUND]'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'أين يقع الجودي؟',
[
'[PASSAGE_NOT_FOUND]',
'ولما جاءهم كتاب من عند الله مصدق لما معهم وكانوا من قبل يستفتحون على الذين كفروا فلما جاءهم ما عرفوا كفروا به فلعنة الله على الكافرين. بئسما اشتروا به أنفسهم أن يكفروا بما أنزل الله بغيا أن ينزل الله من فضله على من يشاء من عباده فباءوا بغضب على غضب وللكافرين عذاب مهين.',
'والمؤمنون والمؤمنات بعضهم أولياء بعض يأمرون بالمعروف وينهون عن المنكر ويقيمون الصلاة ويؤتون الزكاة ويطيعون الله ورسوله أولئك سيرحمهم الله إن الله عزيز حكيم. وعد الله المؤمنين والمؤمنات جنات تجري من تحتها الأنهار خالدين فيها ومساكن طيبة في جنات عدن ورضوان من الله أكبر ذلك هو الفوز العظيم.',
'[PASSAGE_NOT_FOUND]',
'[PASSAGE_NOT_FOUND]',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Evaluation
### Metrics
#### Cross Encoder Classification
* Dataset: `eval`
* Evaluated with [CrossEncoderClassificationEvaluator](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CrossEncoderClassificationEvaluator)
| Metric | Value |
|:----------------------|:----------|
| accuracy | 0.9754 |
| accuracy_threshold | 0.0291 |
| f1 | 0.8446 |
| f1_threshold | 0.0291 |
| precision | 0.8281 |
| recall | 0.8618 |
| **average_precision** | **0.874** |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 14,287 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 |
أين يقع الجودي؟ | [PASSAGE_NOT_FOUND] | 0.0 |
| ما هي الآيات التي تتحدث عن موضوع الوصية في سورة المائدة؟ | ولما جاءهم كتاب من عند الله مصدق لما معهم وكانوا من قبل يستفتحون على الذين كفروا فلما جاءهم ما عرفوا كفروا به فلعنة الله على الكافرين. بئسما اشتروا به أنفسهم أن يكفروا بما أنزل الله بغيا أن ينزل الله من فضله على من يشاء من عباده فباءوا بغضب على غضب وللكافرين عذاب مهين. | 0.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
- `eval_strategy`: steps
- `num_train_epochs`: 4
- `fp16`: True
#### All Hyperparameters