Skip to content

Commit 181879f

Browse files
Anontrollkotze
Anon
authored andcommitted
llama_control_vector_load: let gguf_init_from_file allocate the ggml_context
1 parent 6e1fbf8 commit 181879f

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

common/common.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,12 +2650,7 @@ static llama_control_vector_data llama_control_vector_load_one(const llama_contr
26502650

26512651
// calculate size of ctx needed for tensors, ensure tensors are f32, and find max layer
26522652
{
2653-
struct ggml_init_params meta_params = {
2654-
/* .mem_size = */ ggml_tensor_overhead() * 128 + ggml_graph_overhead(),
2655-
/* .mem_buffer = */ nullptr,
2656-
/* .no_alloc = */ true,
2657-
};
2658-
ggml_context * meta_ctx = ggml_init(meta_params);
2653+
ggml_context * meta_ctx = nullptr;
26592654
struct gguf_init_params meta_gguf_params = {
26602655
/* .no_alloc = */ true,
26612656
/* .ctx = */ &meta_ctx,
@@ -2720,13 +2715,7 @@ static llama_control_vector_data llama_control_vector_load_one(const llama_contr
27202715
}
27212716

27222717
// load and scale tensors into final control vector context
2723-
struct ggml_init_params ggml_params = {
2724-
/* .mem_size = */ ggml_tensor_overhead() * n_tensors + n_bytes,
2725-
/* .mem_buffer = */ nullptr,
2726-
/* .no_alloc = */ false,
2727-
};
2728-
struct ggml_context * ctx = ggml_init(ggml_params);
2729-
2718+
struct ggml_context * ctx = nullptr;
27302719
struct gguf_init_params params = {
27312720
/*.no_alloc = */ false,
27322721
/*.ctx = */ &ctx,

0 commit comments

Comments
 (0)