Skip to content

Commit 9566319

Browse files
author
prima
committed
Merge remote-tracking branch 'origin/concedo_experimental' into remoteManagement
2 parents 351a306 + 9fb0611 commit 9566319

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+78839
-252
lines changed

.github/workflows/kcpp-build-release-arm64.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ jobs:
8787
--add-data './taesd_xl.embd:.' \
8888
--add-data './taesd_f.embd:.' \
8989
--add-data './taesd_3.embd:.' \
90+
--add-data './kokoro_ipa.embd:.' \
9091
--add-data './rwkv_vocab.embd:.' \
9192
--add-data './rwkv_world_vocab.embd:.' \
9293
--version-file './version.txt' \

.github/workflows/kcpp-build-release-macos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
make LLAMA_METAL=1 LLAMA_PORTABLE=1
3737
chmod +x './create_ver_file.sh'
3838
. create_ver_file.sh
39-
pyinstaller --noconfirm --onefile --collect-all customtkinter --collect-all psutil --collect-all pdfplumber --collect-all PyMuPdf --collect-all tqdm --add-data './koboldcpp_default.so:.' --add-data './ggml-metal-merged.metal:.' --add-data './kcpp_adapters:./kcpp_adapters' --add-data './koboldcpp.py:.' --add-data './json_to_gbnf.py:.' --add-data './LICENSE.md:.' --add-data './MIT_LICENSE_GGML_SDCPP_LLAMACPP_ONLY.md:.' --add-data './klite.embd:.' --add-data './kcpp_docs.embd:.' --add-data './kcpp_sdui.embd:.' --add-data './taesd.embd:.' --add-data './taesd_xl.embd:.' --add-data './taesd_f.embd:.' --add-data './taesd_3.embd:.' --add-data './rwkv_vocab.embd:.' --add-data './rwkv_world_vocab.embd:.' --version-file './version.txt' --clean --console koboldcpp.py -n "koboldcpp-mac-arm64"
39+
pyinstaller --noconfirm --onefile --collect-all customtkinter --collect-all psutil --collect-all pdfplumber --collect-all PyMuPdf --collect-all tqdm --add-data './koboldcpp_default.so:.' --add-data './ggml-metal-merged.metal:.' --add-data './kcpp_adapters:./kcpp_adapters' --add-data './koboldcpp.py:.' --add-data './json_to_gbnf.py:.' --add-data './LICENSE.md:.' --add-data './MIT_LICENSE_GGML_SDCPP_LLAMACPP_ONLY.md:.' --add-data './klite.embd:.' --add-data './kcpp_docs.embd:.' --add-data './kcpp_sdui.embd:.' --add-data './taesd.embd:.' --add-data './taesd_xl.embd:.' --add-data './taesd_f.embd:.' --add-data './taesd_3.embd:.' --add-data './kokoro_ipa.embd:.' --add-data './rwkv_vocab.embd:.' --add-data './rwkv_world_vocab.embd:.' --version-file './version.txt' --clean --console koboldcpp.py -n "koboldcpp-mac-arm64"
4040
4141
- name: Test
4242
id: test

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ set_target_properties(whisper_adapter PROPERTIES POSITION_INDEPENDENT_CODE ON)
518518

