Skip to content

Commit 59b6a09

Browse files
committed
try to fix kokoro alloc again
1 parent 216b766 commit 59b6a09

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

koboldcpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
extra_images_max = 4
6565

6666
# global vars
67-
KcppVersion = "1.99.2"
67+
KcppVersion = "1.99.3"
6868
showdebug = True
6969
kcpp_instance = None #global running instance
7070
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":""}

otherarch/ttscpp/src/kokoro_model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ struct kokoro_model : tts_model {
302302
compute_tensor_meta_cb = &fn;
303303
prep_constants(meta_ctx);
304304
prep_layers(meta_ctx);
305-
tts_model::setup_from_file(meta_ctx, load_context, cpu_only, "kokoro", 1.6, post_load_tensor_bytes + 4096); //add some extra space
305+
tts_model::setup_from_file(meta_ctx, load_context, cpu_only, "kokoro", 1.6, post_load_tensor_bytes);
306306
}
307307
};
308308

otherarch/ttscpp/src/tts_model.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,16 @@ void tts_model::prep_buffers_and_context(bool cpu_only, float size_offset, uint3
104104
}
105105
size_t ctx_size = ggml_tensor_overhead() * (tensor_meta.n_tensors * size_offset);
106106
struct ggml_init_params params = {
107-
/*.mem_size =*/ ctx_size + 4096,
107+
/*.mem_size =*/ ctx_size,
108108
/*.mem_buffer =*/ NULL,
109109
/*.no_alloc =*/ true,
110110
};
111+
if(dedicated_add_on_size>13000)
112+
{
113+
printf("Clamp TTS addon memory %zu to 13000\n",dedicated_add_on_size);
114+
dedicated_add_on_size = 13000;
115+
}
116+
printf("TTS Memory Requested: %zu, with buffer %zu + %zu\n",ctx_size,tensor_meta.n_bytes,dedicated_add_on_size);
111117
ctx = ggml_init(params);
112118
buf = ggml_backend_buft_alloc_buffer(buffer, tensor_meta.n_bytes + dedicated_add_on_size);
113119
}

0 commit comments

Comments
 (0)