Downloads · 30 days
0
SupermAInds/tokenizertest
tokenizertest is a machine learning model from SupermAInds. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as unknown.
Downloads · 30 days
0
Access
Public
Updated Oct 27, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 75%
From the Hugging Face model README
pip install transformers
from transformers import GPT2Tokenizer
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
tokens = tokenizer.tokenize(text) token_ids = tokenizer.convert_tokens_to_ids(tokens)
print(tokens) print(token_ids)