Upload folder using huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- sentence-transformers
|
| 4 |
+
- sentence-similarity
|
| 5 |
+
- feature-extraction
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
- loss:CoSENTLoss
|
| 8 |
+
base_model: sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
|
| 9 |
+
widget:
|
| 10 |
+
- source_sentence: I'm important.
|
| 11 |
+
sentences:
|
| 12 |
+
- I'm big.
|
| 13 |
+
- kili li tawa anpa poka kasi.
|
| 14 |
+
- mi suli.
|
| 15 |
+
- source_sentence: mi suli.
|
| 16 |
+
sentences:
|
| 17 |
+
- I'm fat.
|
| 18 |
+
- I'm big.
|
| 19 |
+
- kili li tawa anpa poka kasi.
|
| 20 |
+
- source_sentence: I am tall.
|
| 21 |
+
sentences:
|
| 22 |
+
- I'm fat.
|
| 23 |
+
- mi suli.
|
| 24 |
+
- The apple does not fall far from the tree.
|
| 25 |
+
- source_sentence: I am tall.
|
| 26 |
+
sentences:
|
| 27 |
+
- I'm important.
|
| 28 |
+
- kili li tawa anpa poka kasi.
|
| 29 |
+
- mi suli.
|
| 30 |
+
- source_sentence: mi suli.
|
| 31 |
+
sentences:
|
| 32 |
+
- The apple does not fall far from the tree.
|
| 33 |
+
- The apple does not fall far from the tree.
|
| 34 |
+
- mi suli.
|
| 35 |
+
pipeline_tag: sentence-similarity
|
| 36 |
+
library_name: sentence-transformers
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
# SentenceTransformer based on sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2
|
| 40 |
+
|
| 41 |
+
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2). 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.
|
| 42 |
+
|
| 43 |
+
## Model Details
|
| 44 |
+
|
| 45 |
+
### Model Description
|
| 46 |
+
- **Model Type:** Sentence Transformer
|
| 47 |
+
- **Base model:** [sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2) <!-- at revision 8d6b950845285729817bf8e1af1861502c2fed0c -->
|
| 48 |
+
- **Maximum Sequence Length:** 128 tokens
|
| 49 |
+
- **Output Dimensionality:** 384 tokens
|
| 50 |
+
- **Similarity Function:** Cosine Similarity
|
| 51 |
+
<!-- - **Training Dataset:** Unknown -->
|
| 52 |
+
<!-- - **Language:** Unknown -->
|
| 53 |
+
<!-- - **License:** Unknown -->
|
| 54 |
+
|
| 55 |
+
### Model Sources
|
| 56 |
+
|
| 57 |
+
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
| 58 |
+
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
| 59 |
+
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
| 60 |
+
|
| 61 |
+
### Full Model Architecture
|
| 62 |
+
|
| 63 |
+
```
|
| 64 |
+
SentenceTransformer(
|
| 65 |
+
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: BertModel
|
| 66 |
+
(1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
|
| 67 |
+
)
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Usage
|
| 71 |
+
|
| 72 |
+
### Direct Usage (Sentence Transformers)
|
| 73 |
+
|
| 74 |
+
First install the Sentence Transformers library:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
pip install -U sentence-transformers
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
Then you can load this model and run inference.
|
| 81 |
+
```python
|
| 82 |
+
from sentence_transformers import SentenceTransformer
|
| 83 |
+
|
| 84 |
+
# Download from the 🤗 Hub
|
| 85 |
+
model = SentenceTransformer("sentence_transformers_model_id")
|
| 86 |
+
# Run inference
|
| 87 |
+
sentences = [
|
| 88 |
+
'mi suli.',
|
| 89 |
+
'The apple does not fall far from the tree.',
|
| 90 |
+
'The apple does not fall far from the tree.',
|
| 91 |
+
]
|
| 92 |
+
embeddings = model.encode(sentences)
|
| 93 |
+
print(embeddings.shape)
|
| 94 |
+
# [3, 384]
|
| 95 |
+
|
| 96 |
+
# Get the similarity scores for the embeddings
|
| 97 |
+
similarities = model.similarity(embeddings, embeddings)
|
| 98 |
+
print(similarities.shape)
|
| 99 |
+
# [3, 3]
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## Training Details
|
| 103 |
+
|
| 104 |
+
### Framework Versions
|
| 105 |
+
- Python: 3.10.12
|
| 106 |
+
- Sentence Transformers: 3.2.1
|
| 107 |
+
- Transformers: 4.42.2
|
| 108 |
+
- PyTorch: 2.5.1+cu121
|
| 109 |
+
- Accelerate: 1.1.1
|
| 110 |
+
- Datasets: 3.1.0
|
| 111 |
+
- Tokenizers: 0.19.1
|
| 112 |
+
|
| 113 |
+
#### Sentence Transformers
|
| 114 |
+
```bibtex
|
| 115 |
+
@inproceedings{reimers-2019-sentence-bert,
|
| 116 |
+
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 117 |
+
author = "Reimers, Nils and Gurevych, Iryna",
|
| 118 |
+
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
| 119 |
+
month = "11",
|
| 120 |
+
year = "2019",
|
| 121 |
+
publisher = "Association for Computational Linguistics",
|
| 122 |
+
url = "https://arxiv.org/abs/1908.10084",
|
| 123 |
+
}
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
#### CoSENTLoss
|
| 127 |
+
```bibtex
|
| 128 |
+
@online{kexuefm-8847,
|
| 129 |
+
title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
|
| 130 |
+
author={Su Jianlin},
|
| 131 |
+
year={2022},
|
| 132 |
+
month={Jan},
|
| 133 |
+
url={https://kexue.fm/archives/8847},
|
| 134 |
+
}
|
| 135 |
+
```
|