try to fix kokoro alloc again

This commit is contained in:
Concedo 2025-09-22 21:22:41 +08:00
parent 216b766aee
commit 59b6a09ae1
3 changed files with 9 additions and 3 deletions

View file

@ -64,7 +64,7 @@ dry_seq_break_max = 128
extra_images_max = 4
# global vars
KcppVersion = "1.99.2"
KcppVersion = "1.99.3"
showdebug = True
kcpp_instance = None #global running instance
global_memory = {"tunnel_url": "", "restart_target":"", "input_to_exit":False, "load_complete":False, "restart_override_config_target":""}

View file

@ -302,7 +302,7 @@ struct kokoro_model : tts_model {
compute_tensor_meta_cb = &fn;
prep_constants(meta_ctx);
prep_layers(meta_ctx);
tts_model::setup_from_file(meta_ctx, load_context, cpu_only, "kokoro", 1.6, post_load_tensor_bytes + 4096); //add some extra space
tts_model::setup_from_file(meta_ctx, load_context, cpu_only, "kokoro", 1.6, post_load_tensor_bytes);
}
};

View file

@ -104,10 +104,16 @@ void tts_model::prep_buffers_and_context(bool cpu_only, float size_offset, uint3
}
size_t ctx_size = ggml_tensor_overhead() * (tensor_meta.n_tensors * size_offset);
struct ggml_init_params params = {
/*.mem_size =*/ ctx_size + 4096,
/*.mem_size =*/ ctx_size,
/*.mem_buffer =*/ NULL,
/*.no_alloc =*/ true,
};
if(dedicated_add_on_size>13000)
{
printf("Clamp TTS addon memory %zu to 13000\n",dedicated_add_on_size);
dedicated_add_on_size = 13000;
}
printf("TTS Memory Requested: %zu, with buffer %zu + %zu\n",ctx_size,tensor_meta.n_bytes,dedicated_add_on_size);
ctx = ggml_init(params);
buf = ggml_backend_buft_alloc_buffer(buffer, tensor_meta.n_bytes + dedicated_add_on_size);
}