MCPcopy Create free account
hub / github.com/M4THYOU/TokenDagger / LoadBPEFile

Function LoadBPEFile

src/main.cpp:89–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87
88
89void LoadBPEFile(const std::string& filename, std::vector<VocabItem>& vocab) {
90 std::ifstream file(filename);
91 std::string line;
92
93 while (std::getline(file, line)) {
94 if (line.empty()) continue;
95
96 std::istringstream iss(line);
97 std::string base64_token;
98 int rank;
99
100 if (iss >> base64_token >> rank) {
101 // Decode base64 to bytes
102 std::vector<unsigned char> token_bytes = base64_decode(base64_token);
103
104 VocabItem item;
105 item.rank = rank;
106 item.token_bytes = token_bytes;
107 vocab.push_back(item);
108 }
109 }
110}
111
112void LoadTokenizer(const std::string& tokenizer_path, const std::string& bpe_path, Llama4Tokenizer& tokenizer) {
113 // hard code it for now.

Callers 1

LoadTokenizerFunction · 0.85

Calls 2

base64_decodeFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected