i1j commited on
Commit
2001bb6
·
verified ·
1 Parent(s): 3bdb5ef

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - cross-encoder
5
+ - reranker
6
+ base_model: BAAI/bge-reranker-v2-m3
7
+ pipeline_tag: text-ranking
8
+ library_name: sentence-transformers
9
+ ---
10
+
11
+ # CrossEncoder based on BAAI/bge-reranker-v2-m3
12
+
13
+ This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) 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.
14
+
15
+ ## Model Details
16
+
17
+ ### Model Description
18
+ - **Model Type:** Cross Encoder
19
+ - **Base model:** [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) <!-- at revision 953dc6f6f85a1b2dbfca4c34a2796e7dde08d41e -->
20
+ - **Maximum Sequence Length:** 8192 tokens
21
+ - **Number of Output Labels:** 1 label
22
+ - **Supported Modality:** Text
23
+ <!-- - **Training Dataset:** Unknown -->
24
+ <!-- - **Language:** Unknown -->
25
+ <!-- - **License:** Unknown -->
26
+
27
+ ### Model Sources
28
+
29
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
30
+ - **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
31
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
32
+ - **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
33
+
34
+ ### Full Model Architecture
35
+
36
+ ```
37
+ CrossEncoder(
38
+ (0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'XLMRobertaForSequenceClassification'})
39
+ )
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ ### Direct Usage (Sentence Transformers)
45
+
46
+ First install the Sentence Transformers library:
47
+
48
+ ```bash
49
+ pip install -U sentence-transformers
50
+ ```
51
+
52
+ Then you can load this model and run inference.
53
+ ```python
54
+ from sentence_transformers import CrossEncoder
55
+
56
+ # Download from the 🤗 Hub
57
+ model = CrossEncoder("el1jah184/reranker")
58
+ # Get scores for pairs of inputs
59
+ pairs = [
60
+ ['How many calories in an egg', 'There are on average between 55 and 80 calories in an egg depending on its size.'],
61
+ ['How many calories in an egg', 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.'],
62
+ ['How many calories in an egg', 'Most of the calories in an egg come from the yellow yolk in the center.'],
63
+ ]
64
+ scores = model.predict(pairs)
65
+ print(scores)
66
+ # [0.9969 0.0862 0.0834]
67
+
68
+ # Or rank different texts based on similarity to a single text
69
+ ranks = model.rank(
70
+ 'How many calories in an egg',
71
+ [
72
+ 'There are on average between 55 and 80 calories in an egg depending on its size.',
73
+ 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.',
74
+ 'Most of the calories in an egg come from the yellow yolk in the center.',
75
+ ]
76
+ )
77
+ # [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
78
+ ```
79
+
80
+ <!--
81
+ ### Direct Usage (Transformers)
82
+
83
+ <details><summary>Click to see the direct usage in Transformers</summary>
84
+
85
+ </details>
86
+ -->
87
+
88
+ <!--
89
+ ### Downstream Usage (Sentence Transformers)
90
+
91
+ You can finetune this model on your own dataset.
92
+
93
+ <details><summary>Click to expand</summary>
94
+
95
+ </details>
96
+ -->
97
+
98
+ <!--
99
+ ### Out-of-Scope Use
100
+
101
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
102
+ -->
103
+
104
+ <!--
105
+ ## Bias, Risks and Limitations
106
+
107
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
108
+ -->
109
+
110
+ <!--
111
+ ### Recommendations
112
+
113
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
114
+ -->
115
+
116
+ ## Training Details
117
+
118
+ ### Framework Versions
119
+ - Python: 3.12.13
120
+ - Sentence Transformers: 6.0.1
121
+ - Transformers: 5.0.0
122
+ - PyTorch: 2.10.0+cu128
123
+ - Accelerate: 1.13.0
124
+ - Datasets: 5.0.0
125
+ - Tokenizers: 0.22.2
126
+
127
+ ## Additional Resources
128
+
129
+ - [Training and Finetuning Reranker Models with Sentence Transformers](https://huggingface.co/blog/train-reranker): the end-to-end guide for training or finetuning Cross Encoder (reranker) models.
130
+ - [Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/multimodal-sentence-transformers): use text, image, audio, and video reranker models through the same API.
131
+ - [Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers](https://huggingface.co/blog/train-multimodal-sentence-transformers): training multimodal Cross Encoders.
132
+
133
+ ## Citation
134
+
135
+ ### BibTeX
136
+
137
+ <!--
138
+ ## Glossary
139
+
140
+ *Clearly define terms in order to be accessible across audiences.*
141
+ -->
142
+
143
+ <!--
144
+ ## Model Card Authors
145
+
146
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
147
+ -->
148
+
149
+ <!--
150
+ ## Model Card Contact
151
+
152
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
153
+ -->
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "XLMRobertaForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": 2,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 1024,
14
+ "id2label": {
15
+ "0": "LABEL_0"
16
+ },
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 4096,
19
+ "is_decoder": false,
20
+ "label2id": {
21
+ "LABEL_0": 0
22
+ },
23
+ "layer_norm_eps": 1e-05,
24
+ "max_position_embeddings": 8194,
25
+ "model_type": "xlm-roberta",
26
+ "num_attention_heads": 16,
27
+ "num_hidden_layers": 24,
28
+ "output_past": true,
29
+ "pad_token_id": 1,
30
+ "position_embedding_type": "absolute",
31
+ "tie_word_embeddings": true,
32
+ "transformers_version": "5.0.0",
33
+ "type_vocab_size": 1,
34
+ "use_cache": true,
35
+ "vocab_size": 250002
36
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.10.0+cu128",
4
+ "sentence_transformers": "6.0.1",
5
+ "transformers": "5.0.0"
6
+ },
7
+ "activation_fn": "torch.nn.modules.activation.Sigmoid",
8
+ "default_prompt_name": null,
9
+ "model_type": "CrossEncoder",
10
+ "prompts": {}
11
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:216916ae0b6486965438b23dd175b827775910c68e7d516fcf843d92fe92f115
3
+ size 2271071804
modules.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.base.modules.transformer.Transformer"
7
+ }
8
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "sequence-classification",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "logits"
7
+ }
8
+ },
9
+ "module_output_name": "scores"
10
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc552f2faa9ccaf0be4136806b77d442c6f81061a20ce3c569927d3908599284
3
+ size 16781485
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<s>",
5
+ "clean_up_tokenization_spaces": true,
6
+ "cls_token": "<s>",
7
+ "eos_token": "</s>",
8
+ "is_local": false,
9
+ "mask_token": "<mask>",
10
+ "model_max_length": 8192,
11
+ "pad_token": "<pad>",
12
+ "sep_token": "</s>",
13
+ "sp_model_kwargs": {},
14
+ "tokenizer_class": "XLMRobertaTokenizer",
15
+ "unk_token": "<unk>"
16
+ }