News for hackers. Stuff that matters.
Re:Xkcd 1425 (Tasks) turns ten years old today by marcellus23 on Thursday September 26, 2024 @10:50AM (#41659059)
> the token with id 24912 for gpt-4o to be precise

How do you find this out?

Re:Xkcd 1425 (Tasks) turns ten years old today by MarioMan on Thursday September 26, 2024 @01:15PM (#41660849)
OpenAI provides a tokenizer tool: https://platform.openai.com/tokenizer
Re:Xkcd 1425 (Tasks) turns ten years old today by conesus on Thursday September 26, 2024 @01:15PM (#41660850)
GPT-4o uses BPE (byte pair encoding). They released `tiktoken` which allows you to count tokens in strings in python.

    pip install tiktoken
    >>> import tiktoken
    >>> encoding = tiktoken.encoding_for_model("gpt-4o")
    >>> print(encoding.encode("hello marcellus"))
    [24912, 2674, 10936, 385]