A simple .NET library for local text embeddings with automatic model downloading from HuggingFace. Supports CUDA, DirectML, and CoreML GPU acceleration.
$ dotnet add package LMSupply.EmbedderLocal text embedding for .NET with automatic model downloading.
using LMSupply.Embedder;
// Load the default model
await using var model = await LocalEmbedder.LoadAsync("default");
// Generate embeddings
float[] embedding = await model.EmbedAsync("Hello, world!");
Console.WriteLine($"Dimensions: {embedding.Length}");
| Alias | Model | Dimensions | Description |
|---|---|---|---|
default | BGE-Small-EN-v1.5 | 384 | Best balance of speed and quality |
fast | all-MiniLM-L6-v2 | 384 | Ultra-lightweight, fastest |
quality | BGE-Base-EN-v1.5 | 768 | Higher accuracy |
large | Nomic-Embed-v1.5 | 768 | 8K context, top performer |
multilingual | E5-Base | 768 | 100+ languages |
# NVIDIA GPU
dotnet add package Microsoft.ML.OnnxRuntime.Gpu
# Windows (AMD/Intel/NVIDIA)
dotnet add package Microsoft.ML.OnnxRuntime.DirectML