Downloads · 30 days
14
48% of all-time downloads
MisterPotato92/all-MiniLM-L6-v2-tflite
all-MiniLM-L6-v2-tflite is a machine learning model from MisterPotato92. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for sentence-transformers. The card lists the license as apache-2.0.
A TensorFlow Lite version of the popular sentence-transformers/all-MiniLM-L6-v2 model, optimized for mobile and embedded devices.
Downloads · 30 days
14
48% of all-time downloads
All-time downloads
29
Public
Repo size
22.8 MB
Likes
0
Public
Click a slice to open those files.
.tflite22.8 MB · 100%
From the Hugging Face model README
A TensorFlow Lite version of the popular sentence-transformers/all-MiniLM-L6-v2 model, optimized for mobile and embedded devices.
This model is a lightweight sentence transformer that maps sentences and paragraphs to a 384-dimensional dense vector space. It's designed for efficient on-device inference while maintaining good semantic understanding capabilities.
| Property | Value |
|---|---|
| Input Sequence Length | Up to 256 word pieces (longer text is truncated) |
| Output Dimensions | 384-dimensional dense vectors |
| Model Size | ~22M parameters (TFLite optimized) |
| Base Architecture | 6-layer MiniLM encoder |
| Pooling Strategy | Mean pooling with attention mask |
| Normalization | L2 normalized embeddings |
// Load the TFLite model in your Android app
val interpreter = Interpreter(loadModelFile())
// Prepare input tensors
val inputShape = intArrayOf(1, maxSequenceLength)
val inputBuffer = TensorBuffer.createFixedSize(inputShape, DataType.INT32)
// Run inference
interpreter.run(inputBuffer.buffer, outputBuffer.buffer)
// Use with tflite_flutter package
import 'package:tflite_flutter/tflite_flutter.dart';
// Load and run inference
final interpreter = await Interpreter.fromAsset('all_minilm_l6_v2.tflite');
final output = List.filled(384, 0.0).reshape([1, 384]);
interpreter.run(input, output);
# Verify model outputs match original
import tensorflow as tf
# Load TFLite model
interpreter = tf.lite.Interpreter(model_path="model.tflite")
interpreter.allocate_tensors()
# Get input and output tensors
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
# Run inference
interpreter.set_tensor(input_details[0]['index'], input_data)
interpreter.invoke()
output_data = interpreter.get_tensor(output_details[0]['index'])
| Metric | Value |
|---|---|
| Embedding Speed (CPU) | ~15ms per 1K tokens |
| Model Size | <50MB (TFLite format) |
| Memory Usage | Low memory footprint for mobile deployment |
| Accuracy | Maintains >95% similarity to original model outputs |
Found an issue or want to improve the model? Feel free to:
This model follows the same license terms as the original sentence-transformers/all-MiniLM-L6-v2 model.
Made with ❤️ for the mobile AI community
Enabling powerful text understanding directly on your device