MCPcopy Create free account
hub / github.com/andrewkchan/deepseek.cpp / encode_prompt

Function encode_prompt

src/main.cpp:257–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255};
256
257std::vector<int> encode_prompt(const std::string& prompt, Tokenizer& tokenizer) {
258 std::vector<int> encoding;
259 {
260 uint64_t encode_start_ms = get_timestamp_ms();
261 encoding = tokenizer.encode(prompt, true);
262 uint64_t encode_end_ms = get_timestamp_ms();
263
264 std::cout << tokenizer.encoding_to_debug_string(encoding) << std::endl;
265 uint64_t encoding_ms = encode_end_ms - encode_start_ms;
266 std::cout << fmt::format(
267 "Encoding stats: ({} tokens, throughput: {:.5}tok/s, latency: {:.5}s/tok, total: {:.5}s)\n",
268 encoding.size(),
269 encoding.size() / (encoding_ms / 1000.0),
270 (encoding_ms / 1000.0) / encoding.size(),
271 encoding_ms / 1000.0
272 ) << std::endl;
273 }
274 return encoding;
275}
276
277void run_completion(
278 Session& session,

Callers 3

run_completionFunction · 0.85
run_interactiveFunction · 0.85
mainFunction · 0.85

Calls 3

get_timestamp_msFunction · 0.85
encodeMethod · 0.80

Tested by

no test coverage detected