Scrapegraph-ai icon indicating copy to clipboard operation
Scrapegraph-ai copied to clipboard

improve tokenization function

Open VinciGit00 opened this issue 1 year ago • 0 comments

look at these sources link blog post link For hugging face models from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B") text = "Write your text here" tokens = tokenizer.tokenize(text) num_tokens = len(tokens) print(f"Number of tokens in your text: {num_tokens}")

VinciGit00 avatar Aug 16 '24 15:08 VinciGit00