519519
add_library(tts_adapter
520520
otherarch/tts_adapter.cpp)
521-
target_include_directories(tts_adapter PUBLIC . ./ggml/include ./ggml/src ./ggml/src/ggml-cpu ./include ./otherarch ./otherarch/tools ./vendor/stb ./vendor ./tools ./common)
521+
target_include_directories(tts_adapter PUBLIC . ./ggml/include ./ggml/src ./ggml/src/ggml-cpu ./include ./otherarch ./otherarch/tools ./vendor/stb ./vendor ./otherarch/ttscpp/include ./otherarch/ttscpp/src ./tools ./common)
522522
target_compile_features(tts_adapter PUBLIC cxx_std_17) # don't bump
523523
target_link_libraries(tts_adapter PRIVATE common2 ggml ${LLAMA_EXTRA_LIBS})
524524
set_target_properties(tts_adapter PROPERTIES POSITION_INDEPENDENT_CODE ON)

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ ifdef KCPP_SANITIZE
5555
CFLAGS += -fsanitize=undefined -fsanitize-undefined-trap-on-error
5656
CXXFLAGS += -fsanitize=undefined -fsanitize-undefined-trap-on-error
5757
endif
58-
CFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./common -I./vendor -I./vendor/stb -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -DGGML_USE_CPU -DGGML_USE_CPU_REPACK
59-
CXXFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./common -I./vendor -I./vendor/stb -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c++17 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -DGGML_USE_CPU -DGGML_USE_CPU_REPACK
58+
CFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./common -I./vendor -I./vendor/stb -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/ttscpp/include -I./otherarch/ttscpp/src -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c11 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -DGGML_USE_CPU -DGGML_USE_CPU_REPACK
59+
CXXFLAGS += -I. -Iggml/include -Iggml/src -Iggml/src/ggml-cpu -Iinclude -Isrc -I./common -I./vendor -I./vendor/stb -I./include -I./include/CL -I./otherarch -I./otherarch/tools -I./otherarch/sdcpp -I./otherarch/ttscpp/include -I./otherarch/ttscpp/src -I./otherarch/sdcpp/thirdparty -I./include/vulkan -O3 -fno-finite-math-only -std=c++17 -fPIC -DLOG_DISABLE_LOGS -D_GNU_SOURCE -DGGML_USE_CPU -DGGML_USE_CPU_REPACK
6060
ifndef KCPP_DEBUG
6161
CFLAGS += -DNDEBUG -s
6262
CXXFLAGS += -DNDEBUG -s
@@ -684,7 +684,7 @@ whispercpp_cublas.o: otherarch/whispercpp/whisper_adapter.cpp
684684
$(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $(HIPFLAGS) -c $< -o $@
685685

686686
#tts objects
687-
tts_default.o: otherarch/tts_adapter.cpp
687+
tts_default.o: otherarch/tts_adapter.cpp otherarch/ttscpp/src/ttscpp.cpp otherarch/ttscpp/src/ttstokenizer.cpp otherarch/ttscpp/src/ttssampler.cpp otherarch/ttscpp/src/parler_model.cpp otherarch/ttscpp/src/dac_model.cpp otherarch/ttscpp/src/ttsutil.cpp otherarch/ttscpp/src/ttsargs.cpp otherarch/ttscpp/src/ttst5_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
688688
$(CXX) $(CXXFLAGS) -c $< -o $@
689689

690690
embeddings_default.o: otherarch/embeddings_adapter.cpp
@@ -729,6 +729,8 @@ mainvk: tools/main/main.cpp common/arg.cpp build-info.h ggml_v4_vulkan.o ggml-cp
729729
$(CXX) $(CXXFLAGS) -DGGML_USE_VULKAN -DSD_USE_VULKAN $(filter-out %.h,$^) -o $@ $(LDFLAGS)
730730
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)
731731
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
732+
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/ttscpp.cpp otherarch/ttscpp/src/ttstokenizer.cpp otherarch/ttscpp/src/ttssampler.cpp otherarch/ttscpp/src/parler_model.cpp otherarch/ttscpp/src/dac_model.cpp otherarch/ttscpp/src/ttsutil.cpp otherarch/ttscpp/src/ttsargs.cpp otherarch/ttscpp/src/ttst5_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)
733+
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
732734

733735
ggml/src/ggml-vulkan-shaders.cpp:
734736
ifdef VULKAN_BUILD

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ and it will install everything required. Alternatively, you can download the abo
315315
- KoboldCpp code and other files are also under the AGPL v3.0 License unless otherwise stated
316316
- Llama.cpp source repo is at https://github.com/ggml-org/llama.cpp (MIT)
317317
- Stable-diffusion.cpp source repo is at https://github.com/leejet/stable-diffusion.cpp (MIT)
318+
- TTS.cpp source repo is at https://github.com/mmwillet/TTS.cpp (MIT)
318319
- KoboldCpp source repo is at https://github.com/LostRuins/koboldcpp (AGPL)
319320
- KoboldAI Lite source repo is at https://github.com/LostRuins/lite.koboldai.net (AGPL)
320321
- For any further enquiries, contact @concedo on discord, or LostRuins on github.

examples/diffusion/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

expose.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ struct tts_generation_inputs
247247
const char * prompt = nullptr;
248248
const int speaker_seed = 0;
249249
const int audio_seed = 0;
250+
const char * custom_speaker_voice = "";
250251
const char * custom_speaker_text = "";
251252
const char * custom_speaker_data = "";
252253
};

ggml/include/ggml.h

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,18 @@ extern "C" {
553553
GGML_OP_GLU,
554554

555555
GGML_OP_COUNT,
556+
557+
//kcpp: dirtypatch of unofficial ops for ttscpp
558+
GGML_OP_UPSCALE_LINEAR, // linear interpolate
559+
GGML_OP_RECIPROCAL,
560+
GGML_OP_ROUND,
561+
GGML_OP_MOD,
562+
GGML_OP_CUMSUM,
563+
GGML_OP_STFT,
564+
GGML_OP_AA_STFT,
565+
GGML_OP_ISTFT,
566+
GGML_OP_AA_ISTFT,
567+
GGML_OP_CONV_TRANSPOSE_1D_TTS,
556568
};
557569

