Class Tokenizer
- Namespace
- OpenCvSharp.Dnn
- Assembly
- OpenCvSharp.dll
Tokenizer for LLM / VLM text (OpenCV 5). Provides a simple API to encode text to token ids and decode token ids back to text (BPE, e.g. gpt2 / gpt4 families).
public class Tokenizer : CvObject, IDisposable
- Inheritance
-
Tokenizer
- Implements
- Inherited Members
Methods
- Decode(int[])
Decodes token ids back to text.
- Encode(string)
Encodes UTF-8 text to token ids.
- Load(string)
Loads a tokenizer from a model directory. The directory must contain a config.json (with a supported
model_type, e.g. "gpt2" or "gpt4") and a tokenizer.json.