text-davinci-002 / README.md
Xenova's picture
Xenova HF staff
Create README.md
f81b8da
|
raw
history blame
949 Bytes
metadata
library_name: transformers
tags:
  - transformers.js
  - tokenizers

text-davinci-002 Tokenizer

A 🤗-compatible version of the text-davinci-002 tokenizer (adapted from openai/tiktoken). This means it can be used with Hugging Face libraries including Transformers, Tokenizers, and Transformers.js.

Example usage:

Transformers/Tokenizers

from transformers import GPT2TokenizerFast

tokenizer = GPT2TokenizerFast.from_pretrained('Xenova/text-davinci-002')
assert tokenizer.encode('hello world') == [31373, 995]

Transformers.js

import { AutoTokenizer } from '@xenova/transformers';

const tokenizer = await AutoTokenizer.from_pretrained('Xenova/text-davinci-002');
const tokens = tokenizer.encode('hello world'); // [31373, 995]