Deprecated Package Version
Reason: Legacy
There's breaking changes to the library. Check following issue: https://github.com/sappho192/Tokenizers.DotNet/issues/2
Install
dotnet add package Tokenizers.DotNet --version 0.1.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;
var hubName = "skt/kogpt2-base-v2";
var filePath = "tokenizer.json";
var fileFullPath = await HuggingFace.GetFileFromHub(hubName, filePath, "deps");
Console.WriteLine($"Downloaded {fileFullPath}");
// Write the path of tokenizer.json to tokenizer.path.txt
var tokenizerPath = "tokenizer.path.txt";
await File.WriteAllTextAsync(tokenizerPath, fileFullPath);
Console.WriteLine($"Wrote {fileFullPath} to {tokenizerPath}");
// Create a tokenizer instance
var tokenizer = new Tokenizer();
var tokens = new uint[] { 9330, 387, 12857, 9376, 18649, 9098, 7656, 6969, 8084, 1 };
var decoded = tokenizer.Decode(tokens);
Console.WriteLine($"Decoded: {decoded}");
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.0.1 and v0.1.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.