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

Function llama_sampler_init_dry_testing

smallthinker/src/llama-sampling.cpp:2186–2212  ·  view source on GitHub ↗

wrapper for test-sampling.cpp

Source from the content-addressed store, hash-verified

2184
2185// wrapper for test-sampling.cpp
2186struct llama_sampler * llama_sampler_init_dry_testing(int32_t context_size, float dry_multiplier, float dry_base, int32_t dry_allowed_length, int32_t dry_penalty_last_n, const std::vector<std::vector<llama_token>>& seq_breakers) {
2187 llama_vocab dummy_vocab;
2188 auto * result = llama_sampler_init_dry(&dummy_vocab, context_size, dry_multiplier, dry_base, dry_allowed_length, dry_penalty_last_n, NULL, 0);
2189 auto * ctx = (llama_sampler_dry *) result->ctx;
2190
2191 // Process the token-based sequence breakers
2192 ctx->dry_processed_breakers.clear();
2193 if (seq_breakers.empty()) {
2194 LLAMA_LOG_WARN("empty DRY sequence breakers list in llama_sampler_init_dry_testing\n");
2195 } else {
2196 for (const auto& breaker : seq_breakers) {
2197 if (breaker.empty()) {
2198 LLAMA_LOG_WARN("skipping DRY empty sequence breaker\n");
2199 continue;
2200 }
2201 llama_token head_token = breaker[0];
2202 std::vector<llama_token> tail_tokens(breaker.begin() + 1, breaker.end());
2203 ctx->dry_processed_breakers.emplace(head_token, std::move(tail_tokens));
2204 }
2205
2206 if (ctx->dry_processed_breakers.empty()) {
2207 LLAMA_LOG_WARN("no valid DRY sequence breakers processed in llama_sampler_init_dry_testing\n");
2208 }
2209 }
2210
2211 return result;
2212}
2213
2214// logit-bias
2215

Callers 1

test_dryFunction · 0.85

Calls 5

llama_sampler_init_dryFunction · 0.85
clearMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

test_dryFunction · 0.68