Skip to content

Commit

Permalink
Update example code of README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sappho192 committed Jun 12, 2024
1 parent d522400 commit acfccee
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@ Check following example code:
```CSharp
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}");

// 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 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
Expand Down

0 comments on commit acfccee

Please sign in to comment.