MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / common_sampler_prev_str

Function common_sampler_prev_str

common/sampling.cpp:698–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

696}
697
698std::string common_sampler_prev_str(common_sampler * gsmpl, llama_context * ctx_main, int n) {
699 n = std::min(n, (int) gsmpl->prev.size());
700
701 if (n <= 0) {
702 return "";
703 }
704
705 std::string result;
706 result.reserve(8*n); // 8 is the average length of a token [citation needed], TODO: compute this from the vocab
707
708 for (int i = n - 1; i >= 0; i--) {
709 const llama_token id = gsmpl->prev.rat(i);
710
711 GGML_ASSERT(id != LLAMA_TOKEN_NULL && "null token in the sampling history - should not happen");
712
713 result += common_token_to_piece(ctx_main, id);
714 }
715
716 return result;
717}
718
719char common_sampler_type_to_chr(enum common_sampler_type cnstr) {
720 switch (cnstr) {

Callers 1

mainFunction · 0.85

Calls 3

minFunction · 0.85
common_token_to_pieceFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected