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

Function test_penalties

tests/test-sampling.cpp:139–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139static void test_penalties(
140 const std::vector<float> & probs, const std::vector<llama_token> & last_tokens,
141 const std::vector<float> & probs_expected, float repeat_penalty, float alpha_frequency, float alpha_presence
142) {
143 GGML_ASSERT(probs.size() == probs_expected.size());
144
145 sampler_tester tester(probs, probs_expected);
146
147 auto * sampler = llama_sampler_init_penalties(last_tokens.size(), repeat_penalty, alpha_frequency, alpha_presence);
148
149 for (size_t i = 0; i < last_tokens.size(); i++) {
150 llama_sampler_accept(sampler, last_tokens[i]);
151 }
152
153 DUMP(&tester.cur_p);
154 tester.apply(sampler);
155 tester.apply(llama_sampler_init_dist(0));
156 DUMP(&tester.cur_p);
157
158 tester.check();
159}
160
161static void test_dry(
162 const std::vector<float> & probs, const std::vector<llama_token> & last_tokens,

Callers 1

mainFunction · 0.85

Calls 6

llama_sampler_acceptFunction · 0.85
llama_sampler_init_distFunction · 0.85
checkMethod · 0.80
sizeMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected