AllMpnetBaseV2Sharp 0.1.3

dotnet add package AllMpnetBaseV2Sharp --version 0.1.3
                    
NuGet\Install-Package AllMpnetBaseV2Sharp -Version 0.1.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AllMpnetBaseV2Sharp" Version="0.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AllMpnetBaseV2Sharp" Version="0.1.3" />
                    
Directory.Packages.props
<PackageReference Include="AllMpnetBaseV2Sharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AllMpnetBaseV2Sharp --version 0.1.3
                    
#r "nuget: AllMpnetBaseV2Sharp, 0.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AllMpnetBaseV2Sharp@0.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AllMpnetBaseV2Sharp&version=0.1.3
                    
Install as a Cake Addin
#tool nuget:?package=AllMpnetBaseV2Sharp&version=0.1.3
                    
Install as a Cake Tool

AllMpnetBaseV2Sharp

C# implementation of Sentence Transformers all-mpnet-base-v2.

Built as a modern .NET 8 class library using ONNX Runtime and HuggingFace tokenizers for correctness and parity with the original Python model.


📦 NuGet

AllMpnetBaseV2Sharp

The NuGet package does not include the ONNX model or tokenizer.json. You will need to download them manually from all-mpnet-base-v2 on Hugging Face.

By default, the embedder looks for these files in the ./model folder: ./model/model.onnx ./model/tokenizer.json

You can also specify custom file locations by setting the paths in MpnetOptions.


🚀 How to Use

Single sentence

using AllMpnetBaseV2Sharp;

var sentence = "This is an example sentence";

using var embedder = new AllMpnetBaseV2Embedder();
var embedding = embedder.Encode(sentence);

Multiple sentences

using AllMpnetBaseV2Sharp;

string[] sentences =
{
    "This is an example sentence",
    "Here is another"
};

using var embedder = new AllMpnetBaseV2Embedder();
var embeddings = embedder.Encode(sentences);

Custom ONNX model (advanced)

var options = new MpnetOptions
{
    ModelPath = "path/to/model.onnx",
    TokenizerPath = "path/to/tokenizer.json"
};

using var embedder = new AllMpnetBaseV2Embedder(options);
var embedding = embedder.Encode("This is an example sentence");
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.3 184 12/19/2025
0.1.2 172 12/19/2025