From: wwoodsTM Date: Thu, 7 Nov 2024 15:20:25 +0000 (-0700) Subject: DRY: Fixes clone functionality (#10192) X-Git-Tag: upstream/0.0.4488~445 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=5107e8cea35be46a27cfc940e6841c0cf81c0525;p=pkg%2Fggml%2Fsources%2Fllama.cpp DRY: Fixes clone functionality (#10192) --- diff --git a/src/llama-sampling.cpp b/src/llama-sampling.cpp index c2cfe0a7..fd8ca8a9 100644 --- a/src/llama-sampling.cpp +++ b/src/llama-sampling.cpp @@ -1876,8 +1876,11 @@ static void llama_sampler_dry_reset(struct llama_sampler * smpl) { static struct llama_sampler * llama_sampler_dry_clone(const struct llama_sampler * smpl) { const auto * ctx = (llama_sampler_dry *) smpl->ctx; - // nullptr is passed as vocab because it is only needed for raw sequence breaker processing, which we have already done and will be copying - auto * result = llama_sampler_init_dry(nullptr, ctx->dry_multiplier, ctx->dry_base, ctx->dry_allowed_length, ctx->dry_penalty_last_n, NULL, 0); + llama_vocab dummy_vocab; + + // dummy vocab is passed because it is only needed for raw sequence breaker processing, which we have already done and will simply be copying + auto * result = llama_sampler_init_dry_impl(dummy_vocab, ctx->total_context_size, ctx->dry_multiplier, ctx->dry_base, ctx->dry_allowed_length, ctx->dry_penalty_last_n, NULL, 0); + // Copy the state, including the processed breakers { auto * result_ctx = (llama_sampler_dry *) result->ctx;