File size: 7,441 Bytes
0fe1341
 
 
 
 
 
 
 
 
 
503f7dd
0fe1341
 
 
 
503f7dd
0fe1341
 
 
 
503f7dd
 
 
0fe1341
 
503f7dd
 
 
0fe1341
 
 
 
 
 
 
 
503f7dd
 
 
 
 
 
 
 
 
0fe1341
 
503f7dd
 
 
 
 
 
0fe1341
 
 
 
 
 
 
 
1cc0289
 
0fe1341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503f7dd
0fe1341
 
 
 
503f7dd
0fe1341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:131157
- loss:MultipleNegativesRankingLoss
base_model: sentence-transformers/LaBSE
widget:
- source_sentence: عواقب ممنوعیت یادداشت های 500 روپیه و 1000 روپیه در مورد اقتصاد هند چیست؟
  sentences:
  - آیا باید در فیزیک و علوم کامپیوتر دو برابر کنم؟
  - چگونه اقتصاد هند پس از ممنوعیت 500 1000 یادداشت تحت تأثیر قرار گرفت؟
  - آیا آلمان در اجازه پناهندگان سوری به کشور خود اشتباه کرد؟
- source_sentence: بهترین شماره پشتیبانی فنی QuickBooks در نیویورک ، ایالات متحده کدام است؟
  sentences:
  - فناوری هایی که اکثر مردم از آنها نمی دانند چیست؟
  - بهترین شماره پشتیبانی QuickBooks در آرکانزاس چیست؟
  - چرا در مقایسه با طرف نزدیک ، دهانه های زیادی در قسمت دور ماه وجود دارد؟
- source_sentence: >-
    اقدامات احتیاطی ایمنی در مورد استفاده از اسلحه های پیشنهادی NRA در میشیگان
    چیست؟
  sentences:
  - پیروزی ترامپ چگونه بر کانادا تأثیر خواهد گذاشت؟
  - >-
    اقدامات احتیاطی ایمنی در مورد استفاده از اسلحه های پیشنهادی NRA در آیداهو
    چیست؟
  - مزایای خرید بیمه عمر چیست؟
- source_sentence: چرا این همه افراد ناراضی هستند؟
  sentences:
  - چرا آب نبات تافی آب شور در مغولستان وارد می شود؟
  - برای یک رابطه موفق از راه دور چه چیزی طول می کشد؟
  - چرا مردم ناراضی هستند؟
- source_sentence: برای تبدیل شدن به نویسنده برتر Quora ، چند بازدید و پاسخ لازم است؟
  sentences:
  - >-
    چگونه می توانم نویسنده برتر Quora شوم ، از صعود بیشتر و آمار بهتر استفاده
    کنم؟
  - >-
    چرا بسیاری از افرادی که سؤالاتی را در Quora ارسال می کنند ، ابتدا Google را
    بررسی می کنند؟
  - >-
    من به دنبال خرید دوچرخه جدید هستم.Suzuki Gixxer 155 یا Honda Hornet
    160r.کدام یک را بخرید؟
pipeline_tag: sentence-similarity
library_name: sentence-transformers
license: mit
datasets:
- codersan/PersianSimilarSentences
language:
- fa
- en
---

# SentenceTransformer based on sentence-transformers/LaBSE

This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/LaBSE](https://huggingface.co/sentence-transformers/LaBSE). 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.

## Model Details

This model, FaLaBSE, was developed as part of the research paper "MetaRAG and WikiFaQA: A Co-designed Framework and Benchmark for Advancing Persian Long-Context RAG". The work introduces WikiFaQA, a new large-scale benchmark for long-context Retrieval-Augmented Generation (RAG) in Persian. FaLaBSE is an enhanced Persian sentence encoder created by fine-tuning the powerful multilingual LaBSE model on PersianSimilarSentences, a custom-curated dataset of semantically similar Persian sentence pairs.

### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [sentence-transformers/LaBSE](https://huggingface.co/sentence-transformers/LaBSE) <!-- at revision 836121a0533e5664b21c7aacc5d22951f2b8b25b -->
- **Maximum Sequence Length:** 256 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
<!-- - **Training Dataset:** Unknown -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Full Model Architecture

```
SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel 
  (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})
  (2): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
  (3): Normalize()
)
```

## Usage

### Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

```bash
pip install -U sentence-transformers
```

Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("codersan/validadted_falabse_onV9f")
# Run inference
sentences = [
    'برای تبدیل شدن به نویسنده برتر Quora ، چند بازدید و پاسخ لازم است؟',
    'چگونه می توانم نویسنده برتر Quora شوم ، از صعود بیشتر و آمار بهتر استفاده کنم؟',
    'من به دنبال خرید دوچرخه جدید هستم.Suzuki Gixxer 155 یا Honda Hornet 160r.کدام یک را بخرید؟',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```

<!--
### Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details>
-->

<!--
### Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details>
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Hyperparameters
#### Non-Default Hyperparameters

- `per_device_train_batch_size`: 12
- `learning_rate`: 5e-06
- `weight_decay`: 0.01
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `eval_on_start`: True
- `batch_sampler`: no_duplicates

### Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.3.1
- Transformers: 4.47.0
- PyTorch: 2.5.1+cu121
- Accelerate: 1.2.1
- Datasets: 3.2.0
- Tokenizers: 0.21.0

## Citation

### BibTeX

#### WikiFaQA Paper
```bibtex

```


<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->