Add new SentenceTransformer model
Browse files- 1_Pooling/config.json +10 -0
- README.md +99 -155
- config.json +1 -1
- config_sentence_transformers.json +14 -0
- entity_embeddings.npy +1 -1
- modules.json +14 -0
- sentence_bert_config.json +4 -0
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"word_embedding_dimension": 768,
|
| 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
CHANGED
|
@@ -1,199 +1,143 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
-
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
### Model Description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 19 |
-
|
| 20 |
-
- **Developed by:** [More Information Needed]
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
##
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
|
|
|
| 55 |
|
| 56 |
-
|
|
|
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
|
|
|
| 63 |
|
| 64 |
-
|
|
|
|
| 65 |
|
| 66 |
-
|
|
|
|
| 67 |
|
| 68 |
-
|
|
|
|
| 69 |
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
-
|
|
|
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
-
###
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 94 |
-
|
| 95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
-
|
| 97 |
-
#### Speeds, Sizes, Times [optional]
|
| 98 |
-
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
|
| 185 |
-
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
|
|
|
| 190 |
|
| 191 |
-
|
|
|
|
| 192 |
|
| 193 |
-
|
|
|
|
| 194 |
|
| 195 |
-
|
|
|
|
| 196 |
|
|
|
|
| 197 |
## Model Card Contact
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
tags:
|
| 3 |
+
- sentence-transformers
|
| 4 |
+
- sentence-similarity
|
| 5 |
+
- feature-extraction
|
| 6 |
+
- dense
|
| 7 |
+
pipeline_tag: sentence-similarity
|
| 8 |
+
library_name: sentence-transformers
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# SentenceTransformer
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
This is a [sentence-transformers](https://www.SBERT.net) model trained. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
|
| 14 |
|
| 15 |
## Model Details
|
| 16 |
|
| 17 |
### Model Description
|
| 18 |
+
- **Model Type:** Sentence Transformer
|
| 19 |
+
<!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
|
| 20 |
+
- **Maximum Sequence Length:** 512 tokens
|
| 21 |
+
- **Output Dimensionality:** 768 dimensions
|
| 22 |
+
- **Similarity Function:** Cosine Similarity
|
| 23 |
+
<!-- - **Training Dataset:** Unknown -->
|
| 24 |
+
<!-- - **Language:** Unknown -->
|
| 25 |
+
<!-- - **License:** Unknown -->
|
| 26 |
|
| 27 |
+
### Model Sources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
| 30 |
+
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
| 31 |
+
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
| 32 |
|
| 33 |
+
### Full Model Architecture
|
| 34 |
|
| 35 |
+
```
|
| 36 |
+
SentenceTransformer(
|
| 37 |
+
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'KPRModelForBert'})
|
| 38 |
+
(1): Pooling({'word_embedding_dimension': 768, '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})
|
| 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 SentenceTransformer
|
| 55 |
|
| 56 |
+
# Download from the 🤗 Hub
|
| 57 |
+
model = SentenceTransformer("knowledgeable-ai/kpr-bert-base-uncased")
|
| 58 |
+
# Run inference
|
| 59 |
+
sentences = [
|
| 60 |
+
'The weather is lovely today.',
|
| 61 |
+
"It's so sunny outside!",
|
| 62 |
+
'He drove to the stadium.',
|
| 63 |
+
]
|
| 64 |
+
embeddings = model.encode(sentences)
|
| 65 |
+
print(embeddings.shape)
|
| 66 |
+
# [3, 768]
|
| 67 |
|
| 68 |
+
# Get the similarity scores for the embeddings
|
| 69 |
+
similarities = model.similarity(embeddings, embeddings)
|
| 70 |
+
print(similarities)
|
| 71 |
+
# tensor([[1.0000, 0.9583, 0.9074],
|
| 72 |
+
# [0.9583, 1.0000, 0.9121],
|
| 73 |
+
# [0.9074, 0.9121, 1.0000]])
|
| 74 |
+
```
|
| 75 |
|
| 76 |
+
<!--
|
| 77 |
+
### Direct Usage (Transformers)
|
| 78 |
|
| 79 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
| 80 |
|
| 81 |
+
</details>
|
| 82 |
+
-->
|
| 83 |
|
| 84 |
+
<!--
|
| 85 |
+
### Downstream Usage (Sentence Transformers)
|
| 86 |
|
| 87 |
+
You can finetune this model on your own dataset.
|
| 88 |
|
| 89 |
+
<details><summary>Click to expand</summary>
|
| 90 |
|
| 91 |
+
</details>
|
| 92 |
+
-->
|
| 93 |
|
| 94 |
+
<!--
|
| 95 |
+
### Out-of-Scope Use
|
| 96 |
|
| 97 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 98 |
+
-->
|
| 99 |
|
| 100 |
+
<!--
|
| 101 |
+
## Bias, Risks and Limitations
|
| 102 |
|
| 103 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
| 104 |
+
-->
|
| 105 |
|
| 106 |
+
<!--
|
| 107 |
+
### Recommendations
|
| 108 |
|
| 109 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 110 |
+
-->
|
| 111 |
|
| 112 |
## Training Details
|
| 113 |
|
| 114 |
+
### Framework Versions
|
| 115 |
+
- Python: 3.10.14
|
| 116 |
+
- Sentence Transformers: 5.2.0.dev0
|
| 117 |
+
- Transformers: 4.55.4
|
| 118 |
+
- PyTorch: 2.4.0+cu121
|
| 119 |
+
- Accelerate: 0.34.2
|
| 120 |
+
- Datasets: 2.16.1
|
| 121 |
+
- Tokenizers: 0.21.4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
+
## Citation
|
| 124 |
|
| 125 |
+
### BibTeX
|
| 126 |
|
| 127 |
+
<!--
|
| 128 |
+
## Glossary
|
| 129 |
|
| 130 |
+
*Clearly define terms in order to be accessible across audiences.*
|
| 131 |
+
-->
|
| 132 |
|
| 133 |
+
<!--
|
| 134 |
+
## Model Card Authors
|
| 135 |
|
| 136 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
| 137 |
+
-->
|
| 138 |
|
| 139 |
+
<!--
|
| 140 |
## Model Card Contact
|
| 141 |
|
| 142 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 143 |
+
-->
|
config.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
| 29 |
"similarity_function": "dot",
|
| 30 |
"similarity_temperature": 1.0,
|
| 31 |
"torch_dtype": "float32",
|
| 32 |
-
"transformers_version": "4.55.
|
| 33 |
"type_vocab_size": 2,
|
| 34 |
"use_cache": true,
|
| 35 |
"use_entity_position_embeddings": true,
|
|
|
|
| 29 |
"similarity_function": "dot",
|
| 30 |
"similarity_temperature": 1.0,
|
| 31 |
"torch_dtype": "float32",
|
| 32 |
+
"transformers_version": "4.55.4",
|
| 33 |
"type_vocab_size": 2,
|
| 34 |
"use_cache": true,
|
| 35 |
"use_entity_position_embeddings": true,
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "SentenceTransformer",
|
| 3 |
+
"__version__": {
|
| 4 |
+
"sentence_transformers": "5.2.0.dev0",
|
| 5 |
+
"transformers": "4.55.4",
|
| 6 |
+
"pytorch": "2.4.0+cu121"
|
| 7 |
+
},
|
| 8 |
+
"prompts": {
|
| 9 |
+
"query": "",
|
| 10 |
+
"document": ""
|
| 11 |
+
},
|
| 12 |
+
"default_prompt_name": null,
|
| 13 |
+
"similarity_fn_name": "cosine"
|
| 14 |
+
}
|
entity_embeddings.npy
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 11126965376
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bd83489d63bb45008620d90ba274331981546081491cfdd94be5afea9cb1cfea
|
| 3 |
size 11126965376
|
modules.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
]
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_seq_length": 512,
|
| 3 |
+
"do_lower_case": false
|
| 4 |
+
}
|