---
language:
- th
license: apache-2.0
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:1572
- loss:MultipleNegativesRankingLoss
- thai
- semantic-search
- food
- ingredients
- retrieval
base_model: sentence-transformers/paraphrase-multilingual-mpnet-base-v2
widget:
- source_sentence: หมูสับ, พริกเขียว, กระเทียม, ใบกะเพรา, ซีอิ๊วขาว, น้ำปลา, พริกไทย
| แคลอรี่:แคลกลาง, โปรตีน:โปรตีนน้อย, ไขมัน:ไขมันน้อย, คาร์บ:คาร์บกลาง
sentences:
- แกงส้มมะละกอปลากระป๋อง
- เทคนิค กะเพราหมูสับ แบบแห้ง อร่อยกว่าร้าน
- ไอศกรีมโยเกิร์ตเยลลี่ปีโป้
- source_sentence: คอหมู, ไข่เป็ด, พริกจินดา, แคร์รอต, กระเทียม, กะหล่ำปลี, บะหมี่กึ่งสำเร็จรูป,
ผงหมัก, น้ำมันหอย, บะหมี่กึ่งสำเร็จรูป | แคลอรี่:แคลกลาง, โปรตีน:โปรตีนกลาง, ไขมัน:ไขมันกลาง,
คาร์บ:คาร์บน้อย
sentences:
- ผัดมาม่าคอหมูย่างไข่ดาว
- ขนมจีนน้ำยา สูตรเด็ด
- ยำวุ้นเส้นเครื่องล้น
- source_sentence: หมูสับ, หนำเลี๊ยบ, ซีอิ๊วขาว, น้ำมันหอย, พริกไทย, กระเทียม, น้ำมัน, ผงปรุงรส,
น้ำตาลทราย | แคลอรี่:แคลมาก, โปรตีน:โปรตีนน้อย, ไขมัน:ไขมันสูง, คาร์บ:คาร์บกลาง
sentences:
- หมูสับผัดหนำเลี๊ยบ
- ผัดฟักทองใส่ไข่ นิ่ม ฟิน
- แกงส้มปลาทู (แกงส้มใต้)
- source_sentence: มัน, ปลาทู, น้ำพริก, น้ำเปล่า, น้ำปลา, น้ำตาลปี๊บ, น้ำมะขามเปียก, ส้มแขก, น้ำมะนาว,
กะปิ | แคลอรี่:แคลมาก, โปรตีน:โปรตีนกลาง, ไขมัน:ไขมันน้อย, คาร์บ:คาร์บสูง
sentences:
- วิธีทำเต้าส่วน
- ข้าวกะเพราไก่ไข่ดาว
- แกงส้มใต้มันขี้หนู
- source_sentence: กะปิ, ข้าวสวย, หมูสามชั้น, น้ำตาล, กระเทียม, สัปปะรด, กุนเชียง, ไข่ไก่, ไข่เค็ม, ปลาทู, ถั่วฝักยาว, หอมแดง, พริกขี้หนู, มะม่วง, กุ้งแห้ง, ผักชี, ซีอิ้วดำ
| แคลอรี่:แคลมาก, โปรตีน:โปรตีนสูง, ไขมัน:ไขมันกลาง, คาร์บ:คาร์บสูง
sentences:
- แกงจืดไข่ม้วนไส้ผักกาดขาวหมูสับ
- มันบดกระเทียมย่าง
- ข้าวคลุกกะปิ
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy@1
- cosine_accuracy@3
- cosine_accuracy@5
- cosine_accuracy@10
- cosine_precision@1
- cosine_precision@3
- cosine_precision@5
- cosine_recall@1
- cosine_recall@3
- cosine_recall@5
- cosine_ndcg@10
- cosine_mrr@10
- cosine_map@100
model-index:
- name: Thai Food Retriever with Nutrition
results:
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: thai food nutrition eval
type: thai-food-nutrition-eval
metrics:
- type: cosine_accuracy@1
value: 0.6458333333333334
name: Cosine Accuracy@1
- type: cosine_accuracy@3
value: 0.7708333333333334
name: Cosine Accuracy@3
- type: cosine_accuracy@5
value: 0.8541666666666666
name: Cosine Accuracy@5
- type: cosine_accuracy@10
value: 0.9583333333333334
name: Cosine Accuracy@10
- type: cosine_precision@1
value: 0.6458333333333334
name: Cosine Precision@1
- type: cosine_precision@3
value: 0.2569444444444444
name: Cosine Precision@3
- type: cosine_precision@5
value: 0.1708333333333333
name: Cosine Precision@5
- type: cosine_recall@1
value: 0.6458333333333334
name: Cosine Recall@1
- type: cosine_recall@3
value: 0.7708333333333334
name: Cosine Recall@3
- type: cosine_recall@5
value: 0.8541666666666666
name: Cosine Recall@5
- type: cosine_ndcg@10
value: 0.7926146014031555
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.7406746031746033
name: Cosine Mrr@10
- type: cosine_map@100
value: 0.7420634920634921
name: Cosine Map@100
---
# Thai Food Retriever with Nutrition
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/paraphrase-multilingual-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2). 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
### Model Description
- **Model Type:** Sentence Transformer
- **Base model:** [sentence-transformers/paraphrase-multilingual-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2)
- **Maximum Sequence Length:** 128 tokens
- **Output Dimensionality:** 768 dimensions
- **Similarity Function:** Cosine Similarity
- **Language:** th
- **License:** apache-2.0
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 768, '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})
)
```
## 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("thai-food-mpnet-nutrition_2")
# Run inference
sentences = [
'กะปิ, ข้าวสวย, หมูสามชั้น, น้ำตาล, กระเทียม, สัปปะรด, กุนเชียง, ไข่ไก่, ไข่เค็ม, ปลาทู, ถั่วฝักยาว, หอมแดง, พริกขี้หนู, มะม่วง, กุ้งแห้ง, ผักชี, ซีอิ้วดำ | แคลอรี่:แคลมาก, โปรตีน:โปรตีนสูง, ไขมัน:ไขมันกลาง, คาร์บ:คาร์บสูง',
'ข้าวคลุกกะปิ',
'มันบดกระเทียมย่าง',
]
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]
```
## Evaluation
### Metrics
#### Information Retrieval
* Dataset: `thai-food-nutrition-eval`
* Evaluated with [InformationRetrievalEvaluator](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:-------------------|:-----------|
| cosine_accuracy@1 | 0.6458 |
| cosine_accuracy@3 | 0.7708 |
| cosine_accuracy@5 | 0.8542 |
| cosine_accuracy@10 | 0.9583 |
| cosine_precision@1 | 0.6458 |
| cosine_precision@3 | 0.2569 |
| cosine_precision@5 | 0.1708 |
| cosine_recall@1 | 0.6458 |
| cosine_recall@3 | 0.7708 |
| cosine_recall@5 | 0.8542 |
| **cosine_ndcg@10** | **0.7926** |
| cosine_mrr@10 | 0.7407 |
| cosine_map@100 | 0.7421 |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 1,572 training samples
* Columns: anchor and positive
* Approximate statistics based on the first 1000 samples:
| | anchor | positive |
|:--------|:------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|
| type | string | string |
| details |
พริกแห้ง, หอมแดง, กระเทียม, น้ำมัน, หมูสับ, น้ำสะอาด, น้ำตาลปี๊บ, น้ำปลา, มะขามเปียก | แคลอรี่:แคลมาก, โปรตีน:โปรตีนน้อย, ไขมัน:ไขมันสูง, คาร์บ:คาร์บกลาง | น้ำพริกเผาผัดหมูสับ |
| มีพริิกแห้งเยอะมาก หอมแดง กระเทียม และอยากให้เป็นเมนูที่ใส่หมูสับเยอะๆๆ | แคลอรี่:แคลมาก, โปรตีน:โปรตีนน้อย, ไขมัน:ไขมันสูง, คาร์บ:คาร์บกลาง | น้ำพริกเผาผัดหมูสับ |
| มีพริกแห้ง, หอมแดง, กระเทียม, หมูสับ ทำอะไรได้บ้าง | แคลอรี่:แคลมาก, โปรตีน:โปรตีนน้อย, ไขมัน:ไขมันสูง, คาร์บ:คาร์บกลาง | น้ำพริกเผาผัดหมูสับ |
* Loss: [MultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Evaluation Dataset
#### Unnamed Dataset
* Size: 48 evaluation samples
* Columns: anchor and positive
* Approximate statistics based on the first 48 samples:
| | anchor | positive |
|:--------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|
| type | string | string |
| details | หมูสับ, หนำเลี๊ยบ, ซีอิ๊วขาว, น้ำมันหอย, พริกไทย, กระเทียม, น้ำมัน, ผงปรุงรส, น้ำตาลทราย | แคลอรี่:แคลมาก, โปรตีน:โปรตีนน้อย, ไขมัน:ไขมันสูง, คาร์บ:คาร์บกลาง | หมูสับผัดหนำเลี๊ยบ |
| ใบกะเพรา, เส้นสปาเก็ตตี้, เห็ด, เนื้อหมู, กุ้ง, ปลาหมึก, ผัก, พริก, กระเทียม, ซอสหอยนางรม, ซีอิ๊วขาว, น้ำปลา, ซีอิ๊วดำ, น้ำตาล, น้ำมัน | แคลอรี่:แคลมาก, โปรตีน:โปรตีนกลาง, ไขมัน:ไขมันสูง, คาร์บ:คาร์บน้อย | สปาเก็ตตี้ขี้เมาทะเล |
| ไข่ไก่, กุ้ง, ซีอิ้วขาว, น้ำมัน, พริกไทย | แคลอรี่:แคลน้อย, โปรตีน:โปรตีนกลาง, ไขมัน:ไขมันน้อย, คาร์บ:คาร์บน้อย | ไข่เจียวกุ้ง |
* Loss: [MultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: epoch
- `per_device_train_batch_size`: 24
- `per_device_eval_batch_size`: 24
- `learning_rate`: 5e-06
- `num_train_epochs`: 8
- `warmup_ratio`: 0.1
- `load_best_model_at_end`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters