We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1bfc153 commit 8687c1fCopy full SHA for 8687c1f
llama.cpp
@@ -2092,7 +2092,11 @@ void llama_set_kv_cache(
2092
int n_token_count) {
2093
// Make sure we have the same kv cache setup
2094
LLAMA_ASSERT(ctx->model.kv_self.buf.size == n_size);
2095
+ void * k_data = ctx->model.kv_self.k->data; // remember data pointers
2096
+ void * v_data = ctx->model.kv_self.v->data; // because their value is stored in buf and overwritten by memcpy
2097
memcpy(ctx->model.kv_self.buf.addr, kv_cache, n_size);
2098
+ ctx->model.kv_self.k->data = k_data; // restore correct data pointers
2099
+ ctx->model.kv_self.v->data = v_data;
2100
ctx->model.kv_self.n = n_token_count;
2101
}
2102
0 commit comments