MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / sample

Function sample

examples/llava/llava-cli.cpp:107–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107static const char * sample(struct llama_context * ctx_llama, gpt_params & params, int * n_past) {
108 int id = sample_id(ctx_llama, params);
109 static std::string ret;
110 if (id == llama_token_eos(llama_get_model(ctx_llama))) {
111 ret = "</s>";
112 } else {
113 ret = llama_token_to_piece(ctx_llama, id);
114 }
115 eval_id(ctx_llama, id, n_past);
116 return ret.c_str();
117}
118
119static const char* IMG_BASE64_TAG_BEGIN = "<img src=\"data:image/jpeg;base64,";
120static const char* IMG_BASE64_TAG_END = "\">";

Callers 1

process_promptFunction · 0.85

Calls 6

sample_idFunction · 0.85
eval_idFunction · 0.85
llama_token_eosFunction · 0.50
llama_get_modelFunction · 0.50
llama_token_to_pieceFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected