---
tags:
- sentence-transformers
- cross-encoder
- generated_from_trainer
- dataset_size:25200
- loss:FitMixinLoss
base_model: cross-encoder/ms-marco-MiniLM-L6-v2
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 cross-encoder/ms-marco-MiniLM-L6-v2
results:
- task:
type: cross-encoder-binary-classification
name: Cross Encoder Binary Classification
dataset:
name: Quora dev
type: Quora-dev
metrics:
- type: accuracy
value: 0.9117857142857143
name: Accuracy
- type: accuracy_threshold
value: -0.3892792761325836
name: Accuracy Threshold
- type: f1
value: 0.82537517053206
name: F1
- type: f1_threshold
value: -1.1287775039672852
name: F1 Threshold
- type: precision
value: 0.7898172323759791
name: Precision
- type: recall
value: 0.8642857142857143
name: Recall
- type: average_precision
value: 0.8781226951791343
name: Average Precision
---
# CrossEncoder based on cross-encoder/ms-marco-MiniLM-L6-v2
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [cross-encoder/ms-marco-MiniLM-L6-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L6-v2) 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:** [cross-encoder/ms-marco-MiniLM-L6-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L6-v2)
- **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("cross_encoder_model_id")
# Get scores for pairs of texts
pairs = [
["How does the `DPMSolverMultistepInverse` scheduler relate to DDIM inversion and DPM-Solver's forward and reverse processes?", 'DPMSolverMultistepInverseis the inverted scheduler fromDPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 StepsandDPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Modelsby Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. The implementation is mostly based on the DDIM inversion definition ofNull-text Inversion for Editing Real Images using Guided Diffusion Modelsand notebook implementation of theDiffEditlatent inversion fromXiang-cd/DiffEdit-stable-diffusion.'],
['How can I optimize AudioLDM prompt engineering and inference for faster, higher-quality audio generation?', 'The model usually performs well without requiring any finetuning. The architecture follows a classic encoder-decoder architecture, which means that it relies on thegenerate()function for inference. One can useWhisperProcessorto prepare audio for the model, and decode the predicted ID’s back into text. To convert the model and the processor, we recommend using the following: The script will automatically determine all necessary parameters from the OpenAI checkpoint. Atiktokenlibrary needs to be installed to perform the conversion of the OpenAI tokenizer to thetokenizersversion.'],
['What AuraFlow-related attention processing tasks does the `AuraFlowAttnProcessor2_0` model excel at?', '() Attention processor used in Mochi.'],
['What are the key capabilities and applications of the CLIP (Contrastive Language-Image Pre-training) model?', 'The code snippet below shows how to compute image & text features and similarities: Currently, following scales of pretrained Chinese-CLIP models are available on 🤗 Hub:'],
['How effectively does CogVideoX translate text prompts into 720x480 videos?', 'To generate a video from prompt, run the following Python code: You can change these parameters in the pipeline call: We can also generate longer videos by doing the processing in a chunk-by-chunk manner:'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
"How does the `DPMSolverMultistepInverse` scheduler relate to DDIM inversion and DPM-Solver's forward and reverse processes?",
[
'DPMSolverMultistepInverseis the inverted scheduler fromDPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 StepsandDPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Modelsby Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. The implementation is mostly based on the DDIM inversion definition ofNull-text Inversion for Editing Real Images using Guided Diffusion Modelsand notebook implementation of theDiffEditlatent inversion fromXiang-cd/DiffEdit-stable-diffusion.',
'The model usually performs well without requiring any finetuning. The architecture follows a classic encoder-decoder architecture, which means that it relies on thegenerate()function for inference. One can useWhisperProcessorto prepare audio for the model, and decode the predicted ID’s back into text. To convert the model and the processor, we recommend using the following: The script will automatically determine all necessary parameters from the OpenAI checkpoint. Atiktokenlibrary needs to be installed to perform the conversion of the OpenAI tokenizer to thetokenizersversion.',
'() Attention processor used in Mochi.',
'The code snippet below shows how to compute image & text features and similarities: Currently, following scales of pretrained Chinese-CLIP models are available on 🤗 Hub:',
'To generate a video from prompt, run the following Python code: You can change these parameters in the pipeline call: We can also generate longer videos by doing the processing in a chunk-by-chunk manner:',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Evaluation
### Metrics
#### Cross Encoder Binary Classification
* Dataset: `Quora-dev`
* Evaluated with [CEBinaryClassificationEvaluator
](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CEBinaryClassificationEvaluator)
| Metric | Value |
|:----------------------|:-----------|
| accuracy | 0.9118 |
| accuracy_threshold | -0.3893 |
| f1 | 0.8254 |
| f1_threshold | -1.1288 |
| precision | 0.7898 |
| recall | 0.8643 |
| **average_precision** | **0.8781** |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 25,200 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 | int |
| details |
How does the `DPMSolverMultistepInverse` scheduler relate to DDIM inversion and DPM-Solver's forward and reverse processes?
| DPMSolverMultistepInverseis the inverted scheduler fromDPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 StepsandDPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Modelsby Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. The implementation is mostly based on the DDIM inversion definition ofNull-text Inversion for Editing Real Images using Guided Diffusion Modelsand notebook implementation of theDiffEditlatent inversion fromXiang-cd/DiffEdit-stable-diffusion.
| 1
|
| How can I optimize AudioLDM prompt engineering and inference for faster, higher-quality audio generation?
| The model usually performs well without requiring any finetuning. The architecture follows a classic encoder-decoder architecture, which means that it relies on thegenerate()function for inference. One can useWhisperProcessorto prepare audio for the model, and decode the predicted ID’s back into text. To convert the model and the processor, we recommend using the following: The script will automatically determine all necessary parameters from the OpenAI checkpoint. Atiktokenlibrary needs to be installed to perform the conversion of the OpenAI tokenizer to thetokenizersversion.
| 0
|
| What AuraFlow-related attention processing tasks does the `AuraFlowAttnProcessor2_0` model excel at?
| () Attention processor used in Mochi.
| 0
|
* Loss: [FitMixinLoss
](https://sbert.net/docs/package_reference/cross_encoder/losses.html#fitmixinloss)
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 32
- `per_device_eval_batch_size`: 32
- `num_train_epochs`: 2
#### All Hyperparameters