From cfc1a0d4ef63a361821d295933f42520b72def12 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sun, 17 Aug 2025 13:53:27 +0800 Subject: [PATCH] tts cpp cli builds and runs fine. --- Makefile | 2 +- ggml/src/ggml-cpu/binary-ops.cpp | 10 +++++- otherarch/ttscpp/{examples => }/cli/cli.cpp | 0 .../ttscpp/{examples => }/cli/playback.cpp | 0 .../ttscpp/{examples => }/cli/playback.h | 0 otherarch/ttscpp/{examples => }/cli/vad.cpp | 0 otherarch/ttscpp/{examples => }/cli/vad.h | 0 .../ttscpp/{examples => }/cli/write_file.cpp | 0 .../ttscpp/{examples => }/cli/write_file.h | 0 .../ttscpp/examples/phonemize/phonemize.cpp | 31 ------------------- 10 files changed, 10 insertions(+), 33 deletions(-) rename otherarch/ttscpp/{examples => }/cli/cli.cpp (100%) rename otherarch/ttscpp/{examples => }/cli/playback.cpp (100%) rename otherarch/ttscpp/{examples => }/cli/playback.h (100%) rename otherarch/ttscpp/{examples => }/cli/vad.cpp (100%) rename otherarch/ttscpp/{examples => }/cli/vad.h (100%) rename otherarch/ttscpp/{examples => }/cli/write_file.cpp (100%) rename otherarch/ttscpp/{examples => }/cli/write_file.h (100%) delete mode 100644 otherarch/ttscpp/examples/phonemize/phonemize.cpp diff --git a/Makefile b/Makefile index 9eed29485..2400dffff 100644 --- a/Makefile +++ b/Makefile @@ -729,7 +729,7 @@ mainvk: tools/main/main.cpp common/arg.cpp build-info.h ggml_v4_vulkan.o ggml-cp $(CXX) $(CXXFLAGS) -DGGML_USE_VULKAN -DSD_USE_VULKAN $(filter-out %.h,$^) -o $@ $(LDFLAGS) embedding: examples/embedding/embedding.cpp common/arg.cpp build-info.h ggml.o ggml-cpu.o ggml-ops.o ggml-vec.o ggml-binops.o ggml-unops.o llama.o console.o llavaclip_default.o llava.o ggml-backend_default.o ggml-backend-reg_default.o ggml-repack.o $(OBJS_FULL) $(OBJS) $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) -ttscppmain: otherarch/ttscpp/examples/cli/cli.cpp otherarch/ttscpp/examples/cli/playback.cpp otherarch/ttscpp/examples/cli/playback.h otherarch/ttscpp/examples/cli/write_file.cpp otherarch/ttscpp/examples/cli/write_file.h otherarch/ttscpp/examples/cli/vad.cpp otherarch/ttscpp/examples/cli/vad.h otherarch/ttscpp/src/tts.cpp otherarch/ttscpp/src/tokenizer.cpp otherarch/ttscpp/src/sampler.cpp otherarch/ttscpp/src/parler_model.cpp otherarch/ttscpp/src/dac_model.cpp otherarch/ttscpp/src/ttsutil.cpp otherarch/ttscpp/src/args.cpp otherarch/ttscpp/src/t5_encoder_model.cpp otherarch/ttscpp/src/phonemizer.cpp otherarch/ttscpp/src/tts_model.cpp otherarch/ttscpp/src/kokoro_model.cpp otherarch/ttscpp/src/dia_model.cpp otherarch/ttscpp/src/orpheus_model.cpp otherarch/ttscpp/src/snac_model.cpp otherarch/ttscpp/src/general_neural_audio_codec.cpp ggml.o ggml-cpu.o ggml-ops.o ggml-vec.o ggml-binops.o ggml-unops.o llama.o console.o llavaclip_default.o llava.o ggml-backend_default.o ggml-backend-reg_default.o ggml-repack.o $(OBJS_FULL) $(OBJS) +ttscppmain: otherarch/ttscpp/cli/cli.cpp otherarch/ttscpp/cli/playback.cpp otherarch/ttscpp/cli/playback.h otherarch/ttscpp/cli/write_file.cpp otherarch/ttscpp/cli/write_file.h otherarch/ttscpp/cli/vad.cpp otherarch/ttscpp/cli/vad.h otherarch/ttscpp/src/tts.cpp otherarch/ttscpp/src/tokenizer.cpp otherarch/ttscpp/src/sampler.cpp otherarch/ttscpp/src/parler_model.cpp otherarch/ttscpp/src/dac_model.cpp otherarch/ttscpp/src/ttsutil.cpp otherarch/ttscpp/src/args.cpp otherarch/ttscpp/src/t5_encoder_model.cpp otherarch/ttscpp/src/phonemizer.cpp otherarch/ttscpp/src/tts_model.cpp otherarch/ttscpp/src/kokoro_model.cpp otherarch/ttscpp/src/dia_model.cpp otherarch/ttscpp/src/orpheus_model.cpp otherarch/ttscpp/src/snac_model.cpp otherarch/ttscpp/src/general_neural_audio_codec.cpp ggml.o ggml-cpu.o ggml-ops.o ggml-vec.o ggml-binops.o ggml-unops.o llama.o console.o llavaclip_default.o llava.o ggml-backend_default.o ggml-backend-reg_default.o ggml-repack.o $(OBJS_FULL) $(OBJS) $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) ggml/src/ggml-vulkan-shaders.cpp: diff --git a/ggml/src/ggml-cpu/binary-ops.cpp b/ggml/src/ggml-cpu/binary-ops.cpp index 2c37504cc..b75931637 100644 --- a/ggml/src/ggml-cpu/binary-ops.cpp +++ b/ggml/src/ggml-cpu/binary-ops.cpp @@ -47,6 +47,7 @@ static inline void vec_binary_op_non_contiguous(const int64_t n, const int64_t n } } +static bool binop_sameshape_warned = false; template static void apply_binary_op(const ggml_compute_params * params, ggml_tensor * dst) { const ggml_tensor * src0 = dst->src[0]; @@ -63,7 +64,14 @@ static void apply_binary_op(const ggml_compute_params * params, ggml_tensor * ds const bool is_src1_contiguous = (nb10 == sizeof(src1_t)); if (!is_src1_contiguous) { // broadcast not implemented yet for non-contiguous - GGML_ASSERT(ggml_are_same_shape(src0, src1)); + if(!ggml_are_same_shape(src0, src1)) + { + if(!binop_sameshape_warned) + { + binop_sameshape_warned = true; + GGML_ASSERT_CONTINUE(ggml_are_same_shape(src0, src1)); + } + } } #ifdef GGML_USE_ACCELERATE diff --git a/otherarch/ttscpp/examples/cli/cli.cpp b/otherarch/ttscpp/cli/cli.cpp similarity index 100% rename from otherarch/ttscpp/examples/cli/cli.cpp rename to otherarch/ttscpp/cli/cli.cpp diff --git a/otherarch/ttscpp/examples/cli/playback.cpp b/otherarch/ttscpp/cli/playback.cpp similarity index 100% rename from otherarch/ttscpp/examples/cli/playback.cpp rename to otherarch/ttscpp/cli/playback.cpp diff --git a/otherarch/ttscpp/examples/cli/playback.h b/otherarch/ttscpp/cli/playback.h similarity index 100% rename from otherarch/ttscpp/examples/cli/playback.h rename to otherarch/ttscpp/cli/playback.h diff --git a/otherarch/ttscpp/examples/cli/vad.cpp b/otherarch/ttscpp/cli/vad.cpp similarity index 100% rename from otherarch/ttscpp/examples/cli/vad.cpp rename to otherarch/ttscpp/cli/vad.cpp diff --git a/otherarch/ttscpp/examples/cli/vad.h b/otherarch/ttscpp/cli/vad.h similarity index 100% rename from otherarch/ttscpp/examples/cli/vad.h rename to otherarch/ttscpp/cli/vad.h diff --git a/otherarch/ttscpp/examples/cli/write_file.cpp b/otherarch/ttscpp/cli/write_file.cpp similarity index 100% rename from otherarch/ttscpp/examples/cli/write_file.cpp rename to otherarch/ttscpp/cli/write_file.cpp diff --git a/otherarch/ttscpp/examples/cli/write_file.h b/otherarch/ttscpp/cli/write_file.h similarity index 100% rename from otherarch/ttscpp/examples/cli/write_file.h rename to otherarch/ttscpp/cli/write_file.h diff --git a/otherarch/ttscpp/examples/phonemize/phonemize.cpp b/otherarch/ttscpp/examples/phonemize/phonemize.cpp deleted file mode 100644 index a9f794bf5..000000000 --- a/otherarch/ttscpp/examples/phonemize/phonemize.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "phonemizer.h" -#include "ttsargs.h" -#include - -int main(int argc, const char ** argv) { - arg_list args; - args.add_argument(string_arg("--phonemizer-path", "(OPTIONAL) The local path of the gguf phonemiser file for TTS.cpp phonemizer. This is required if not using espeak.", "-mp")); - args.add_argument(string_arg("--prompt", "(REQUIRED) The text prompt to phonemize.", "-p", true)); - args.add_argument(bool_arg("--use-espeak", "(OPTIONAL) Whether to use espeak to generate phonems.", "-ue")); - args.add_argument(string_arg("--espeak-voice-id", "(OPTIONAL) The voice id to use for espeak phonemization. Defaults to 'gmw/en-US'.", "-eid", false, "gmw/en-US")); - args.parse(argc, argv); - if (args.for_help) { - args.help(); - return 0; - } - args.validate(); - if (!args.get_bool_param("--use-espeak") && args.get_string_param("--phonemizer-path") == "") { - fprintf(stderr, "The '--phonemizer-path' must be specified when '--use-espeak' is not true.\n"); - exit(1); - } - - phonemizer * ph; - if (args.get_bool_param("--use-espeak")) { - ph = espeak_phonemizer(false, args.get_string_param("--espeak-voice-id")); - } else { - ph = phonemizer_from_file(args.get_string_param("--phonemizer-path")); - } - std::string response = ph->text_to_phonemes(args.get_string_param("--prompt")); - fprintf(stdout, "%s\n", response.c_str()); - return 0; -}