Add new SentenceTransformer model
Browse files- 1_Pooling/config.json +10 -0
- README.md +168 -0
- config.json +31 -0
- config_sentence_transformers.json +10 -0
- model.safetensors +3 -0
- modules.json +20 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +37 -0
- tokenizer.json +0 -0
- tokenizer_config.json +58 -0
- vocab.txt +0 -0
1_Pooling/config.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 384,
|
3 |
+
"pooling_mode_cls_token": true,
|
4 |
+
"pooling_mode_mean_tokens": false,
|
5 |
+
"pooling_mode_max_tokens": false,
|
6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
7 |
+
"pooling_mode_weightedmean_tokens": false,
|
8 |
+
"pooling_mode_lasttoken": false,
|
9 |
+
"include_prompt": true
|
10 |
+
}
|
README.md
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- sentence-transformers
|
4 |
+
- sentence-similarity
|
5 |
+
- feature-extraction
|
6 |
+
- generated_from_trainer
|
7 |
+
- loss:CoSENTLoss
|
8 |
+
base_model: BAAI/bge-small-en-v1.5
|
9 |
+
pipeline_tag: sentence-similarity
|
10 |
+
library_name: sentence-transformers
|
11 |
+
---
|
12 |
+
|
13 |
+
# SentenceTransformer based on BAAI/bge-small-en-v1.5
|
14 |
+
|
15 |
+
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5). It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
|
16 |
+
|
17 |
+
## Model Details
|
18 |
+
|
19 |
+
### Model Description
|
20 |
+
- **Model Type:** Sentence Transformer
|
21 |
+
- **Base model:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) <!-- at revision 5c38ec7c405ec4b44b94cc5a9bb96e735b38267a -->
|
22 |
+
- **Maximum Sequence Length:** 512 tokens
|
23 |
+
- **Output Dimensionality:** 384 dimensions
|
24 |
+
- **Similarity Function:** Cosine Similarity
|
25 |
+
<!-- - **Training Dataset:** Unknown -->
|
26 |
+
<!-- - **Language:** Unknown -->
|
27 |
+
<!-- - **License:** Unknown -->
|
28 |
+
|
29 |
+
### Model Sources
|
30 |
+
|
31 |
+
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
32 |
+
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
33 |
+
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
34 |
+
|
35 |
+
### Full Model Architecture
|
36 |
+
|
37 |
+
```
|
38 |
+
SentenceTransformer(
|
39 |
+
(0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
|
40 |
+
(1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
|
41 |
+
(2): Normalize()
|
42 |
+
)
|
43 |
+
```
|
44 |
+
|
45 |
+
## Usage
|
46 |
+
|
47 |
+
### Direct Usage (Sentence Transformers)
|
48 |
+
|
49 |
+
First install the Sentence Transformers library:
|
50 |
+
|
51 |
+
```bash
|
52 |
+
pip install -U sentence-transformers
|
53 |
+
```
|
54 |
+
|
55 |
+
Then you can load this model and run inference.
|
56 |
+
```python
|
57 |
+
from sentence_transformers import SentenceTransformer
|
58 |
+
|
59 |
+
# Download from the 🤗 Hub
|
60 |
+
model = SentenceTransformer("kimhyeongjun/setfit-bge-small-v1.5-setfit-PatentClassification")
|
61 |
+
# Run inference
|
62 |
+
sentences = [
|
63 |
+
'The weather is lovely today.',
|
64 |
+
"It's so sunny outside!",
|
65 |
+
'He drove to the stadium.',
|
66 |
+
]
|
67 |
+
embeddings = model.encode(sentences)
|
68 |
+
print(embeddings.shape)
|
69 |
+
# [3, 384]
|
70 |
+
|
71 |
+
# Get the similarity scores for the embeddings
|
72 |
+
similarities = model.similarity(embeddings, embeddings)
|
73 |
+
print(similarities.shape)
|
74 |
+
# [3, 3]
|
75 |
+
```
|
76 |
+
|
77 |
+
<!--
|
78 |
+
### Direct Usage (Transformers)
|
79 |
+
|
80 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
81 |
+
|
82 |
+
</details>
|
83 |
+
-->
|
84 |
+
|
85 |
+
<!--
|
86 |
+
### Downstream Usage (Sentence Transformers)
|
87 |
+
|
88 |
+
You can finetune this model on your own dataset.
|
89 |
+
|
90 |
+
<details><summary>Click to expand</summary>
|
91 |
+
|
92 |
+
</details>
|
93 |
+
-->
|
94 |
+
|
95 |
+
<!--
|
96 |
+
### Out-of-Scope Use
|
97 |
+
|
98 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
99 |
+
-->
|
100 |
+
|
101 |
+
<!--
|
102 |
+
## Bias, Risks and Limitations
|
103 |
+
|
104 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
105 |
+
-->
|
106 |
+
|
107 |
+
<!--
|
108 |
+
### Recommendations
|
109 |
+
|
110 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
111 |
+
-->
|
112 |
+
|
113 |
+
## Training Details
|
114 |
+
|
115 |
+
### Framework Versions
|
116 |
+
- Python: 3.11.11
|
117 |
+
- Sentence Transformers: 3.4.1
|
118 |
+
- Transformers: 4.48.3
|
119 |
+
- PyTorch: 2.5.1+cu124
|
120 |
+
- Accelerate: 1.3.0
|
121 |
+
- Datasets: 3.3.1
|
122 |
+
- Tokenizers: 0.21.0
|
123 |
+
|
124 |
+
## Citation
|
125 |
+
|
126 |
+
### BibTeX
|
127 |
+
|
128 |
+
#### Sentence Transformers
|
129 |
+
```bibtex
|
130 |
+
@inproceedings{reimers-2019-sentence-bert,
|
131 |
+
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
132 |
+
author = "Reimers, Nils and Gurevych, Iryna",
|
133 |
+
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
134 |
+
month = "11",
|
135 |
+
year = "2019",
|
136 |
+
publisher = "Association for Computational Linguistics",
|
137 |
+
url = "https://arxiv.org/abs/1908.10084",
|
138 |
+
}
|
139 |
+
```
|
140 |
+
|
141 |
+
#### CoSENTLoss
|
142 |
+
```bibtex
|
143 |
+
@online{kexuefm-8847,
|
144 |
+
title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
|
145 |
+
author={Su Jianlin},
|
146 |
+
year={2022},
|
147 |
+
month={Jan},
|
148 |
+
url={https://kexue.fm/archives/8847},
|
149 |
+
}
|
150 |
+
```
|
151 |
+
|
152 |
+
<!--
|
153 |
+
## Glossary
|
154 |
+
|
155 |
+
*Clearly define terms in order to be accessible across audiences.*
|
156 |
+
-->
|
157 |
+
|
158 |
+
<!--
|
159 |
+
## Model Card Authors
|
160 |
+
|
161 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
162 |
+
-->
|
163 |
+
|
164 |
+
<!--
|
165 |
+
## Model Card Contact
|
166 |
+
|
167 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
168 |
+
-->
|
config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "BAAI/bge-small-en-v1.5",
|
3 |
+
"architectures": [
|
4 |
+
"BertModel"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"classifier_dropout": null,
|
8 |
+
"hidden_act": "gelu",
|
9 |
+
"hidden_dropout_prob": 0.1,
|
10 |
+
"hidden_size": 384,
|
11 |
+
"id2label": {
|
12 |
+
"0": "LABEL_0"
|
13 |
+
},
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"intermediate_size": 1536,
|
16 |
+
"label2id": {
|
17 |
+
"LABEL_0": 0
|
18 |
+
},
|
19 |
+
"layer_norm_eps": 1e-12,
|
20 |
+
"max_position_embeddings": 512,
|
21 |
+
"model_type": "bert",
|
22 |
+
"num_attention_heads": 12,
|
23 |
+
"num_hidden_layers": 12,
|
24 |
+
"pad_token_id": 0,
|
25 |
+
"position_embedding_type": "absolute",
|
26 |
+
"torch_dtype": "float32",
|
27 |
+
"transformers_version": "4.48.3",
|
28 |
+
"type_vocab_size": 2,
|
29 |
+
"use_cache": true,
|
30 |
+
"vocab_size": 30522
|
31 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "3.4.1",
|
4 |
+
"transformers": "4.48.3",
|
5 |
+
"pytorch": "2.5.1+cu124"
|
6 |
+
},
|
7 |
+
"prompts": {},
|
8 |
+
"default_prompt_name": null,
|
9 |
+
"similarity_fn_name": "cosine"
|
10 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5a22dff7b2f82b888721fca5e0c9b252657c8e57d098334329137563f3941957
|
3 |
+
size 133462128
|
modules.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"idx": 0,
|
4 |
+
"name": "0",
|
5 |
+
"path": "",
|
6 |
+
"type": "sentence_transformers.models.Transformer"
|
7 |
+
},
|
8 |
+
{
|
9 |
+
"idx": 1,
|
10 |
+
"name": "1",
|
11 |
+
"path": "1_Pooling",
|
12 |
+
"type": "sentence_transformers.models.Pooling"
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"idx": 2,
|
16 |
+
"name": "2",
|
17 |
+
"path": "2_Normalize",
|
18 |
+
"type": "sentence_transformers.models.Normalize"
|
19 |
+
}
|
20 |
+
]
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 512,
|
3 |
+
"do_lower_case": true
|
4 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": {
|
3 |
+
"content": "[CLS]",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"mask_token": {
|
10 |
+
"content": "[MASK]",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "[PAD]",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"sep_token": {
|
24 |
+
"content": "[SEP]",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"unk_token": {
|
31 |
+
"content": "[UNK]",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": false,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false
|
36 |
+
}
|
37 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "[PAD]",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"100": {
|
12 |
+
"content": "[UNK]",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"101": {
|
20 |
+
"content": "[CLS]",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"102": {
|
28 |
+
"content": "[SEP]",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"103": {
|
36 |
+
"content": "[MASK]",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": false,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"clean_up_tokenization_spaces": true,
|
45 |
+
"cls_token": "[CLS]",
|
46 |
+
"do_basic_tokenize": true,
|
47 |
+
"do_lower_case": true,
|
48 |
+
"extra_special_tokens": {},
|
49 |
+
"mask_token": "[MASK]",
|
50 |
+
"model_max_length": 512,
|
51 |
+
"never_split": null,
|
52 |
+
"pad_token": "[PAD]",
|
53 |
+
"sep_token": "[SEP]",
|
54 |
+
"strip_accents": null,
|
55 |
+
"tokenize_chinese_chars": true,
|
56 |
+
"tokenizer_class": "BertTokenizer",
|
57 |
+
"unk_token": "[UNK]"
|
58 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|