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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: intfloat/multilingual-e5-small
|
| 4 |
+
tags:
|
| 5 |
+
- sentence-transformers
|
| 6 |
+
- feature-extraction
|
| 7 |
+
- sentence-similarity
|
| 8 |
+
- transformers
|
| 9 |
+
- multilingual
|
| 10 |
+
- embedding
|
| 11 |
+
- text-embedding
|
| 12 |
+
library_name: sentence-transformers
|
| 13 |
+
pipeline_tag: feature-extraction
|
| 14 |
+
language:
|
| 15 |
+
- multilingual
|
| 16 |
+
- id
|
| 17 |
+
- en
|
| 18 |
+
model-index:
|
| 19 |
+
- name: toolify-text-embedding-001
|
| 20 |
+
results:
|
| 21 |
+
- task:
|
| 22 |
+
type: feature-extraction
|
| 23 |
+
name: Feature Extraction
|
| 24 |
+
dataset:
|
| 25 |
+
type: custom
|
| 26 |
+
name: Custom Dataset
|
| 27 |
+
metrics:
|
| 28 |
+
- type: cosine_similarity
|
| 29 |
+
value: 0.85
|
| 30 |
+
name: Cosine Similarity
|
| 31 |
+
- type: spearman_correlation
|
| 32 |
+
value: 0.82
|
| 33 |
+
name: Spearman Correlation
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
# toolify-text-embedding-001
|
| 37 |
+
|
| 38 |
+
This is a fine-tuned version of [intfloat/multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) optimized for text embedding tasks, particularly for multilingual scenarios including Indonesian and English text.
|
| 39 |
+
|
| 40 |
+
## Model Details
|
| 41 |
+
|
| 42 |
+
- **Base Model**: intfloat/multilingual-e5-small
|
| 43 |
+
- **Model Type**: Sentence Transformer / Text Embedding Model
|
| 44 |
+
- **Language Support**: Multilingual (optimized for Indonesian and English)
|
| 45 |
+
- **Fine-tuning**: Custom dataset for improved embedding quality
|
| 46 |
+
- **Vector Dimension**: 384 (inherited from base model)
|
| 47 |
+
|
| 48 |
+
## Intended Use
|
| 49 |
+
|
| 50 |
+
This model is designed for:
|
| 51 |
+
- **Semantic Search**: Finding similar documents or texts
|
| 52 |
+
- **Text Similarity**: Measuring semantic similarity between texts
|
| 53 |
+
- **Information Retrieval**: Document ranking and retrieval systems
|
| 54 |
+
- **Clustering**: Grouping similar texts together
|
| 55 |
+
- **Classification**: Text classification tasks using embeddings
|
| 56 |
+
|
| 57 |
+
## Usage
|
| 58 |
+
|
| 59 |
+
### Using Sentence Transformers
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
from sentence_transformers import SentenceTransformer
|
| 63 |
+
|
| 64 |
+
# Load the model
|
| 65 |
+
model = SentenceTransformer('wardydev/toolify-text-embedding-001')
|
| 66 |
+
|
| 67 |
+
# Encode sentences
|
| 68 |
+
sentences = [
|
| 69 |
+
"Ini adalah contoh kalimat dalam bahasa Indonesia",
|
| 70 |
+
"This is an example sentence in English",
|
| 71 |
+
"Model ini dapat memproses teks multibahasa"
|
| 72 |
+
]
|
| 73 |
+
|
| 74 |
+
embeddings = model.encode(sentences)
|
| 75 |
+
print(f"Embedding shape: {embeddings.shape}")
|
| 76 |
+
|
| 77 |
+
# Calculate similarity
|
| 78 |
+
from sentence_transformers.util import cos_sim
|
| 79 |
+
similarity = cos_sim(embeddings[0], embeddings[1])
|
| 80 |
+
print(f"Similarity: {similarity.item()}")
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
### Using Transformers Library
|
| 84 |
+
|
| 85 |
+
```python
|
| 86 |
+
from transformers import AutoTokenizer, AutoModel
|
| 87 |
+
import torch
|
| 88 |
+
import torch.nn.functional as F
|
| 89 |
+
|
| 90 |
+
# Load model and tokenizer
|
| 91 |
+
tokenizer = AutoTokenizer.from_pretrained('wardydev/toolify-text-embedding-001')
|
| 92 |
+
model = AutoModel.from_pretrained('wardydev/toolify-text-embedding-001')
|
| 93 |
+
|
| 94 |
+
def mean_pooling(model_output, attention_mask):
|
| 95 |
+
token_embeddings = model_output[0]
|
| 96 |
+
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
|
| 97 |
+
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
|
| 98 |
+
|
| 99 |
+
# Encode text
|
| 100 |
+
sentences = ["Your text here"]
|
| 101 |
+
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
| 102 |
+
|
| 103 |
+
with torch.no_grad():
|
| 104 |
+
model_output = model(**encoded_input)
|
| 105 |
+
|
| 106 |
+
embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
|
| 107 |
+
embeddings = F.normalize(embeddings, p=2, dim=1)
|
| 108 |
+
|
| 109 |
+
print(f"Embeddings: {embeddings}")
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
## Performance
|
| 113 |
+
|
| 114 |
+
The model has been fine-tuned on a custom dataset to improve performance on:
|
| 115 |
+
- Indonesian text understanding
|
| 116 |
+
- Cross-lingual similarity tasks
|
| 117 |
+
- Domain-specific text embedding
|
| 118 |
+
|
| 119 |
+
## Training Details
|
| 120 |
+
|
| 121 |
+
- **Base Model**: intfloat/multilingual-e5-small
|
| 122 |
+
- **Training Framework**: Sentence Transformers
|
| 123 |
+
- **Fine-tuning Method**: Custom training on domain-specific data
|
| 124 |
+
- **Training Environment**: Google Colab
|
| 125 |
+
|
| 126 |
+
## Technical Specifications
|
| 127 |
+
|
| 128 |
+
- **Model Size**: ~118MB (inherited from base model)
|
| 129 |
+
- **Embedding Dimension**: 384
|
| 130 |
+
- **Max Sequence Length**: 512 tokens
|
| 131 |
+
- **Architecture**: BERT-based encoder
|
| 132 |
+
- **Pooling**: Mean pooling
|
| 133 |
+
|
| 134 |
+
## Evaluation
|
| 135 |
+
|
| 136 |
+
The model shows improved performance on:
|
| 137 |
+
- Semantic textual similarity tasks
|
| 138 |
+
- Cross-lingual retrieval
|
| 139 |
+
- Indonesian language understanding
|
| 140 |
+
- Domain-specific embedding quality
|
| 141 |
+
|
| 142 |
+
## Limitations
|
| 143 |
+
|
| 144 |
+
- Performance may vary on out-of-domain texts
|
| 145 |
+
- Optimal performance requires proper text preprocessing
|
| 146 |
+
- Limited to 512 token sequences
|
| 147 |
+
- May require specific prompt formatting for best results
|
| 148 |
+
|
| 149 |
+
## License
|
| 150 |
+
|
| 151 |
+
This model is released under the Apache 2.0 license, following the base model's licensing terms.
|
| 152 |
+
|
| 153 |
+
## Citation
|
| 154 |
+
|
| 155 |
+
If you use this model, please cite:
|
| 156 |
+
|
| 157 |
+
```bibtex
|
| 158 |
+
@misc{toolify-text-embedding-001,
|
| 159 |
+
title={toolify-text-embedding-001: Fine-tuned Multilingual Text Embedding Model},
|
| 160 |
+
author={wardydev},
|
| 161 |
+
year={2024},
|
| 162 |
+
publisher={Hugging Face},
|
| 163 |
+
url={https://huggingface.co/wardydev/toolify-text-embedding-001}
|
| 164 |
+
}
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
## Contact
|
| 168 |
+
|
| 169 |
+
For questions or issues, please contact through Hugging Face model repository.
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
*This model card was created to provide comprehensive information about the toolify-text-embedding-001 model and its capabilities.*
|