some minor fixes

This commit is contained in:
Concedo
2025-09-22 13:20:06 +08:00
parent 8018e5222a
commit 13bee0d39d
9 changed files with 9 additions and 36 deletions
-5
View File
@@ -123,11 +123,6 @@ static struct ggml_tensor * dac_build_audio_inputs(struct ggml_context * ctx, st
struct dac_context * build_new_dac_context(struct dac_model * model, int n_threads, bool use_cpu) {
dac_context * dctx = new dac_context(model, n_threads);
if (!use_cpu) {
#ifdef GGML_USE_METAL
dctx->backend = ggml_backend_metal_init();
#endif
}
dctx->backend_cpu = ggml_backend_cpu_init();
dctx->set_threads();
dctx->build_schedule();
+1 -10
View File
@@ -1485,11 +1485,7 @@ std::string get_espeak_id_from_kokoro_voice(std::string voice) {
struct kokoro_duration_context * build_new_duration_kokoro_context(struct kokoro_model * model, int n_threads, bool use_cpu) {
kokoro_duration_context * kctx = new kokoro_duration_context(model, n_threads);
if (!use_cpu) {
#ifdef GGML_USE_METAL
kctx->backend = ggml_backend_metal_init();
#endif
}
kctx->backend_cpu = ggml_backend_cpu_init();
kctx->set_threads();
kctx->build_schedule();
@@ -1500,11 +1496,6 @@ struct kokoro_duration_context * build_new_duration_kokoro_context(struct kokoro
struct kokoro_context * build_new_kokoro_context(struct kokoro_model * model, int n_threads, bool use_cpu) {
kokoro_context * kctx = new kokoro_context(model, n_threads);
if (!use_cpu) {
#ifdef GGML_USE_METAL
kctx->backend = ggml_backend_metal_init();
#endif
}
kctx->backend_cpu = ggml_backend_cpu_init();
kctx->set_threads();
kctx->build_schedule();
+1 -1
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);
tts_model::setup_from_file(meta_ctx, load_context, cpu_only, "kokoro", 1.6, post_load_tensor_bytes + 4096); //add some extra space
}
};
+2 -2
View File
@@ -821,11 +821,11 @@ void populate_kokoro_ipa_map(std::string executable_path)
}
}
myfile.close();
printf("\nPopulated Kokoro IPA: %d entries", kokoro_ipa_map.size());
printf("\nPopulated Kokoro IPA: %d entries\n", kokoro_ipa_map.size());
}
else
{
printf("\nUnable to open Kokoro IPA file");
printf("\nUnable to open Kokoro IPA file\n");
}
}
std::string found_word_to_ipa(std::string input)
-5
View File
@@ -110,11 +110,6 @@ static struct ggml_tensor * snac_build_audio_inputs(struct ggml_context * ctx, s
snac_context * build_new_snac_context(struct snac_model * model, int n_threads, bool use_cpu) {
snac_context * sctx = new snac_context(model, n_threads);
if (!use_cpu) {
#ifdef GGML_USE_METAL
sctx->backend = ggml_backend_metal_init();
#endif
}
sctx->backend_cpu = ggml_backend_cpu_init();
sctx->set_threads();
sctx->build_schedule();
+2 -5
View File
@@ -34,10 +34,7 @@ void runner_context::get_ggml_node_data(struct ggml_tensor * output_node, float
void runner_context::set_threads() {
if (backend != nullptr) {
#ifdef GGML_USE_METAL
// this is form copied from llama.cpp, but has since been removed. I don't know if this should be tuned.
// ggml_backend_metal_set_n_cb(backend, 1);
#endif
}
if (backend_cpu != nullptr) {
ggml_backend_cpu_set_n_threads(backend_cpu, n_threads);
@@ -107,7 +104,7 @@ 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,
/*.mem_size =*/ ctx_size + 4096,
/*.mem_buffer =*/ NULL,
/*.no_alloc =*/ true,
};
@@ -164,11 +164,6 @@ void t5_encoder::assign_weight(std::string name, ggml_tensor * tensor) {
struct t5_context * build_new_t5_context(struct t5_encoder * model, int n_threads, bool use_cpu) {
t5_context * t5ctx = new t5_context(model, n_threads);
if (!use_cpu) {
#ifdef GGML_USE_METAL
t5ctx->backend = ggml_backend_metal_init();
#endif
}
t5ctx->backend_cpu = ggml_backend_cpu_init();
t5ctx->set_threads();
t5ctx->build_schedule();