leafxyz's picture
Upload folder using huggingface_hub
19c8304 verified
|
Raw
History Blame Contribute Delete
28 kB
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:342061
- loss:CachedMultipleNegativesRankingLoss
base_model: prestoai/qwen3-embedding-0.6b-arabic-ecom
widget:
- source_sentence: 'Instruct: Given an Arabic e-commerce search query, retrieve the
product that best matches it
Query: نسونكس Spray'
sentences:
- Nasonex - Nasal Spray
- كابل شحن مايكرو XKIN - 2.4A
- حلوى الشوكولاتة - Choco Lapki
- source_sentence: 'Instruct: Given an Arabic e-commerce search query, retrieve the
product that best matches it
Query: مكرونة رقم 42'
sentences:
- بنطلون رجالي - 0112
- حقيبة حزام خصر - 4862
- مكرونة الجيد معكوفة رقم 42 - 500 غ
- source_sentence: 'Instruct: Given an Arabic e-commerce search query, retrieve the
product that best matches it
Query: سباغيتي'
sentences:
- ملعب كرة قدم - DD18
- مكرونة معكوفة - Favelli
- مكرونة سباغيتي - Favelli
- source_sentence: 'Instruct: Given an Arabic e-commerce search query, retrieve the
product that best matches it
Query: جبنة هواء'
sentences:
- جبنة - ابو الولد
- جبنة - Hawaa
- كاني طعام كلاب البالغين دجاج - 3 ك
- source_sentence: 'Instruct: Given an Arabic e-commerce search query, retrieve the
product that best matches it
Query: شاحن تايب سي للسيارة'
sentences:
- شاحن سيارة قرين ليون مدخلين 36 وات مع كابل تايب سي - CBK
- صوص المكرونة هاينز - 365 غ
- بسكويت جولون بدون سكر شكلاتة ساندوتش
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---
# SentenceTransformer based on prestoai/qwen3-embedding-0.6b-arabic-ecom
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [prestoai/qwen3-embedding-0.6b-arabic-ecom](https://huggingface.co/prestoai/qwen3-embedding-0.6b-arabic-ecom) on the pairs_with_negatives and positives datasets. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for retrieval.
## Model Details
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [prestoai/qwen3-embedding-0.6b-arabic-ecom](https://huggingface.co/prestoai/qwen3-embedding-0.6b-arabic-ecom) <!-- at revision 80f273fd53c6644d65e14a2ac1fbf74b8c924097 -->
- **Maximum Sequence Length:** 128 tokens
- **Output Dimensionality:** 1024 dimensions
- **Similarity Function:** Cosine Similarity
- **Supported Modality:** Text
- **Training Datasets:**
- pairs_with_negatives
- positives
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'Qwen3Model'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'lasttoken', 'include_prompt': True})
(2): 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("sentence_transformers_model_id")
# Run inference
queries = [
'Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it\nQuery: شاحن تايب سي للسيارة',
]
documents = [
'شاحن سيارة قرين ليون مدخلين 36 وات مع كابل تايب سي - CBK',
'بسكويت جولون بدون سكر شكلاتة ساندوتش',
'صوص المكرونة هاينز - 365 غ',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 1024] [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[ 0.6773, -0.0849, -0.0875]])
```
<!--
### 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 Datasets
#### pairs_with_negatives
* Dataset: pairs_with_negatives
* Size: 124,261 training samples
* Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
* Approximate statistics based on the first 1000 samples:
| | anchor | positive | negative |
|:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string | string |
| details | <ul><li>min: 23 tokens</li><li>mean: 29.44 tokens</li><li>max: 42 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 15.95 tokens</li><li>max: 49 tokens</li></ul> | <ul><li>min: 2 tokens</li><li>mean: 14.87 tokens</li><li>max: 40 tokens</li></ul> |
* Samples:
| anchor | positive | negative |
|:--------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------|:-------------------------------------------------------------------|
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: واقي للوجه دهني</code> | <code>Anthelios Oil Control (Dry Touch) - La Roche Posay</code> | <code>Anthelios Invisible Mist (Dry Touch) - La Roche Posay</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: تن منارة زليتن</code> | <code>تن منارة زليتن بزيت دوار الشمس - 160 غ</code> | <code>تن فاني بزيت دوار الشمس - 160 غ</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: فانتا زجاجة صغيرة</code> | <code>مشروب فانتا برتقال زجاجة - 330 مل</code> | <code>مشروب فانتا - 1 ل (برتقال)</code> |
* Loss: [<code>CachedMultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cachedmultiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 8,
"gather_across_devices": false,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
```
#### positives
* Dataset: positives
* Size: 217,800 training samples
* Columns: <code>anchor</code> and <code>positive</code>
* Approximate statistics based on the first 1000 samples:
| | anchor | positive |
|:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string |
| details | <ul><li>min: 23 tokens</li><li>mean: 29.61 tokens</li><li>max: 52 tokens</li></ul> | <ul><li>min: 2 tokens</li><li>mean: 13.81 tokens</li><li>max: 41 tokens</li></ul> |
* Samples:
| anchor | positive |
|:-----------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------|
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: نحب جبنة القرية</code> | <code>ميرسين جبنة القرية 200 جم</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: كابل شحن مايكرو Moxom A2.4</code> | <code>كابل شحن مايكرو Moxom - A2.4</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: dry idea</code> | <code>Dry idea (powder fresh)</code> |
* Loss: [<code>CachedMultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cachedmultiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 8,
"gather_across_devices": false,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
```
### Evaluation Datasets
#### pairs_with_negatives
* Dataset: pairs_with_negatives
* Size: 1,256 evaluation samples
* Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
* Approximate statistics based on the first 1000 samples:
| | anchor | positive | negative |
|:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string | string |
| details | <ul><li>min: 23 tokens</li><li>mean: 29.56 tokens</li><li>max: 40 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 16.04 tokens</li><li>max: 43 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 15.05 tokens</li><li>max: 33 tokens</li></ul> |
* Samples:
| anchor | positive | negative |
|:-------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------|:--------------------------------------|
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: هيبوتك بوزن</code> | <code>عطر Hypnotic Poison - PERFECTO COLLECTION</code> | <code>عطر Poison Girl - Dior</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: شاحن مايكرو 2.4A</code> | <code>شحن مايكرو Smila - 2.4A</code> | <code>شحن تايب سي Smila - 2.4A</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: تمر صعيدي</code> | <code>تمر صعيدي مشفوط</code> | <code>تمر قصيم مشفوط</code> |
* Loss: [<code>CachedMultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cachedmultiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 8,
"gather_across_devices": false,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
```
#### positives
* Dataset: positives
* Size: 2,200 evaluation samples
* Columns: <code>anchor</code> and <code>positive</code>
* Approximate statistics based on the first 1000 samples:
| | anchor | positive |
|:--------|:-----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
| type | string | string |
| details | <ul><li>min: 24 tokens</li><li>mean: 29.27 tokens</li><li>max: 42 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 13.61 tokens</li><li>max: 44 tokens</li></ul> |
* Samples:
| anchor | positive |
|:-------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------|
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: حاملة أدوات القطط</code> | <code>حاملة أدوات القطة - AA04</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: كريم شمس أطفال</code> | <code>واقي شمس كريمي - Chicco</code> |
| <code>Instruct: Given an Arabic e-commerce search query, retrieve the product that best matches it<br>Query: كانديسارتان هيدروكلوروثيازيد</code> | <code>Candesartan and Hydrochlorothiazide 16mg/12.5mg</code> |
* Loss: [<code>CachedMultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#cachedmultiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 8,
"gather_across_devices": false,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `per_device_train_batch_size`: 32
- `learning_rate`: 0.0001
- `num_train_epochs`: 1
- `warmup_steps`: 0.05
- `fp16`: True
#### All Hyperparameters
<details><summary>Click to expand</summary>
- `do_predict`: False
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 32
- `per_device_eval_batch_size`: 8
- `gradient_accumulation_steps`: 1
- `eval_accumulation_steps`: None
- `torch_empty_cache_steps`: None
- `learning_rate`: 0.0001
- `weight_decay`: 0.0
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `max_grad_norm`: 1.0
- `num_train_epochs`: 1
- `max_steps`: -1
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: None
- `warmup_ratio`: None
- `warmup_steps`: 0.05
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `enable_jit_checkpoint`: False
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `use_cpu`: False
- `seed`: 42
- `data_seed`: None
- `bf16`: False
- `fp16`: True
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: None
- `local_rank`: -1
- `ddp_backend`: None
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 0
- `dataloader_prefetch_factor`: None
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: False
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `parallelism_config`: None
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch_fused
- `optim_args`: None
- `group_by_length`: False
- `length_column_name`: length
- `project`: huggingface
- `trackio_space_id`: trackio
- `ddp_find_unused_parameters`: None
- `ddp_bucket_cap_mb`: None
- `ddp_broadcast_buffers`: False
- `dataloader_pin_memory`: True
- `dataloader_persistent_workers`: False
- `skip_memory_metrics`: True
- `push_to_hub`: False
- `resume_from_checkpoint`: None
- `hub_model_id`: None
- `hub_strategy`: every_save
- `hub_private_repo`: None
- `hub_always_push`: False
- `hub_revision`: None
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `include_for_metrics`: []
- `eval_do_concat_batches`: True
- `auto_find_batch_size`: False
- `full_determinism`: False
- `ddp_timeout`: 1800
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `include_num_input_tokens_seen`: no
- `neftune_noise_alpha`: None
- `optim_target_modules`: None
- `batch_eval_metrics`: False
- `eval_on_start`: False
- `use_liger_kernel`: False
- `liger_kernel_config`: None
- `eval_use_gather_object`: False
- `average_tokens_across_devices`: True
- `use_cache`: False
- `prompts`: None
- `batch_sampler`: batch_sampler
- `multi_dataset_batch_sampler`: proportional
- `router_mapping`: {}
- `learning_rate_mapping`: {}
</details>
### Training Logs
| Epoch | Step | Training Loss | pairs with negatives loss | positives loss |
|:------:|:----:|:-------------:|:-------------------------:|:--------------:|
| 0.0023 | 25 | 0.4772 | - | - |
| 0.0047 | 50 | 0.4593 | - | - |
| 0.0070 | 75 | 0.3945 | - | - |
| 0.0094 | 100 | 0.3752 | - | - |
| 0.0117 | 125 | 0.4048 | - | - |
| 0.0140 | 150 | 0.4563 | - | - |
| 0.0164 | 175 | 0.3492 | - | - |
| 0.0187 | 200 | 0.4171 | 0.3915 | 0.1481 |
| 0.0210 | 225 | 0.4297 | - | - |
| 0.0234 | 250 | 0.4365 | - | - |
| 0.0257 | 275 | 0.4344 | - | - |
| 0.0281 | 300 | 0.4184 | - | - |
| 0.0304 | 325 | 0.4198 | - | - |
| 0.0327 | 350 | 0.4293 | - | - |
| 0.0351 | 375 | 0.4759 | - | - |
| 0.0374 | 400 | 0.3312 | 0.3695 | 0.1180 |
| 0.0398 | 425 | 0.3887 | - | - |
| 0.0421 | 450 | 0.4402 | - | - |
| 0.0444 | 475 | 0.4105 | - | - |
| 0.0468 | 500 | 0.3923 | - | - |
| 0.0491 | 525 | 0.3163 | - | - |
| 0.0514 | 550 | 0.3565 | - | - |
| 0.0538 | 575 | 0.3707 | - | - |
| 0.0561 | 600 | 0.3008 | 0.3388 | 0.1086 |
| 0.0585 | 625 | 0.3594 | - | - |
| 0.0608 | 650 | 0.3936 | - | - |
| 0.0631 | 675 | 0.3207 | - | - |
| 0.0655 | 700 | 0.3371 | - | - |
| 0.0678 | 725 | 0.3385 | - | - |
| 0.0702 | 750 | 0.2718 | - | - |
| 0.0725 | 775 | 0.4429 | - | - |
| 0.0748 | 800 | 0.2684 | 0.3453 | 0.1043 |
| 0.0772 | 825 | 0.2539 | - | - |
| 0.0795 | 850 | 0.3239 | - | - |
| 0.0818 | 875 | 0.2944 | - | - |
| 0.0842 | 900 | 0.3067 | - | - |
| 0.0865 | 925 | 0.3113 | - | - |
| 0.0889 | 950 | 0.3387 | - | - |
| 0.0912 | 975 | 0.2735 | - | - |
| 0.0935 | 1000 | 0.2985 | 0.3211 | 0.0891 |
| 0.0959 | 1025 | 0.3553 | - | - |
| 0.0982 | 1050 | 0.2568 | - | - |
| 0.1006 | 1075 | 0.3447 | - | - |
| 0.1029 | 1100 | 0.3239 | - | - |
| 0.1052 | 1125 | 0.3015 | - | - |
| 0.1076 | 1150 | 0.3865 | - | - |
| 0.1099 | 1175 | 0.2982 | - | - |
| 0.1122 | 1200 | 0.3105 | 0.3232 | 0.0829 |
| 0.1146 | 1225 | 0.2964 | - | - |
| 0.1169 | 1250 | 0.2417 | - | - |
| 0.1193 | 1275 | 0.2686 | - | - |
| 0.1216 | 1300 | 0.2932 | - | - |
| 0.1239 | 1325 | 0.2383 | - | - |
| 0.1263 | 1350 | 0.3108 | - | - |
| 0.1286 | 1375 | 0.3216 | - | - |
| 0.1310 | 1400 | 0.2083 | 0.3091 | 0.0894 |
| 0.1333 | 1425 | 0.2933 | - | - |
| 0.1356 | 1450 | 0.2038 | - | - |
| 0.1380 | 1475 | 0.2515 | - | - |
| 0.1403 | 1500 | 0.2643 | - | - |
| 0.1426 | 1525 | 0.2484 | - | - |
| 0.1450 | 1550 | 0.3216 | - | - |
| 0.1473 | 1575 | 0.3265 | - | - |
| 0.1497 | 1600 | 0.2626 | 0.3166 | 0.0775 |
| 0.1520 | 1625 | 0.2811 | - | - |
| 0.1543 | 1650 | 0.2792 | - | - |
| 0.1567 | 1675 | 0.2888 | - | - |
| 0.1590 | 1700 | 0.3243 | - | - |
| 0.1614 | 1725 | 0.2318 | - | - |
| 0.1637 | 1750 | 0.2943 | - | - |
| 0.1660 | 1775 | 0.2494 | - | - |
| 0.1684 | 1800 | 0.3478 | 0.3113 | 0.0751 |
| 0.1707 | 1825 | 0.3265 | - | - |
| 0.1730 | 1850 | 0.2933 | - | - |
| 0.1754 | 1875 | 0.2671 | - | - |
| 0.1777 | 1900 | 0.2927 | - | - |
| 0.1801 | 1925 | 0.2939 | - | - |
| 0.1824 | 1950 | 0.2356 | - | - |
| 0.1847 | 1975 | 0.2413 | - | - |
| 0.1871 | 2000 | 0.2026 | 0.2921 | 0.0650 |
### Training Time
- **Training**: 2.2 hours
### Framework Versions
- Python: 3.12.13
- Sentence Transformers: 5.4.1
- Transformers: 5.0.0
- PyTorch: 2.10.0+cu128
- Accelerate: 1.13.0
- Datasets: 5.0.0
- Tokenizers: 0.22.2
## Citation
### BibTeX
#### Sentence Transformers
```bibtex
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
```
#### CachedMultipleNegativesRankingLoss
```bibtex
@misc{gao2021scaling,
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
year={2021},
eprint={2101.06983},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
```
<!--
## 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.*
-->