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

Function test_dry

smallthinker/tests/test-sampling.cpp:161–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161static void test_dry(
162 const std::vector<float> & probs, const std::vector<llama_token> & last_tokens,
163 const std::vector<float> & expected_probs, float dry_multiplier, float dry_base,
164 int dry_allowed_length, int dry_penalty_last_n,
165 const std::vector<std::vector<llama_token>> & seq_breakers
166) {
167 GGML_ASSERT(probs.size() == expected_probs.size());
168
169 sampler_tester tester(probs, expected_probs);
170
171 auto * sampler = llama_sampler_init_dry_testing(1024, dry_multiplier, dry_base, dry_allowed_length, dry_penalty_last_n, seq_breakers);
172
173 for (size_t i = 0; i < last_tokens.size(); i++) {
174 llama_sampler_accept(sampler, last_tokens[i]);
175 }
176
177 DUMP(&tester.cur_p);
178 tester.apply(sampler);
179 tester.apply(llama_sampler_init_dist(0));
180 DUMP(&tester.cur_p);
181 tester.check();
182}
183
184static void test_top_n_sigma(const std::vector<float> & probs, const std::vector<float> & probs_expected, int n) {
185 sampler_tester tester(probs, probs_expected);

Callers 1

mainFunction · 0.85

Calls 6

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

Tested by

no test coverage detected