初始化项目,由ModelHub XC社区提供模型
Model: cross-encoder/ms-marco-MiniLM-L4-v2 Source: Original Platform
This commit is contained in:
18
.gitattributes
vendored
Normal file
18
.gitattributes
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
80
README.md
Normal file
80
README.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
datasets:
|
||||
- sentence-transformers/msmarco
|
||||
language:
|
||||
- en
|
||||
base_model:
|
||||
- cross-encoder/ms-marco-MiniLM-L12-v2
|
||||
pipeline_tag: text-ranking
|
||||
library_name: sentence-transformers
|
||||
tags:
|
||||
- transformers
|
||||
---
|
||||
# Cross-Encoder for MS Marco
|
||||
|
||||
This model was trained on the [MS Marco Passage Ranking](https://github.com/microsoft/MSMARCO-Passage-Ranking) task.
|
||||
|
||||
The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See [SBERT.net Retrieve & Re-rank](https://www.sbert.net/examples/applications/retrieve_rerank/README.html) for more details. The training code is available here: [SBERT.net Training MS Marco](https://github.com/UKPLab/sentence-transformers/tree/master/examples/cross_encoder/training/ms_marco)
|
||||
|
||||
|
||||
## Usage with SentenceTransformers
|
||||
|
||||
The usage is easy when you have [SentenceTransformers](https://www.sbert.net/) installed. Then you can use the pre-trained models like this:
|
||||
```python
|
||||
from sentence_transformers import CrossEncoder
|
||||
|
||||
model = CrossEncoder('cross-encoder/ms-marco-MiniLM-L4-v2')
|
||||
scores = model.predict([
|
||||
("How many people live in Berlin?", "Berlin had a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers."),
|
||||
("How many people live in Berlin?", "Berlin is well known for its museums."),
|
||||
])
|
||||
print(scores)
|
||||
# [ 9.1273365 -4.569759 ]
|
||||
```
|
||||
|
||||
|
||||
## Usage with Transformers
|
||||
|
||||
```python
|
||||
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
||||
import torch
|
||||
|
||||
model = AutoModelForSequenceClassification.from_pretrained('cross-encoder/ms-marco-MiniLM-L4-v2')
|
||||
tokenizer = AutoTokenizer.from_pretrained('cross-encoder/ms-marco-MiniLM-L4-v2')
|
||||
|
||||
features = tokenizer(['How many people live in Berlin?', 'How many people live in Berlin?'], ['Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'], padding=True, truncation=True, return_tensors="pt")
|
||||
|
||||
model.eval()
|
||||
with torch.no_grad():
|
||||
scores = model(**features).logits
|
||||
print(scores)
|
||||
```
|
||||
|
||||
|
||||
## Performance
|
||||
In the following table, we provide various pre-trained Cross-Encoders together with their performance on the [TREC Deep Learning 2019](https://microsoft.github.io/TREC-2019-Deep-Learning/) and the [MS Marco Passage Reranking](https://github.com/microsoft/MSMARCO-Passage-Ranking/) dataset.
|
||||
|
||||
|
||||
| Model-Name | NDCG@10 (TREC DL 19) | MRR@10 (MS Marco Dev) | Docs / Sec |
|
||||
| ------------- |:-------------| -----| --- |
|
||||
| **Version 2 models** | | |
|
||||
| cross-encoder/ms-marco-TinyBERT-L2-v2 | 69.84 | 32.56 | 9000
|
||||
| cross-encoder/ms-marco-MiniLM-L2-v2 | 71.01 | 34.85 | 4100
|
||||
| cross-encoder/ms-marco-MiniLM-L4-v2 | 73.04 | 37.70 | 2500
|
||||
| cross-encoder/ms-marco-MiniLM-L6-v2 | 74.30 | 39.01 | 1800
|
||||
| cross-encoder/ms-marco-MiniLM-L12-v2 | 74.31 | 39.02 | 960
|
||||
| **Version 1 models** | | |
|
||||
| cross-encoder/ms-marco-TinyBERT-L2 | 67.43 | 30.15 | 9000
|
||||
| cross-encoder/ms-marco-TinyBERT-L4 | 68.09 | 34.50 | 2900
|
||||
| cross-encoder/ms-marco-TinyBERT-L6 | 69.57 | 36.13 | 680
|
||||
| cross-encoder/ms-marco-electra-base | 71.99 | 36.41 | 340
|
||||
| **Other models** | | |
|
||||
| nboost/pt-tinybert-msmarco | 63.63 | 28.80 | 2900
|
||||
| nboost/pt-bert-base-uncased-msmarco | 70.94 | 34.75 | 340
|
||||
| nboost/pt-bert-large-msmarco | 73.36 | 36.48 | 100
|
||||
| Capreolus/electra-base-msmarco | 71.23 | 36.89 | 340
|
||||
| amberoad/bert-multilingual-passage-reranking-msmarco | 68.40 | 35.54 | 330
|
||||
| sebastian-hofstaetter/distilbert-cat-margin_mse-T2-msmarco | 72.82 | 37.88 | 720
|
||||
|
||||
Note: Runtime was computed on a V100 GPU.
|
||||
31
config.json
Normal file
31
config.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"_name_or_path": "cross-encoder/ms-marco-MiniLM-L-12-v2",
|
||||
"architectures": [
|
||||
"BertForSequenceClassification"
|
||||
],
|
||||
"attention_probs_dropout_prob": 0.1,
|
||||
"gradient_checkpointing": false,
|
||||
"hidden_act": "gelu",
|
||||
"hidden_dropout_prob": 0.1,
|
||||
"hidden_size": 384,
|
||||
"id2label": {
|
||||
"0": "LABEL_0"
|
||||
},
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 1536,
|
||||
"label2id": {
|
||||
"LABEL_0": 0
|
||||
},
|
||||
"layer_norm_eps": 1e-12,
|
||||
"max_position_embeddings": 512,
|
||||
"model_type": "bert",
|
||||
"num_attention_heads": 12,
|
||||
"num_hidden_layers": 4,
|
||||
"pad_token_id": 0,
|
||||
"position_embedding_type": "absolute",
|
||||
"transformers_version": "4.4.2",
|
||||
"type_vocab_size": 2,
|
||||
"use_cache": true,
|
||||
"vocab_size": 30522,
|
||||
"sbert_ce_default_activation_function": "torch.nn.modules.linear.Identity"
|
||||
}
|
||||
3
flax_model.msgpack
Normal file
3
flax_model.msgpack
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6696cd546b6959985a1727285986b9d09737576e9b3f93e8dc4fdf1f42681939
|
||||
size 76661362
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3db1c98132b54901976d6da56fa711756c7780a6263d5db8f336232584f5fe58
|
||||
size 76671186
|
||||
3
onnx/model.onnx
Normal file
3
onnx/model.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:be236c7578579650f5eb69e6c7c79dc8a5af985dc585d98aafd9c0d3c0abcd20
|
||||
size 76767292
|
||||
3
onnx/model_O1.onnx
Normal file
3
onnx/model_O1.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:45b021acb95174d24f934e026c9d434ea7c84e6625ec665f71f8a87710abfacc
|
||||
size 76734508
|
||||
3
onnx/model_O2.onnx
Normal file
3
onnx/model_O2.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4ca7ed6294c51ac55ae58a54f07670f04a75ac34b6e3fa83b3ada9cda88d5a5c
|
||||
size 76676531
|
||||
3
onnx/model_O3.onnx
Normal file
3
onnx/model_O3.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a969f82ecdc474a4027cb9e7dd73c60a3454cd8585c2c0c83d104c40162934d3
|
||||
size 76676489
|
||||
3
onnx/model_O4.onnx
Normal file
3
onnx/model_O4.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:89a50b9276ab49a4217815a2f091d4115f72ecb0891cc8339f7afbef95be4a2d
|
||||
size 38392586
|
||||
3
onnx/model_qint8_arm64.onnx
Normal file
3
onnx/model_qint8_arm64.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2e3e3db7950be6eb9abd7b689a8b994b7ceef1c76d9deca748ef7298533afa3a
|
||||
size 19497383
|
||||
3
onnx/model_qint8_avx512.onnx
Normal file
3
onnx/model_qint8_avx512.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2e3e3db7950be6eb9abd7b689a8b994b7ceef1c76d9deca748ef7298533afa3a
|
||||
size 19497383
|
||||
3
onnx/model_qint8_avx512_vnni.onnx
Normal file
3
onnx/model_qint8_avx512_vnni.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2e3e3db7950be6eb9abd7b689a8b994b7ceef1c76d9deca748ef7298533afa3a
|
||||
size 19497383
|
||||
3
onnx/model_quint8_avx2.onnx
Normal file
3
onnx/model_quint8_avx2.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:74118ad9ab2b17990c40f03085a91f131339bb3a6d629e96507a6dbf063dae3d
|
||||
size 19497383
|
||||
3
openvino/openvino_model.bin
Normal file
3
openvino/openvino_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c98398f19870207c26da0fbe0d381ce4221ac4c225bd15b9caf48093a2eb3a73
|
||||
size 76662944
|
||||
4723
openvino/openvino_model.xml
Normal file
4723
openvino/openvino_model.xml
Normal file
File diff suppressed because it is too large
Load Diff
3
openvino/openvino_model_qint8_quantized.bin
Normal file
3
openvino/openvino_model_qint8_quantized.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:026119caa48e8080a5dd81b7de4a49050718c807c0fa6f2714e2a150244891b6
|
||||
size 19459556
|
||||
7971
openvino/openvino_model_qint8_quantized.xml
Normal file
7971
openvino/openvino_model_qint8_quantized.xml
Normal file
File diff suppressed because it is too large
Load Diff
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:943560a8b409a98f7b1addf7f93d0c09efb2a3027daa12680ab3cf07b7298fe7
|
||||
size 76693769
|
||||
7
special_tokens_map.json
Normal file
7
special_tokens_map.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"cls_token": "[CLS]",
|
||||
"mask_token": "[MASK]",
|
||||
"pad_token": "[PAD]",
|
||||
"sep_token": "[SEP]",
|
||||
"unk_token": "[UNK]"
|
||||
}
|
||||
30672
tokenizer.json
Normal file
30672
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
58
tokenizer_config.json
Normal file
58
tokenizer_config.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"added_tokens_decoder": {
|
||||
"0": {
|
||||
"content": "[PAD]",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"100": {
|
||||
"content": "[UNK]",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"101": {
|
||||
"content": "[CLS]",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"102": {
|
||||
"content": "[SEP]",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"103": {
|
||||
"content": "[MASK]",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
}
|
||||
},
|
||||
"clean_up_tokenization_spaces": true,
|
||||
"cls_token": "[CLS]",
|
||||
"do_basic_tokenize": true,
|
||||
"do_lower_case": true,
|
||||
"extra_special_tokens": {},
|
||||
"mask_token": "[MASK]",
|
||||
"model_max_length": 512,
|
||||
"never_split": null,
|
||||
"pad_token": "[PAD]",
|
||||
"sep_token": "[SEP]",
|
||||
"strip_accents": null,
|
||||
"tokenize_chinese_chars": true,
|
||||
"tokenizer_class": "BertTokenizer",
|
||||
"unk_token": "[UNK]"
|
||||
}
|
||||
Reference in New Issue
Block a user