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

Function llama_sampler_dry_clone

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

Source from the content-addressed store, hash-verified

2103}
2104
2105static struct llama_sampler * llama_sampler_dry_clone(const struct llama_sampler * smpl) {
2106 const auto * ctx = (llama_sampler_dry *) smpl->ctx;
2107
2108 llama_vocab dummy_vocab;
2109
2110 // dummy vocab is passed because it is only needed for raw sequence breaker processing, which we have already done and will simply be copying
2111 auto * result = llama_sampler_init_dry(&dummy_vocab, ctx->total_context_size, ctx->dry_multiplier, ctx->dry_base, ctx->dry_allowed_length, ctx->dry_penalty_last_n, NULL, 0);
2112
2113 // Copy the state, including the processed breakers
2114 {
2115 auto * result_ctx = (llama_sampler_dry *) result->ctx;
2116 result_ctx->dry_processed_breakers = ctx->dry_processed_breakers;
2117 result_ctx->dry_repeat_count = ctx->dry_repeat_count;
2118 result_ctx->dry_max_token_repeat = ctx->dry_max_token_repeat;
2119 result_ctx->last_tokens = ctx->last_tokens;
2120 }
2121
2122 return result;
2123}
2124
2125static void llama_sampler_dry_free(struct llama_sampler * smpl) {
2126 delete (llama_sampler_dry *) smpl->ctx;

Callers

nothing calls this directly

Calls 1

llama_sampler_init_dryFunction · 0.85

Tested by

no test coverage detected