Sentence Similarity
sentence-transformers
Transformers
English
rk-transformers
bert
feature-extraction
rknn
rockchip
npu
rk3588
text-embeddings-inference
Instructions to use rk-transformers/all-MiniLM-L6-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use rk-transformers/all-MiniLM-L6-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("rk-transformers/all-MiniLM-L6-v2") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Transformers
How to use rk-transformers/all-MiniLM-L6-v2 with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("rk-transformers/all-MiniLM-L6-v2") model = AutoModel.from_pretrained("rk-transformers/all-MiniLM-L6-v2") - Notebooks
- Google Colab
- Kaggle
| { | |
| "model.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 1, | |
| "max_seq_length": 512, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": 18, | |
| "task": "feature-extraction", | |
| "quantization": { | |
| "do_quantization": false, | |
| "dataset_name": null, | |
| "dataset_subset": null, | |
| "dataset_size": 128, | |
| "dataset_split": null, | |
| "dataset_columns": null, | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 0, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| }, | |
| "rknn/model_o1.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 1, | |
| "max_seq_length": 512, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": null, | |
| "task": "feature-extraction", | |
| "quantization": { | |
| "do_quantization": false, | |
| "dataset_name": null, | |
| "dataset_subset": null, | |
| "dataset_size": 128, | |
| "dataset_split": null, | |
| "dataset_columns": null, | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 1, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| }, | |
| "rknn/model_o2.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 1, | |
| "max_seq_length": 512, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": null, | |
| "task": "feature-extraction", | |
| "quantization": { | |
| "do_quantization": false, | |
| "dataset_name": null, | |
| "dataset_subset": null, | |
| "dataset_size": 128, | |
| "dataset_split": null, | |
| "dataset_columns": null, | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 2, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| }, | |
| "rknn/model_o3.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 1, | |
| "max_seq_length": 512, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": null, | |
| "task": "feature-extraction", | |
| "quantization": { | |
| "do_quantization": false, | |
| "dataset_name": null, | |
| "dataset_subset": null, | |
| "dataset_size": 128, | |
| "dataset_split": null, | |
| "dataset_columns": null, | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 3, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| }, | |
| "rknn/model_w8a8.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 1, | |
| "max_seq_length": 512, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": null, | |
| "task": "feature-extraction", | |
| "quantization": { | |
| "do_quantization": true, | |
| "dataset_name": "stanfordnlp/snli", | |
| "dataset_subset": null, | |
| "dataset_size": 2048, | |
| "dataset_split": [ | |
| "train" | |
| ], | |
| "dataset_columns": [ | |
| "hypothesis" | |
| ], | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 0, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| }, | |
| "model_b4_s512.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 4, | |
| "max_seq_length": 512, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": 18, | |
| "task": "feature-extraction", | |
| "quantization": { | |
| "do_quantization": false, | |
| "dataset_name": null, | |
| "dataset_subset": null, | |
| "dataset_size": 128, | |
| "dataset_split": null, | |
| "dataset_columns": null, | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 0, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| }, | |
| "model_b1_s256.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 1, | |
| "max_seq_length": 256, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": 18, | |
| "task": "auto", | |
| "quantization": { | |
| "do_quantization": false, | |
| "dataset_name": null, | |
| "dataset_subset": null, | |
| "dataset_size": 128, | |
| "dataset_split": null, | |
| "dataset_columns": null, | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 0, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| }, | |
| "model_b4_s256.rknn": { | |
| "model_input_names": [ | |
| "input_ids", | |
| "attention_mask" | |
| ], | |
| "batch_size": 4, | |
| "max_seq_length": 256, | |
| "float_dtype": "float16", | |
| "target_platform": "rk3588", | |
| "single_core_mode": false, | |
| "mean_values": null, | |
| "std_values": null, | |
| "custom_string": null, | |
| "inputs_yuv_fmt": null, | |
| "dynamic_input": null, | |
| "opset": 18, | |
| "task": "auto", | |
| "quantization": { | |
| "do_quantization": false, | |
| "dataset_name": null, | |
| "dataset_subset": null, | |
| "dataset_size": 128, | |
| "dataset_split": null, | |
| "dataset_columns": null, | |
| "quantized_dtype": "w8a8", | |
| "quantized_algorithm": "normal", | |
| "quantized_method": "channel", | |
| "quantized_hybrid_level": 0, | |
| "quant_img_RGB2BGR": false, | |
| "auto_hybrid_cos_thresh": 0.98, | |
| "auto_hybrid_euc_thresh": null | |
| }, | |
| "optimization": { | |
| "optimization_level": 0, | |
| "enable_flash_attention": true, | |
| "remove_weight": false, | |
| "compress_weight": false, | |
| "remove_reshape": false, | |
| "sparse_infer": false, | |
| "model_pruning": false | |
| } | |
| } | |
| } |