From 13bee0d39d3d65110e4949c179ad34f83bf9d362 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Mon, 22 Sep 2025 13:20:06 +0800 Subject: [PATCH] some minor fixes --- koboldcpp.py | 2 +- otherarch/tts_adapter.cpp | 4 ++-- otherarch/ttscpp/src/dac_model.cpp | 5 ----- otherarch/ttscpp/src/kokoro_model.cpp | 11 +---------- otherarch/ttscpp/src/kokoro_model.h | 2 +- otherarch/ttscpp/src/phonemizer.cpp | 4 ++-- otherarch/ttscpp/src/snac_model.cpp | 5 ----- otherarch/ttscpp/src/tts_model.cpp | 7 ++----- otherarch/ttscpp/src/ttst5_encoder_model.cpp | 5 ----- 9 files changed, 9 insertions(+), 36 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 7cbb95cd3..82f2fd873 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -1248,7 +1248,7 @@ def fetch_gpu_properties(testCL,testCU,testVK): for idx in range(0,4): if(len(FetchedCUdevices)>idx): if len(FetchedCUdeviceMem)>idx: - dmem = int(FetchedCUdeviceMem[idx]) if AMDgpu else (int(FetchedCUdeviceMem[idx])*1024*1024) + dmem = (int(FetchedCUdeviceMem[idx])*1024*1024) if AMDgpu else (int(FetchedCUdeviceMem[idx])*1024*1024) lowestcumem = dmem if lowestcumem==0 else (dmem if dmemidx: dmem = (int(FetchedCUfreeMem[idx])*1024*1024) diff --git a/otherarch/tts_adapter.cpp b/otherarch/tts_adapter.cpp index fc372c1ed..0068953ef 100644 --- a/otherarch/tts_adapter.cpp +++ b/otherarch/tts_adapter.cpp @@ -661,8 +661,8 @@ bool ttstype_load_model(const tts_load_model_inputs inputs) printf("\nLoading OuteTTS Model, OuteTTS: %s \nWavTokenizer: %s \n",modelfile_ttc.c_str(),modelfile_cts.c_str()); if(modelfile_ttc=="" || modelfile_cts=="") { - printf("\nWarning: KCPP OuteTTS missing a file! Make sure both TTS and WavTokenizer models are loaded.\n"); - return false; + printf("\nWarning: KCPP OuteTTS missing a file! Make sure both TTS and WavTokenizer models are loaded.\n"); + return false; } } diff --git a/otherarch/ttscpp/src/dac_model.cpp b/otherarch/ttscpp/src/dac_model.cpp index 2ab640cec..0a6201bd9 100644 --- a/otherarch/ttscpp/src/dac_model.cpp +++ b/otherarch/ttscpp/src/dac_model.cpp @@ -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(); diff --git a/otherarch/ttscpp/src/kokoro_model.cpp b/otherarch/ttscpp/src/kokoro_model.cpp index a6543c7cc..eb0d43aa9 100644 --- a/otherarch/ttscpp/src/kokoro_model.cpp +++ b/otherarch/ttscpp/src/kokoro_model.cpp @@ -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(); diff --git a/otherarch/ttscpp/src/kokoro_model.h b/otherarch/ttscpp/src/kokoro_model.h index 808f78761..00ef1b6ae 100644 --- a/otherarch/ttscpp/src/kokoro_model.h +++ b/otherarch/ttscpp/src/kokoro_model.h @@ -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 } }; diff --git a/otherarch/ttscpp/src/phonemizer.cpp b/otherarch/ttscpp/src/phonemizer.cpp index 078dcb707..31ceb8de8 100644 --- a/otherarch/ttscpp/src/phonemizer.cpp +++ b/otherarch/ttscpp/src/phonemizer.cpp @@ -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) diff --git a/otherarch/ttscpp/src/snac_model.cpp b/otherarch/ttscpp/src/snac_model.cpp index 0f58c62e1..9b4f3fc41 100644 --- a/otherarch/ttscpp/src/snac_model.cpp +++ b/otherarch/ttscpp/src/snac_model.cpp @@ -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(); diff --git a/otherarch/ttscpp/src/tts_model.cpp b/otherarch/ttscpp/src/tts_model.cpp index 6ab48ad98..13dcb875a 100644 --- a/otherarch/ttscpp/src/tts_model.cpp +++ b/otherarch/ttscpp/src/tts_model.cpp @@ -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, }; diff --git a/otherarch/ttscpp/src/ttst5_encoder_model.cpp b/otherarch/ttscpp/src/ttst5_encoder_model.cpp index cce9afdf7..3f8f3ceaa 100644 --- a/otherarch/ttscpp/src/ttst5_encoder_model.cpp +++ b/otherarch/ttscpp/src/ttst5_encoder_model.cpp @@ -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();