558570
enum ggml_unary_op {
@@ -2475,6 +2487,76 @@ extern "C" {
24752487
GGML_API void ggml_threadpool_params_init (struct ggml_threadpool_params * p, int n_threads);
24762488
GGML_API bool ggml_threadpool_params_match (const struct ggml_threadpool_params * p0, const struct ggml_threadpool_params * p1);
24772489

2490+
//kcpp: dirtypatch of ttscpp additions
2491+
GGML_API struct ggml_tensor * ggml_round(
2492+
struct ggml_context * ctx,
2493+
struct ggml_tensor * a);
2494+
GGML_API struct ggml_tensor * ggml_round_inplace(
2495+
struct ggml_context * ctx,
2496+
struct ggml_tensor * a);
2497+
// This is a floating point mod by the mod_val parameter
2498+
GGML_API struct ggml_tensor * ggml_mod(
2499+
struct ggml_context * ctx,
2500+
struct ggml_tensor * a,
2501+
float mod_val);
2502+
GGML_API struct ggml_tensor * ggml_mod_inplace(
2503+
struct ggml_context * ctx,
2504+
struct ggml_tensor * a,
2505+
float mod_val);
2506+
// reciprocal of each value in tensor a
2507+
GGML_API struct ggml_tensor * ggml_reciprocal(
2508+
struct ggml_context * ctx,
2509+
struct ggml_tensor * a);
2510+
GGML_API struct ggml_tensor * ggml_reciprocal_inplace(
2511+
struct ggml_context * ctx,
2512+
struct ggml_tensor * a);
2513+
// cumulative sums along first axis (ne0)
2514+
GGML_API struct ggml_tensor * ggml_cumsum(
2515+
struct ggml_context * ctx,
2516+
struct ggml_tensor * a);
2517+
GGML_API struct ggml_tensor * ggml_conv_1d_dw_tts(
2518+
struct ggml_context * ctx,
2519+
struct ggml_tensor * a, // convolution kernel
2520+
struct ggml_tensor * b, // data
2521+
int s0, // stride
2522+
int p0, // padding
2523+
int d0); // dilation
2524+
GGML_API struct ggml_tensor * ggml_conv_transpose_1d_tts(
2525+
struct ggml_context * ctx,
2526+
struct ggml_tensor * a, // convolution kernel
2527+
struct ggml_tensor * b, // data
2528+
int s0, // stride
2529+
int p0, // padding
2530+
int d0, // dilation
2531+
int op0, // output padding
2532+
int g0); // groups
2533+
GGML_API struct ggml_tensor * ggml_conv_1d_tts(
2534+
struct ggml_context * ctx,
2535+
struct ggml_tensor * a, // convolution kernel
2536+
struct ggml_tensor * b, // data
2537+
int s0, // stride
2538+
int p0, // padding
2539+
int d0); // dilation
2540+
GGML_API struct ggml_tensor * ggml_stft(
2541+
struct ggml_context * ctx,
2542+
struct ggml_tensor * a,
2543+
struct ggml_tensor * w, // the window
2544+
int filter_length,
2545+
int hop_length,
2546+
bool compute_abs_and_angle);
2547+
GGML_API struct ggml_tensor * ggml_istft(
2548+
struct ggml_context * ctx,
2549+
struct ggml_tensor * a, // magnitude + phase
2550+
struct ggml_tensor * w,
2551+
int filter_length,
2552+
int hop_length,
2553+
bool from_abs_and_angle);
2554+
GGML_API struct ggml_tensor * ggml_upscale_linear(
2555+
struct ggml_context * ctx,
2556+
struct ggml_tensor * a,
2557+
int scale_factor);
2558+
//end kcpp dirtypatch
2559+
24782560
#ifdef __cplusplus
24792561
}
24802562
#endif

ggml/src/ggml-cpu/binary-ops.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static inline void vec_binary_op_non_contiguous(const int64_t n, const int64_t n
4747
}
4848
}
4949

50+
static bool binop_sameshape_warned = false;
5051
template <float (*op)(float, float), typename src0_t, typename src1_t, typename dst_t>
5152
static void apply_binary_op(const ggml_compute_params * params, ggml_tensor * dst) {
5253
const ggml_tensor * src0 = dst->src[0];
@@ -63,7 +64,14 @@ static void apply_binary_op(const ggml_compute_params * params, ggml_tensor * ds
6364
const bool is_src1_contiguous = (nb10 == sizeof(src1_t));
6465

6566
if (!is_src1_contiguous) { // broadcast not implemented yet for non-contiguous
66-
GGML_ASSERT(ggml_are_same_shape(src0, src1));
67+
if(!ggml_are_same_shape(src0, src1))
68+
{
69+
if(!binop_sameshape_warned)
70+
{
71+
binop_sameshape_warned = true;
72+
GGML_ASSERT_CONTINUE(ggml_are_same_shape(src0, src1));
73+
}
74+
}
6775
}
6876

6977
#ifdef GGML_USE_ACCELERATE

0 commit comments

Comments
 (0)