diff --git a/CMakeLists.txt b/CMakeLists.txt index 730d73a6f..f9d6885b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -531,10 +531,12 @@ add_library(sdtype_adapter otherarch/sdcpp/examples/cli/image_metadata.cpp otherarch/sdcpp/src/detailer.cpp otherarch/sdcpp/src/model_manager.cpp + otherarch/sdcpp/src/model_manager_files.cpp otherarch/sdcpp/src/model_manager.h otherarch/sdcpp/src/model_manager_prefetch.cpp otherarch/sdcpp/src/extensions/pulid_extension.cpp otherarch/sdcpp/src/model_loader.cpp + otherarch/sdcpp/src/model_loader_files.cpp otherarch/sdcpp/src/model/adapter/lora_ops.cpp otherarch/sdcpp/src/extensions/photomaker_extension.cpp otherarch/sdcpp/src/runtime/sample-cache.cpp @@ -546,6 +548,11 @@ add_library(sdtype_adapter otherarch/sdcpp/src/runtime/guidance.h otherarch/sdcpp/src/runtime/imatrix.cpp otherarch/sdcpp/src/runtime/imatrix.h + otherarch/sdcpp/src/pipeline/diffusion_engine.cpp + otherarch/sdcpp/src/pipeline/image.cpp + otherarch/sdcpp/src/pipeline/model_builders.cpp + otherarch/sdcpp/src/pipeline/request.cpp + otherarch/sdcpp/src/pipeline/video.cpp otherarch/sdcpp/src/stable-diffusion.cpp otherarch/sdcpp/thirdparty/zip.c otherarch/sdcpp/src/model_io/gguf_io.cpp @@ -565,11 +572,6 @@ add_library(sdtype_adapter otherarch/sdcpp/src/core/backend_fit.cpp otherarch/sdcpp/src/core/layer_split_partition.cpp otherarch/sdcpp/src/core/ggml_extend_backend.cpp) -set_source_files_properties( - otherarch/sdcpp/src/stable-diffusion.cpp - otherarch/sdcpp/src/upscaler.cpp - PROPERTIES COMPILE_DEFINITIONS - "sd_ggml_log_callback=kcpp_sd_ggml_log_callback") target_include_directories(sdtype_adapter PUBLIC . ./ggml/include ./ggml/src ./ggml/src/ggml-cpu ./include ./otherarch ./otherarch/tools ./vendor/stb ./vendor/nlohmann ./vendor ./otherarch/sdcpp ./otherarch/sdcpp/include ./otherarch/sdcpp/src ./otherarch/sdcpp/examples ./tools ./common) target_compile_features(sdtype_adapter PUBLIC cxx_std_17) # don't bump target_link_libraries(sdtype_adapter PRIVATE common2 ggml ${LLAMA_EXTRA_LIBS}) diff --git a/Makefile b/Makefile index f95f98e1f..70b5d5f51 100644 --- a/Makefile +++ b/Makefile @@ -714,15 +714,13 @@ SOURCES_SDMAIN := $(foreach f,$(SDCPP_MAIN_BASENAMES),otherarch/sdcpp/$(f)) HEADERS_SDMAIN := $(filter %.h,$(SOURCES_SDMAIN)) $(filter %.hpp, $(SOURCES_SDMAIN)) OBJS_SDMAIN := $(patsubst %.cpp,%.o,$(filter %.cpp,$(SOURCES_SDMAIN))) -otherarch/sdcpp/%.o: $(HEADERS_SDCOMMON) +$(patsubst %.cpp,%.o,$(filter %.cpp,$(SOURCES_SDCOMMON))): $(HEADERS_SDCOMMON) $(OBJS_SDMAIN): $(HEADERS_SDMAIN) otherarch/sdcpp/src/%.o: otherarch/sdcpp/src/%.cpp $(CXX) -I./otherarch/sdcpp/include -I./otherarch/sdcpp/src -I./otherarch/sdcpp/src/core -I./vendor/nlohmann $(CXXFLAGS) -c $< -o $@ -otherarch/sdcpp/src/stable-diffusion.o otherarch/sdcpp/src/upscaler.o: CXXFLAGS += -Dsd_ggml_log_callback=kcpp_sd_ggml_log_callback - sdcpp_logger_adapter.o: sdcpp_logger_adapter.cpp sdcpp_logger_adapter.h otherarch/sdcpp/src/core/util.h $(CXX) -I./otherarch/sdcpp/include -I./otherarch/sdcpp/src $(CXXFLAGS) -c $< -o $@ diff --git a/otherarch/sdcpp/src/pipeline/diffusion_engine.cpp b/otherarch/sdcpp/src/pipeline/diffusion_engine.cpp index b350f025b..52be854b2 100644 --- a/otherarch/sdcpp/src/pipeline/diffusion_engine.cpp +++ b/otherarch/sdcpp/src/pipeline/diffusion_engine.cpp @@ -26,6 +26,7 @@ #include "model_builders.h" #include "model_loader.h" #include "model_manager.h" +#include "sdcpp_logger_adapter.h" #include "stable-diffusion.h" #include "conditioning/conditioner.hpp" @@ -1098,7 +1099,7 @@ bool StableDiffusionGGML::init(const sd_ctx_params_t* sd_ctx_params) { sampler_rng = rng; } - ggml_log_set(sd_ggml_log_callback, nullptr); + ggml_log_set(kcpp_sd_ggml_log_callback, nullptr); model_manager = std::make_shared(); model_manager->set_n_threads(n_threads); diff --git a/otherarch/sdcpp/src/upscaler.cpp b/otherarch/sdcpp/src/upscaler.cpp index 6b7b0efb0..4b112774d 100644 --- a/otherarch/sdcpp/src/upscaler.cpp +++ b/otherarch/sdcpp/src/upscaler.cpp @@ -3,6 +3,7 @@ #include "core/util.h" #include "model_loader.h" #include "runtime/tiling.h" +#include "sdcpp_logger_adapter.h" #include "stable-diffusion.h" #include @@ -35,7 +36,7 @@ void UpscalerGGML::set_max_graph_vram_bytes(size_t max_vram_bytes) { bool UpscalerGGML::load_from_file(const std::string& esrgan_path, int n_threads) { - ggml_log_set(sd_ggml_log_callback, nullptr); + ggml_log_set(kcpp_sd_ggml_log_callback, nullptr); std::string error; if (!backend_manager.init(backend_spec.c_str(),