C# implementation of Sentence Transformers All-MiniLM-L6-v2
Use as a .net standard 2.1 library.
Includes tokenizer and onnx model.
var sentence = "This is an example sentence";
var embedder = new AllMiniLmL6V2Embedder();
var embedding = embedder.GenerateEmbedding(sentence);
string[] sentences = ["This is an example sentence", "Here is another"];
var embedder = new AllMiniLmL6V2Embedder();
var embeddings = model.GenerateEmbeddings(sentences);
var sentence = "This is an example sentence";
var embedder = new AllMiniLmL6V2Embedder(modelPath: "path/to/model.onnx");
var embedding = embedder.GenerateEmbedding(sentence);
var sentence = "This is an example sentence";
BertTokenizer tokenizer = new("path/to/vocab.txt");
var embedder = new AllMiniLmL6V2Embedder(tokenizer: tokenizer);
var embedding = embedder.GenerateEmbedding(sentence);
var sentence = "This is an example sentence";
ITokenizer tokenizer = new CustomTokenizer();
var embedder = new AllMiniLmL6V2Embedder(tokenizer: tokenizer);
var embedding = embedder.GenerateEmbedding(sentence);