mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-11 04:56:56 +02:00
sampler : add llama_sampler_copy
Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731
This commit is contained in:
+1
-2
@@ -1310,8 +1310,7 @@ extern "C" {
|
||||
LLAMA_API void llama_sampler_apply ( struct llama_sampler * smpl, llama_token_data_array * cur_p);
|
||||
LLAMA_API void llama_sampler_reset ( struct llama_sampler * smpl);
|
||||
LLAMA_API struct llama_sampler * llama_sampler_clone (const struct llama_sampler * smpl);
|
||||
// copy the state of src into dst; both must be samplers of the same type
|
||||
LLAMA_API void llama_sampler_copy ( struct llama_sampler * dst, const struct llama_sampler * src);
|
||||
LLAMA_API void llama_sampler_copy (const struct llama_sampler * src, struct llama_sampler * dst);
|
||||
// important: do not free if the sampler has been added to a llama_sampler_chain (via llama_sampler_chain_add)
|
||||
LLAMA_API void llama_sampler_free ( struct llama_sampler * smpl);
|
||||
|
||||
|
||||
@@ -417,12 +417,12 @@ struct llama_sampler * llama_sampler_clone(const struct llama_sampler * smpl) {
|
||||
GGML_ABORT("the sampler does not support cloning");
|
||||
}
|
||||
|
||||
void llama_sampler_copy(struct llama_sampler * dst, const struct llama_sampler * src) {
|
||||
if (!dst || !src) {
|
||||
void llama_sampler_copy(const struct llama_sampler * src, struct llama_sampler * dst) {
|
||||
if (!src || !dst) {
|
||||
return;
|
||||
}
|
||||
|
||||
GGML_ASSERT(dst->iface == src->iface && "llama_sampler_copy: cannot copy between different sampler types");
|
||||
GGML_ASSERT(src->iface == dst->iface && "llama_sampler_copy: cannot copy between different sampler types");
|
||||
|
||||
// build a temporary sampler carrying src's current state
|
||||
llama_sampler * tmp = llama_sampler_clone(src);
|
||||
|
||||
Reference in New Issue
Block a user