AllMpnetBaseV2Sharp 0.1.2
See the version list below for details.
dotnet add package AllMpnetBaseV2Sharp --version 0.1.2
NuGet\Install-Package AllMpnetBaseV2Sharp -Version 0.1.2
<PackageReference Include="AllMpnetBaseV2Sharp" Version="0.1.2" />
<PackageVersion Include="AllMpnetBaseV2Sharp" Version="0.1.2" />
<PackageReference Include="AllMpnetBaseV2Sharp" />
paket add AllMpnetBaseV2Sharp --version 0.1.2
#r "nuget: AllMpnetBaseV2Sharp, 0.1.2"
#:package AllMpnetBaseV2Sharp@0.1.2
#addin nuget:?package=AllMpnetBaseV2Sharp&version=0.1.2
#tool nuget:?package=AllMpnetBaseV2Sharp&version=0.1.2
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
❌ The NuGet package does not include the ONNX model or tokenizer.json. You need to download them manually from Hugging Face (see tested models below). 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 | Versions 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. |
-
net8.0
- Microsoft.ML.OnnxRuntime (>= 1.23.2)
- Tokenizers.HuggingFace (>= 2.21.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.