mmarco-mMiniLMv2-L6-H384-v1-onnx-o4
Browse files- .gitattributes +1 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/.gitattributes +36 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/README.md +55 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/config.json +33 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/model_optimized.onnx +3 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/ort_config.json +39 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/sentencepiece.bpe.model +3 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/source.txt +1 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/special_tokens_map.json +51 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/tokenizer.json +3 -0
- mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/tokenizer_config.json +54 -0
.gitattributes
CHANGED
|
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
paraphrase-multilingual-MiniLM-L12-v2/unigram.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
crossencoder-mMiniLMv2-L12-mmarcoFR_ONNX/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
paraphrase-multilingual-MiniLM-L12-v2/unigram.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
crossencoder-mMiniLMv2-L12-mmarcoFR_ONNX/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/.gitattributes
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
https://huggingface.co/nreimers/mmarco-mMiniLMv2-L6-H384-v1
|
| 2 |
+
|
| 3 |
+
optimized with onnx o4
|
| 4 |
+
|
| 5 |
+
```
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from transformers import AutoTokenizer
|
| 8 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification, ORTOptimizer
|
| 9 |
+
from optimum.onnxruntime import AutoOptimizationConfig
|
| 10 |
+
|
| 11 |
+
model = "nreimers/mmarco-mMiniLMv2-L6-H384-v1"
|
| 12 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 13 |
+
ort_model = ORTModelForSequenceClassification.from_pretrained(model, export=True)
|
| 14 |
+
|
| 15 |
+
save_dir = Path("/tmp/optimized_models")
|
| 16 |
+
save_dir.mkdir(exist_ok=True, parents=True)
|
| 17 |
+
|
| 18 |
+
optimizer = ORTOptimizer.from_pretrained(ort_model)
|
| 19 |
+
optimizer.optimize(
|
| 20 |
+
optimization_config=AutoOptimizationConfig.O4(),
|
| 21 |
+
save_dir=save_dir,
|
| 22 |
+
)
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Run it with onnx
|
| 26 |
+
|
| 27 |
+
```
|
| 28 |
+
import torch
|
| 29 |
+
from transformers import AutoTokenizer
|
| 30 |
+
from transformers.pipelines.text_classification import ClassificationFunction
|
| 31 |
+
from optimum.pipelines import pipeline as ort_pipeline
|
| 32 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
model = "Slite/mmarco-mMiniLMv2-L6-H384-v1-onnx-o4"
|
| 36 |
+
device = torch.device(0) if torch.cuda.is_available() else -1
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 38 |
+
ort_model = ORTModelForSequenceClassification.from_pretrained(
|
| 39 |
+
model, file_name="model_optimized.onnx")
|
| 40 |
+
cross_encoder = ort_pipeline(
|
| 41 |
+
task="text-classification",
|
| 42 |
+
model=ort_model,
|
| 43 |
+
tokenizer=tokenizer,
|
| 44 |
+
device=device,
|
| 45 |
+
function_to_apply=ClassificationFunction.SIGMOID,
|
| 46 |
+
padding=True,
|
| 47 |
+
truncation=True)
|
| 48 |
+
|
| 49 |
+
cross_encoder([{
|
| 50 |
+
"text":
|
| 51 |
+
"Quel est le but de la vie ?",
|
| 52 |
+
"text_pair":
|
| 53 |
+
"Le but de la vie est une question subjective et dépend de la croyance et de la perspective personnelle de chaque individu. Pour certains, le but peut être de trouver la bonheur et le contentement personnel, pour d'autres cela peut être de faire une différence positive dans le monde, de vivre en harmonie avec les autres, de découvrir la signification et le propre but de leur existence, entre autres. En fin de compte, le but de la vie est déterminé par chaque individu eux-mêmes."
|
| 54 |
+
}])
|
| 55 |
+
```
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "nreimers/mmarco-mMiniLMv2-L6-H384-v1",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"XLMRobertaForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"hidden_act": "gelu",
|
| 11 |
+
"hidden_dropout_prob": 0.1,
|
| 12 |
+
"hidden_size": 384,
|
| 13 |
+
"id2label": {
|
| 14 |
+
"0": "LABEL_0"
|
| 15 |
+
},
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 1536,
|
| 18 |
+
"label2id": {
|
| 19 |
+
"LABEL_0": 0
|
| 20 |
+
},
|
| 21 |
+
"layer_norm_eps": 1e-05,
|
| 22 |
+
"max_position_embeddings": 514,
|
| 23 |
+
"model_type": "xlm-roberta",
|
| 24 |
+
"num_attention_heads": 12,
|
| 25 |
+
"num_hidden_layers": 6,
|
| 26 |
+
"pad_token_id": 1,
|
| 27 |
+
"position_embedding_type": "absolute",
|
| 28 |
+
"torch_dtype": "float32",
|
| 29 |
+
"transformers_version": "4.35.2",
|
| 30 |
+
"type_vocab_size": 1,
|
| 31 |
+
"use_cache": true,
|
| 32 |
+
"vocab_size": 250002
|
| 33 |
+
}
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/model_optimized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0eaae91d96a80ccd9af77c8cd0ab7c5b799c8aa9180ed83b8b4528311a812660
|
| 3 |
+
size 214017536
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/ort_config.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"one_external_file": true,
|
| 3 |
+
"opset": null,
|
| 4 |
+
"optimization": {
|
| 5 |
+
"disable_attention": null,
|
| 6 |
+
"disable_attention_fusion": false,
|
| 7 |
+
"disable_bias_gelu": null,
|
| 8 |
+
"disable_bias_gelu_fusion": false,
|
| 9 |
+
"disable_bias_skip_layer_norm": null,
|
| 10 |
+
"disable_bias_skip_layer_norm_fusion": false,
|
| 11 |
+
"disable_embed_layer_norm": true,
|
| 12 |
+
"disable_embed_layer_norm_fusion": true,
|
| 13 |
+
"disable_gelu": null,
|
| 14 |
+
"disable_gelu_fusion": false,
|
| 15 |
+
"disable_group_norm_fusion": true,
|
| 16 |
+
"disable_layer_norm": null,
|
| 17 |
+
"disable_layer_norm_fusion": false,
|
| 18 |
+
"disable_packed_kv": true,
|
| 19 |
+
"disable_rotary_embeddings": false,
|
| 20 |
+
"disable_shape_inference": false,
|
| 21 |
+
"disable_skip_layer_norm": null,
|
| 22 |
+
"disable_skip_layer_norm_fusion": false,
|
| 23 |
+
"enable_gelu_approximation": true,
|
| 24 |
+
"enable_gemm_fast_gelu_fusion": false,
|
| 25 |
+
"enable_transformers_specific_optimizations": true,
|
| 26 |
+
"fp16": true,
|
| 27 |
+
"no_attention_mask": false,
|
| 28 |
+
"optimization_level": 2,
|
| 29 |
+
"optimize_for_gpu": true,
|
| 30 |
+
"optimize_with_onnxruntime_only": null,
|
| 31 |
+
"use_mask_index": false,
|
| 32 |
+
"use_multi_head_attention": false,
|
| 33 |
+
"use_raw_attention_mask": false
|
| 34 |
+
},
|
| 35 |
+
"optimum_version": "1.14.1",
|
| 36 |
+
"quantization": {},
|
| 37 |
+
"transformers_version": "4.35.2",
|
| 38 |
+
"use_external_data_format": false
|
| 39 |
+
}
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/sentencepiece.bpe.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
|
| 3 |
+
size 5069051
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/source.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
https://huggingface.co/Slite/mmarco-mMiniLMv2-L6-H384-v1-onnx-o4
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "<s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "<mask>",
|
| 25 |
+
"lstrip": true,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "<pad>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "</s>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "<unk>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f59925fcb90c92b894cb93e51bb9b4a6105c5c249fe54ce1c704420ac39b81af
|
| 3 |
+
size 17082756
|
mmarco-mMiniLMv2-L6-H384-v1-onnx-o4/tokenizer_config.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<s>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<pad>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "</s>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"3": {
|
| 28 |
+
"content": "<unk>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"250001": {
|
| 36 |
+
"content": "<mask>",
|
| 37 |
+
"lstrip": true,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"bos_token": "<s>",
|
| 45 |
+
"clean_up_tokenization_spaces": true,
|
| 46 |
+
"cls_token": "<s>",
|
| 47 |
+
"eos_token": "</s>",
|
| 48 |
+
"mask_token": "<mask>",
|
| 49 |
+
"model_max_length": 512,
|
| 50 |
+
"pad_token": "<pad>",
|
| 51 |
+
"sep_token": "</s>",
|
| 52 |
+
"tokenizer_class": "XLMRobertaTokenizer",
|
| 53 |
+
"unk_token": "<unk>"
|
| 54 |
+
}
|