Skip to content

Commit 13bee0d

Browse files
committed
some minor fixes
1 parent 8018e52 commit 13bee0d

File tree

9 files changed

+9
-36
lines changed

9 files changed

+9
-36
lines changed

koboldcpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ def fetch_gpu_properties(testCL,testCU,testVK):
12481248
for idx in range(0,4):
12491249
if(len(FetchedCUdevices)>idx):
12501250
if len(FetchedCUdeviceMem)>idx:
1251-
dmem = int(FetchedCUdeviceMem[idx]) if AMDgpu else (int(FetchedCUdeviceMem[idx])*1024*1024)
1251+
dmem = (int(FetchedCUdeviceMem[idx])*1024*1024) if AMDgpu else (int(FetchedCUdeviceMem[idx])*1024*1024)
12521252
lowestcumem = dmem if lowestcumem==0 else (dmem if dmem<lowestcumem else lowestcumem)
12531253
if len(FetchedCUfreeMem)>idx:
12541254
dmem = (int(FetchedCUfreeMem[idx])*1024*1024)

otherarch/tts_adapter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ bool ttstype_load_model(const tts_load_model_inputs inputs)
661661
printf("\nLoading OuteTTS Model, OuteTTS: %s \nWavTokenizer: %s \n",modelfile_ttc.c_str(),modelfile_cts.c_str());
662662
if(modelfile_ttc=="" || modelfile_cts=="")
663663
{
664-
printf("\nWarning: KCPP OuteTTS missing a file! Make sure both TTS and WavTokenizer models are loaded.\n");
665-
return false;
664+
printf("\nWarning: KCPP OuteTTS missing a file! Make sure both TTS and WavTokenizer models are loaded.\n");
665+
return false;
666666
}
667667
}
668668

otherarch/ttscpp/src/dac_model.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ static struct ggml_tensor * dac_build_audio_inputs(struct ggml_context * ctx, st
123123

124124
struct dac_context * build_new_dac_context(struct dac_model * model, int n_threads, bool use_cpu) {
125125
dac_context * dctx = new dac_context(model, n_threads);
126-
if (!use_cpu) {
127-
#ifdef GGML_USE_METAL
128-
dctx->backend = ggml_backend_metal_init();
129-
#endif
130-
}
131126
dctx->backend_cpu = ggml_backend_cpu_init();
132127
dctx->set_threads();
133128
dctx->build_schedule();

otherarch/ttscpp/src/kokoro_model.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,11 +1485,7 @@ std::string get_espeak_id_from_kokoro_voice(std::string voice) {
14851485

14861486
struct kokoro_duration_context * build_new_duration_kokoro_context(struct kokoro_model * model, int n_threads, bool use_cpu) {
14871487
kokoro_duration_context * kctx = new kokoro_duration_context(model, n_threads);
1488-
if (!use_cpu) {
1489-
#ifdef GGML_USE_METAL
1490-
kctx->backend = ggml_backend_metal_init();
1491-
#endif
1492-
}
1488+
14931489
kctx->backend_cpu = ggml_backend_cpu_init();
14941490
kctx->set_threads();
14951491
kctx->build_schedule();
@@ -1500,11 +1496,6 @@ struct kokoro_duration_context * build_new_duration_kokoro_context(struct kokoro
15001496

15011497
struct kokoro_context * build_new_kokoro_context(struct kokoro_model * model, int n_threads, bool use_cpu) {
15021498
kokoro_context * kctx = new kokoro_context(model, n_threads);
1503-
if (!use_cpu) {
1504-
#ifdef GGML_USE_METAL
1505-
kctx->backend = ggml_backend_metal_init();
1506-
#endif
1507-
}
15081499
kctx->backend_cpu = ggml_backend_cpu_init();
15091500
kctx->set_threads();
15101501
kctx->build_schedule();

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);
305+
tts_model::setup_from_file(meta_ctx, load_context, cpu_only, "kokoro", 1.6, post_load_tensor_bytes + 4096); //add some extra space
306306
}
307307
};
308308

otherarch/ttscpp/src/phonemizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,11 @@ void populate_kokoro_ipa_map(std::string executable_path)
821821
}
822822
}
823823
myfile.close();
824-
printf("\nPopulated Kokoro IPA: %d entries", kokoro_ipa_map.size());
824+
printf("\nPopulated Kokoro IPA: %d entries\n", kokoro_ipa_map.size());
825825
}
826826
else
827827
{
828-
printf("\nUnable to open Kokoro IPA file");
828+
printf("\nUnable to open Kokoro IPA file\n");
829829
}
830830
}
831831
std::string found_word_to_ipa(std::string input)

otherarch/ttscpp/src/snac_model.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ static struct ggml_tensor * snac_build_audio_inputs(struct ggml_context * ctx, s
110110

111111
snac_context * build_new_snac_context(struct snac_model * model, int n_threads, bool use_cpu) {
112112
snac_context * sctx = new snac_context(model, n_threads);
113-
if (!use_cpu) {
114-
#ifdef GGML_USE_METAL
115-
sctx->backend = ggml_backend_metal_init();
116-
#endif
117-
}
118113
sctx->backend_cpu = ggml_backend_cpu_init();
119114
sctx->set_threads();
120115
sctx->build_schedule();

otherarch/ttscpp/src/tts_model.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ void runner_context::get_ggml_node_data(struct ggml_tensor * output_node, float
3434

3535
void runner_context::set_threads() {
3636
if (backend != nullptr) {
37-
#ifdef GGML_USE_METAL
38-
// this is form copied from llama.cpp, but has since been removed. I don't know if this should be tuned.
39-
// ggml_backend_metal_set_n_cb(backend, 1);
40-
#endif
37+
4138
}
4239
if (backend_cpu != nullptr) {
4340
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
107104
}
108105
size_t ctx_size = ggml_tensor_overhead() * (tensor_meta.n_tensors * size_offset);
109106
struct ggml_init_params params = {
110-
/*.mem_size =*/ ctx_size,
107+
/*.mem_size =*/ ctx_size + 4096,
111108
/*.mem_buffer =*/ NULL,
112109
/*.no_alloc =*/ true,
113110
};

otherarch/ttscpp/src/ttst5_encoder_model.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@ void t5_encoder::assign_weight(std::string name, ggml_tensor * tensor) {
164164

165165
struct t5_context * build_new_t5_context(struct t5_encoder * model, int n_threads, bool use_cpu) {
166166
t5_context * t5ctx = new t5_context(model, n_threads);
167-
if (!use_cpu) {
168-
#ifdef GGML_USE_METAL
169-
t5ctx->backend = ggml_backend_metal_init();
170-
#endif
171-
}
172167
t5ctx->backend_cpu = ggml_backend_cpu_init();
173168
t5ctx->set_threads();
174169
t5ctx->build_schedule();

0 commit comments

Comments
 (0)