Skip to content
Discussion options

You must be logged in to vote

The code uses a fixed-size integer array: int char_to_id[256];. Instead of instantiating C++ std::string objects and running them through a hash map (which requires slow heap memory allocation and hashing algorithms), the tokenizer simply casts a character to its raw ASCII/byte value ((unsigned char)c) and uses it as a direct $O(1)$ index to find the ID. this is when you pass a .txt file
like for eg:

.\llm.exe data\input.txt

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by eamonsippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants