Feature Extraction
Transformers
Safetensors
sentence-transformers
ONNX
English
bert
embeddings
text-embeddings
semantic-search
information-retrieval
int8
minilm
e5
text-embeddings-inference
Instructions to use GrowBitLabs/tinye5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GrowBitLabs/tinye5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="GrowBitLabs/tinye5")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("GrowBitLabs/tinye5") model = AutoModel.from_pretrained("GrowBitLabs/tinye5", device_map="auto") - sentence-transformers
How to use GrowBitLabs/tinye5 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("GrowBitLabs/tinye5") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Update TinyE5 main model files
Browse files- README.md +31 -22
- config.json +30 -25
- embedding_config.json +10 -10
- model.safetensors +3 -0
- tokenizer_config.json +24 -65
README.md
CHANGED
|
@@ -66,31 +66,40 @@ where model size, CPU latency, and deployment efficiency matter.
|
|
| 66 |
|
| 67 |
| Model | Size | STS Spearman ↑ | SciFact Recall@10 ↑ | SciFact nDCG@10 ↑ |
|
| 68 |
| ------------------------------- | ----------: | -------------: | ------------------: | ----------------: |
|
| 69 |
-
| **TinyE5-L6-384 (Safetensors)** | 86.7 MB | 0.8138 | 0.
|
| 70 |
-
| **TinyE5-L6-384 (FP32 ONNX)** | 86.2 MB | 0.8138 | 0.
|
| 71 |
-
| **TinyE5-L6-384 (INT8 ONNX)** | **21.8 MB** | 0.
|
| 72 |
-
|
|
| 73 |
|
| 74 |
### CPU Inference Performance
|
| 75 |
|
| 76 |
-
| Model | Precision | Size | Latency ↓ |
|
| 77 |
-
| ---------------------- | --------- | ----------: | ---------------: | ----------------: |
|
| 78 |
-
| TinyE5-L6-384 ONNX | FP32 | 86.2 MB |
|
| 79 |
-
| **TinyE5-L6-384 ONNX** | **INT8** | **21.8 MB** | **
|
| 80 |
|
| 81 |
### INT8 vs FP32 ONNX
|
| 82 |
|
| 83 |
-
| Metric | FP32 |
|
| 84 |
-
| ----------------- | ------------: | ----------------: | ---------------: |
|
| 85 |
-
| Model size | 86.2 MB |
|
| 86 |
-
| CPU latency |
|
| 87 |
-
| CPU throughput |
|
| 88 |
-
|
|
| 89 |
-
|
|
| 90 |
-
| SciFact
|
|
|
|
| 91 |
|
| 92 |
-
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
## Docker Example
|
| 96 |
|
|
@@ -106,7 +115,7 @@ services:
|
|
| 106 |
- ./data:/data
|
| 107 |
command:
|
| 108 |
- --model-id
|
| 109 |
-
-
|
| 110 |
- --revision
|
| 111 |
- int8-onnx
|
| 112 |
- --pooling
|
|
@@ -118,7 +127,7 @@ services:
|
|
| 118 |
All variants are published under the same Hugging Face repository:
|
| 119 |
|
| 120 |
```text
|
| 121 |
-
|
| 122 |
```
|
| 123 |
|
| 124 |
| Variant | Revision | Model |
|
|
@@ -132,7 +141,7 @@ rizwan3d/tinye5
|
|
| 132 |
```yaml
|
| 133 |
command:
|
| 134 |
- --model-id
|
| 135 |
-
-
|
| 136 |
- --revision
|
| 137 |
- main
|
| 138 |
- --pooling
|
|
@@ -144,7 +153,7 @@ command:
|
|
| 144 |
```yaml
|
| 145 |
command:
|
| 146 |
- --model-id
|
| 147 |
-
-
|
| 148 |
- --revision
|
| 149 |
- fp32-onnx
|
| 150 |
- --pooling
|
|
@@ -156,7 +165,7 @@ command:
|
|
| 156 |
```yaml
|
| 157 |
command:
|
| 158 |
- --model-id
|
| 159 |
-
-
|
| 160 |
- --revision
|
| 161 |
- int8-onnx
|
| 162 |
- --pooling
|
|
|
|
| 66 |
|
| 67 |
| Model | Size | STS Spearman ↑ | SciFact Recall@10 ↑ | SciFact nDCG@10 ↑ |
|
| 68 |
| ------------------------------- | ----------: | -------------: | ------------------: | ----------------: |
|
| 69 |
+
| **TinyE5-L6-384 (Safetensors)** | 86.7 MB | 0.8138 | 0.7342 | 0.5897 |
|
| 70 |
+
| **TinyE5-L6-384 (FP32 ONNX)** | 86.2 MB | 0.8138 | 0.7342 | 0.5897 |
|
| 71 |
+
| **TinyE5-L6-384 (INT8 ONNX)** | **21.8 MB** | 0.8058 | 0.7599 | 0.6020 |
|
| 72 |
+
| all-MiniLM-L6-v2 | — | **0.8194** | **0.7923** | **0.6494** |
|
| 73 |
|
| 74 |
### CPU Inference Performance
|
| 75 |
|
| 76 |
+
| Model | Precision | Size | Latency ↓ | Throughput ↑ | Session RAM ↓ |
|
| 77 |
+
| ---------------------- | --------- | ----------: | ---------------: | -----------------: | ------------: |
|
| 78 |
+
| TinyE5-L6-384 ONNX | FP32 | 86.2 MB | 2.35 ms/text | 424.7 texts/s | 90.4 MB |
|
| 79 |
+
| **TinyE5-L6-384 ONNX** | **INT8** | **21.8 MB** | **0.77 ms/text** | **1299.4 texts/s** | **11.2 MB** |
|
| 80 |
|
| 81 |
### INT8 vs FP32 ONNX
|
| 82 |
|
| 83 |
+
| Metric | FP32 | INT8 | Change |
|
| 84 |
+
| ----------------- | ------------: | -----------------: | -----------------: |
|
| 85 |
+
| Model size | 86.2 MB | **21.8 MB** | **~74.7% smaller** |
|
| 86 |
+
| CPU latency | 2.35 ms/text | **0.77 ms/text** | **~67.2% lower** |
|
| 87 |
+
| CPU throughput | 424.7 texts/s | **1299.4 texts/s** | **~205.9% higher** |
|
| 88 |
+
| Session RAM | 90.4 MB | **11.2 MB** | **~87.6% lower** |
|
| 89 |
+
| STS Spearman | **0.8138** | 0.8058 | -0.0080 |
|
| 90 |
+
| SciFact Recall@10 | 0.7342 | **0.7599** | **+0.0257** |
|
| 91 |
+
| SciFact nDCG@10 | 0.5897 | **0.6020** | **+0.0123** |
|
| 92 |
|
| 93 |
+
### End-to-End Benchmark Time
|
| 94 |
|
| 95 |
+
| Model | STS Time ↓ | SciFact Time ↓ |
|
| 96 |
+
| ------------------------------- | ---------: | -------------: |
|
| 97 |
+
| **TinyE5-L6-384 (Safetensors)** | 0.72s | 3.71s |
|
| 98 |
+
| TinyE5-L6-384 (FP32 ONNX) | 8.82s | 265.58s |
|
| 99 |
+
| TinyE5-L6-384 (INT8 ONNX) | 5.46s | 179.11s |
|
| 100 |
+
| **all-MiniLM-L6-v2** | **0.62s** | **3.62s** |
|
| 101 |
+
|
| 102 |
+
> **Summary:** INT8 quantization reduces TinyE5-L6-384 from **86.2 MB to 21.8 MB (~74.7% smaller)**, lowers CPU inference latency from **2.35 ms/text to 0.77 ms/text (~67.2% lower)**, and increases CPU throughput from **424.7 to 1299.4 texts/s (~3.06× throughput)**. Session RAM also drops from **90.4 MB to 11.2 MB (~87.6% lower)**. STS Spearman decreases slightly from **0.8138 to 0.8058**, while SciFact Recall@10 improves from **0.7342 to 0.7599** and nDCG@10 improves from **0.5897 to 0.6020**. The all-MiniLM-L6-v2 baseline still achieves the highest overall quality, with **0.8194 STS Spearman, 0.7923 Recall@10, and 0.6494 nDCG@10**.
|
| 103 |
|
| 104 |
## Docker Example
|
| 105 |
|
|
|
|
| 115 |
- ./data:/data
|
| 116 |
command:
|
| 117 |
- --model-id
|
| 118 |
+
- GrowBitLabs/tinye5
|
| 119 |
- --revision
|
| 120 |
- int8-onnx
|
| 121 |
- --pooling
|
|
|
|
| 127 |
All variants are published under the same Hugging Face repository:
|
| 128 |
|
| 129 |
```text
|
| 130 |
+
GrowBitLabs/tinye5
|
| 131 |
```
|
| 132 |
|
| 133 |
| Variant | Revision | Model |
|
|
|
|
| 141 |
```yaml
|
| 142 |
command:
|
| 143 |
- --model-id
|
| 144 |
+
- GrowBitLabs/tinye5
|
| 145 |
- --revision
|
| 146 |
- main
|
| 147 |
- --pooling
|
|
|
|
| 153 |
```yaml
|
| 154 |
command:
|
| 155 |
- --model-id
|
| 156 |
+
- GrowBitLabs/tinye5
|
| 157 |
- --revision
|
| 158 |
- fp32-onnx
|
| 159 |
- --pooling
|
|
|
|
| 165 |
```yaml
|
| 166 |
command:
|
| 167 |
- --model-id
|
| 168 |
+
- GrowBitLabs/tinye5
|
| 169 |
- --revision
|
| 170 |
- int8-onnx
|
| 171 |
- --pooling
|
config.json
CHANGED
|
@@ -1,25 +1,30 @@
|
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": null,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_dropout_prob": 0.1,
|
| 14 |
+
"hidden_size": 384,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 1536,
|
| 17 |
+
"is_decoder": false,
|
| 18 |
+
"layer_norm_eps": 1e-12,
|
| 19 |
+
"max_position_embeddings": 512,
|
| 20 |
+
"model_type": "bert",
|
| 21 |
+
"num_attention_heads": 12,
|
| 22 |
+
"num_hidden_layers": 6,
|
| 23 |
+
"pad_token_id": 0,
|
| 24 |
+
"position_embedding_type": "absolute",
|
| 25 |
+
"tie_word_embeddings": true,
|
| 26 |
+
"transformers_version": "5.16.1",
|
| 27 |
+
"type_vocab_size": 2,
|
| 28 |
+
"use_cache": true,
|
| 29 |
+
"vocab_size": 30522
|
| 30 |
+
}
|
embedding_config.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "TinyE5-L6-384",
|
| 3 |
-
"embedding_dimension": 384,
|
| 4 |
-
"pooling": "mean",
|
| 5 |
-
"normalize": true,
|
| 6 |
-
"query_prefix": "query: ",
|
| 7 |
-
"passage_prefix": "passage: ",
|
| 8 |
-
"base_model": "sentence-transformers/all-MiniLM-L6-v2",
|
| 9 |
-
"training_dataset": "sentence-transformers/msmarco-bm25/triplet",
|
| 10 |
-
"train_last_n_layers": 2
|
| 11 |
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "TinyE5-L6-384",
|
| 3 |
+
"embedding_dimension": 384,
|
| 4 |
+
"pooling": "mean",
|
| 5 |
+
"normalize": true,
|
| 6 |
+
"query_prefix": "query: ",
|
| 7 |
+
"passage_prefix": "passage: ",
|
| 8 |
+
"base_model": "sentence-transformers/all-MiniLM-L6-v2",
|
| 9 |
+
"training_dataset": "sentence-transformers/msmarco-bm25/triplet",
|
| 10 |
+
"train_last_n_layers": 2
|
| 11 |
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fb8de9bbf527353997deb64a4a6daee75da86a2eb9e711b825a6e7fa7ed2d01
|
| 3 |
+
size 90864192
|
tokenizer_config.json
CHANGED
|
@@ -1,65 +1,24 @@
|
|
| 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 |
-
"special": true
|
| 26 |
-
},
|
| 27 |
-
"102": {
|
| 28 |
-
"content": "[SEP]",
|
| 29 |
-
"lstrip": false,
|
| 30 |
-
"normalized": false,
|
| 31 |
-
"rstrip": false,
|
| 32 |
-
"single_word": false,
|
| 33 |
-
"special": true
|
| 34 |
-
},
|
| 35 |
-
"103": {
|
| 36 |
-
"content": "[MASK]",
|
| 37 |
-
"lstrip": false,
|
| 38 |
-
"normalized": false,
|
| 39 |
-
"rstrip": false,
|
| 40 |
-
"single_word": false,
|
| 41 |
-
"special": true
|
| 42 |
-
}
|
| 43 |
-
},
|
| 44 |
-
"clean_up_tokenization_spaces": false,
|
| 45 |
-
"cls_token": "[CLS]",
|
| 46 |
-
"do_basic_tokenize": true,
|
| 47 |
-
"do_lower_case": true,
|
| 48 |
-
"extra_special_tokens": {},
|
| 49 |
-
"mask_token": "[MASK]",
|
| 50 |
-
"max_length": 128,
|
| 51 |
-
"model_max_length": 512,
|
| 52 |
-
"never_split": null,
|
| 53 |
-
"pad_to_multiple_of": null,
|
| 54 |
-
"pad_token": "[PAD]",
|
| 55 |
-
"pad_token_type_id": 0,
|
| 56 |
-
"padding_side": "right",
|
| 57 |
-
"sep_token": "[SEP]",
|
| 58 |
-
"stride": 0,
|
| 59 |
-
"strip_accents": null,
|
| 60 |
-
"tokenize_chinese_chars": true,
|
| 61 |
-
"tokenizer_class": "BertTokenizer",
|
| 62 |
-
"truncation_side": "right",
|
| 63 |
-
"truncation_strategy": "longest_first",
|
| 64 |
-
"unk_token": "[UNK]"
|
| 65 |
-
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"do_basic_tokenize": true,
|
| 5 |
+
"do_lower_case": true,
|
| 6 |
+
"is_local": false,
|
| 7 |
+
"local_files_only": false,
|
| 8 |
+
"mask_token": "[MASK]",
|
| 9 |
+
"max_length": 128,
|
| 10 |
+
"model_max_length": 512,
|
| 11 |
+
"never_split": null,
|
| 12 |
+
"pad_to_multiple_of": null,
|
| 13 |
+
"pad_token": "[PAD]",
|
| 14 |
+
"pad_token_type_id": 0,
|
| 15 |
+
"padding_side": "right",
|
| 16 |
+
"sep_token": "[SEP]",
|
| 17 |
+
"stride": 0,
|
| 18 |
+
"strip_accents": null,
|
| 19 |
+
"tokenize_chinese_chars": true,
|
| 20 |
+
"tokenizer_class": "BertTokenizer",
|
| 21 |
+
"truncation_side": "right",
|
| 22 |
+
"truncation_strategy": "longest_first",
|
| 23 |
+
"unk_token": "[UNK]"
|
| 24 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|