prevent sd logging when in quiet mode (+1 squashed commits)

Squashed commits:

[a4a1cdd5] fixed type conversion
This commit is contained in:
Concedo 2024-03-09 16:20:20 +08:00
parent 4682918965
commit ca19199bc8
4 changed files with 13 additions and 3 deletions

View file

@ -540,8 +540,8 @@ def sd_generate(genparams):
biggest = max(width,height) biggest = max(width,height)
if biggest > reslimit: if biggest > reslimit:
scaler = biggest / reslimit scaler = biggest / reslimit
width = width / scaler width = int(width / scaler)
height = height / scaler height = int(height / scaler)
width = width - (width%64) width = width - (width%64)
height = height - (height%64) height = height - (height%64)

View file

@ -142,7 +142,7 @@ std::string base64_encode(const unsigned char* data, unsigned int data_length) {
static std::string sdplatformenv, sddeviceenv, sdvulkandeviceenv; static std::string sdplatformenv, sddeviceenv, sdvulkandeviceenv;
bool sdtype_load_model(const sd_load_model_inputs inputs) { bool sdtype_load_model(const sd_load_model_inputs inputs) {
printf("\nImage Generation Init - Load Safetensors Model: %s\n",inputs.model_filename); printf("\nImageGen Init - Load Model: %s\n",inputs.model_filename);
//duplicated from expose.cpp //duplicated from expose.cpp
int cl_parseinfo = inputs.clblast_info; //first digit is whether configured, second is platform, third is devices int cl_parseinfo = inputs.clblast_info; //first digit is whether configured, second is platform, third is devices
@ -273,6 +273,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
{ {
printf("\nGenerating Image (%d steps)\n",inputs.sample_steps); printf("\nGenerating Image (%d steps)\n",inputs.sample_steps);
} }
fflush(stdout); fflush(stdout);
std::string sampler = inputs.sample_method; std::string sampler = inputs.sample_method;

View file

@ -211,6 +211,10 @@ void pretty_progress(int step, int steps, float time) {
if (step == 0) { if (step == 0) {
return; return;
} }
if(!do_log)
{
return;
}
std::string progress = " |"; std::string progress = " |";
int max_progress = 50; int max_progress = 50;
int32_t current = (int32_t)(step * 1.f * max_progress / steps); int32_t current = (int32_t)(step * 1.f * max_progress / steps);
@ -271,6 +275,10 @@ void set_log_message(bool log)
{ {
do_log = log; do_log = log;
} }
bool get_log_message()
{
return do_log;
}
void log_printf(sd_log_level_t level, const char* file, int line, const char* format, ...) { void log_printf(sd_log_level_t level, const char* file, int line, const char* format, ...) {
va_list args; va_list args;

View file

@ -46,6 +46,7 @@ std::string trim(const std::string& s);
void log_message(const char* format, ...); void log_message(const char* format, ...);
void set_log_message(bool log); void set_log_message(bool log);
bool get_log_message();
#define LOG_DEBUG(...) log_message(__VA_ARGS__) #define LOG_DEBUG(...) log_message(__VA_ARGS__)
#define LOG_INFO(...) log_message(__VA_ARGS__) #define LOG_INFO(...) log_message(__VA_ARGS__)
#define LOG_WARN(...) log_message(__VA_ARGS__) #define LOG_WARN(...) log_message(__VA_ARGS__)