Deprecated Package Version
Reason: Legacy, CriticalBugs
These packages are compatible with the runtime 0.5.0 or below. Please use 0.9.2 or above to use the runtime 0.6.1 or above. For the reason, check https://github.com/sappho192/Tokenizers.DotNet/issues/4
Install
dotnet add package Tokenizers.DotNet --version 0.9.0
No framework information available.
README
Tokenizers.DotNet
.NET wrapper of HuggingFace Tokenizers library
Nuget Package list
| Package | main | Description |
|---|---|---|
| Tokenizers.DotNet | Core library | |
| Tokenizers.DotNet.runtime.win | Native bindings for windows x64 |
Requirements
- .NET 6 or above
Supported functionalities
- Download tokenizer files from Hugginface Hub
- Load tokenizer file(
.json) from local - Decode embeddings to string
How to use
(1) Install the packages
- From the NuGet, install
Tokenizers.DotNetpackage - And then, install
Tokenizers.DotNet.runtime.winpackage too
(2) Write the code
Check following example code:
using Tokenizers.DotNet;
// Download skt/kogpt2-base-v2/tokenizer.json from the hub
var hubName = "skt/kogpt2-base-v2";
var filePath = "tokenizer.json";
var fileFullPath = await HuggingFace.GetFileFromHub(hubName, filePath, "deps");
Console.WriteLine($"Downloaded {fileFullPath}");
// Create a tokenizer instance
var tokenizer = new Tokenizer(vocabPath: fileFullPath);
var tokens = new uint[] { 9330, 387, 12857, 9376, 18649, 9098, 7656, 6969, 8084, 1 };
var decoded = tokenizer.Decode(tokens);
Console.WriteLine($"Decoded: {decoded}");
Console.WriteLine($"Version of Tokenizers.DotNet.runtime.win: {tokenizer.GetVersion()}");
How to build
- Prepare following stuff:
- Rust build system (
cargo) - .NET build system (
dotnet 6.0) - PowerShell (Recommend
7.4.2or above)
- Rust build system (
- Run
build_all_clean.ps1- To build
Tokenizers.DotNet.runtime.winonly, runbuild_rust.ps1 - To build
Tokenizers.DotNetonly, runbuild_dotnet.ps1
- To build
Each build artifacts will be in nuget directory.
Changes from Previous Version
No structural changes between v0.1.0 and v0.9.0.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
NuGet marks this package as deprecated. Review the publisher's migration guidance before adopting it.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.