Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions otherarch/sdcpp/sdtype_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ static bool is_video_model(kcpp_sd::model_info info)

bool sdtype_load_model(const sd_load_model_inputs inputs) {

kcpp_sd_preserve_ggml_logger();
sddebugmode = inputs.debugmode;
set_sd_log_level(sddebugmode);
ggml_log_set(kcpp_sd_ggml_log_callback);

sd_is_quiet = inputs.quiet;
set_sd_quiet(sd_is_quiet);
Expand Down Expand Up @@ -537,10 +539,6 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) {
}
}

sddebugmode = inputs.debugmode;

set_sd_log_level(sddebugmode);

sd_ctx_params_t params = {};
sd_ctx_params_init(&params);

Expand Down Expand Up @@ -1943,6 +1941,9 @@ void sdtype_request_ongoing_generation_preview()

sd_generation_outputs sdtype_upscale(const sd_upscale_inputs inputs)
{
set_sd_log_level(sddebugmode);
ggml_log_set(kcpp_sd_ggml_log_callback);

sd_generation.reset();

if(sd_ctx == nullptr || upscaler_ctx == nullptr || sd_params == nullptr)
Expand Down
8 changes: 8 additions & 0 deletions otherarch/sdcpp/src/core/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,14 @@ bool parse_strict_bool(const std::string& text, bool& value) {
// { kcpp
static int sdloglevel = INT_MAX; // -1 = hide all, 0 = normal, 1 = showall, INT_MAX = sdcpp
static bool sdquiet = false;

void kcpp_sd_ggml_log_set(void) {
/* block ggml log changes on Koboldcpp */
if (sdloglevel == INT_MAX) {
ggml_log_set(sd_ggml_log_callback, nullptr);
}
}

// } kcpp

static std::string build_progress_bar(int step, int steps, char progress_char = '=', bool show_head = true) {
Expand Down
3 changes: 3 additions & 0 deletions otherarch/sdcpp/src/core/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,7 @@ bool sd_backend_is(ggml_backend_t backend, const std::string& name);
#define LOG_INFO(format, ...) log_printf(SD_LOG_INFO, __FILE__, __LINE__, format, ##__VA_ARGS__)
#define LOG_WARN(format, ...) log_printf(SD_LOG_WARN, __FILE__, __LINE__, format, ##__VA_ARGS__)
#define LOG_ERROR(format, ...) log_printf(SD_LOG_ERROR, __FILE__, __LINE__, format, ##__VA_ARGS__)

void kcpp_sd_ggml_log_set(void);

#endif // __SD_CORE_UTIL_H__
3 changes: 1 addition & 2 deletions otherarch/sdcpp/src/pipeline/diffusion_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#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"
Expand Down Expand Up @@ -1099,7 +1098,7 @@ bool StableDiffusionGGML::init(const sd_ctx_params_t* sd_ctx_params) {
sampler_rng = rng;
}

ggml_log_set(kcpp_sd_ggml_log_callback, nullptr);
kcpp_sd_ggml_log_set();

model_manager = std::make_shared<ModelManager>();
model_manager->set_n_threads(n_threads);
Expand Down
3 changes: 1 addition & 2 deletions otherarch/sdcpp/src/upscaler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "core/util.h"
#include "model_loader.h"
#include "runtime/tiling.h"
#include "sdcpp_logger_adapter.h"
#include "stable-diffusion.h"

#include <cstdlib>
Expand Down Expand Up @@ -36,7 +35,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(kcpp_sd_ggml_log_callback, nullptr);
kcpp_sd_ggml_log_set();

std::string error;
if (!backend_manager.init(backend_spec.c_str(),
Expand Down