diff --git a/docs/model_config.md b/docs/model_config.md index 8c562fff4..dda93a837 100644 --- a/docs/model_config.md +++ b/docs/model_config.md @@ -67,21 +67,21 @@ Detection should respect `prefix`. For nested weights, construct full names from Do not add persistent config fields such as `inferred_from_weights` only to record whether detection happened. If the function needs to decide whether to -print a debug line, keep that as local control flow inside `detect_from_weights`. +print a verbose line, keep that as local control flow inside `detect_from_weights`. ## Logging -When config values are inferred from weights, print one `LOG_DEBUG` line at the +When config values are inferred from weights, print one `LOG_VERBOSE` line at the end of `detect_from_weights`. Example: ```cpp -LOG_DEBUG("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64, - config.num_layers, - config.vocab_size, - config.hidden_size, - config.intermediate_size); +LOG_VERBOSE("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64, + config.num_layers, + config.vocab_size, + config.hidden_size, + config.intermediate_size); ``` Only print the config detection log when the function actually inferred values diff --git a/examples/cli/README.md b/examples/cli/README.md index a7de00420..9df3bb0b0 100644 --- a/examples/cli/README.md +++ b/examples/cli/README.md @@ -6,6 +6,11 @@ For detailed command-line arguments, run: ./bin/sd-cli -h ``` +Logging defaults to `info`. Use `--log-level ` to select `debug`, `verbose`, +`info`, `warn`, or `error` (from most to least detailed). Each level includes +messages at that level and all less detailed levels. `-v` and `--verbose` are +equivalent to `--log-level verbose`. If repeated, the last logging option wins. + For direct image repair or automatic post-generation YOLOv8 detection followed by cropped inpainting, see [ADetailer](../../docs/adetailer.md). diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp index d77356b12..22b26da79 100644 --- a/examples/cli/main.cpp +++ b/examples/cli/main.cpp @@ -40,9 +40,9 @@ struct SDCliParams { std::string image_path; std::string metadata_format = "text"; - bool verbose = false; - bool canny_preprocess = false; - bool convert_name = false; + sd_log_level_t log_level = SD_LOG_INFO; + bool canny_preprocess = false; + bool convert_name = false; preview_t preview_method = PREVIEW_NONE; int preview_interval = 1; @@ -115,10 +115,6 @@ struct SDCliParams { "--convert-name", "convert tensor name (for convert mode)", true, &convert_name}, - {"-v", - "--verbose", - "print extra info", - true, &verbose}, {"", "--color", "colors the logging tags according to level", @@ -220,6 +216,7 @@ struct SDCliParams { on_imatrix_in_arg}, }; + add_log_options(options, log_level); return options; }; @@ -269,7 +266,7 @@ struct SDCliParams { << " output_path: \"" << output_path << "\",\n" << " image_path: \"" << image_path << "\",\n" << " metadata_format: \"" << metadata_format << "\",\n" - << " verbose: " << (verbose ? "true" : "false") << ",\n" + << " log_level: " << log_level_name(log_level) << ",\n" << " color: " << (color ? "true" : "false") << ",\n" << " canny_preprocess: " << (canny_preprocess ? "true" : "false") << ",\n" << " convert_name: " << (convert_name ? "true" : "false") << ",\n" @@ -307,6 +304,9 @@ void parse_args(int argc, const char** argv, SDCliParams& cli_params, SDContextP exit(cli_params.normal_exit ? 0 : 1); } + log_level = cli_params.log_level; + log_color = cli_params.color; + bool valid = cli_params.resolve_and_validate(); if (valid && cli_params.mode != METADATA) { valid = ctx_params.resolve_and_validate(cli_params.mode) && @@ -323,15 +323,14 @@ void parse_args(int argc, const char** argv, SDCliParams& cli_params, SDContextP void sd_log_cb(enum sd_log_level_t level, const char* log, void* data) { SDCliParams* cli_params = (SDCliParams*)data; - log_print(level, log, cli_params->verbose, cli_params->color); + log_print(level, log, cli_params->log_level, cli_params->color); } bool load_images_from_dir(const std::string dir, std::vector& images, int expected_width = 0, int expected_height = 0, - int max_image_num = 0, - bool verbose = false) { + int max_image_num = 0) { if (!fs::exists(dir) || !fs::is_directory(dir)) { LOG_ERROR("'%s' is not a valid directory\n", dir.c_str()); return false; @@ -355,7 +354,7 @@ bool load_images_from_dir(const std::string dir, std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".webp") { - LOG_DEBUG("load image %zu from '%s'", images.size(), path.c_str()); + LOG_VERBOSE("load image %zu from '%s'", images.size(), path.c_str()); int width = 0; int height = 0; uint8_t* image_buffer = load_image_from_file(path.c_str(), width, height, expected_width, expected_height); @@ -651,8 +650,6 @@ int main(int argc, const char* argv[]) { parse_args(argc, argv, cli_params, ctx_params, gen_params); sd_set_log_callback(sd_log_cb, (void*)&cli_params); - log_verbose = cli_params.verbose; - log_color = cli_params.color; if (cli_params.mode == METADATA) { MetadataReadOptions options; @@ -700,11 +697,11 @@ int main(int argc, const char* argv[]) { cli_params.preview_noisy, (void*)&cli_params); - LOG_DEBUG("version: %s", version_string().c_str()); - LOG_DEBUG("%s", sd_get_system_info()); - LOG_DEBUG("%s", cli_params.to_string().c_str()); - LOG_DEBUG("%s", ctx_params.to_string().c_str()); - LOG_DEBUG("%s", gen_params.to_string().c_str()); + LOG_VERBOSE("version: %s", version_string().c_str()); + LOG_VERBOSE("%s", sd_get_system_info()); + LOG_VERBOSE("%s", cli_params.to_string().c_str()); + LOG_VERBOSE("%s", ctx_params.to_string().c_str()); + LOG_VERBOSE("%s", gen_params.to_string().c_str()); if (!cli_params.imatrix_out.empty()) { if (fs::exists(cli_params.imatrix_out) && @@ -808,7 +805,7 @@ int main(int argc, const char* argv[]) { gen_params.ref_videos.reserve(gen_params.ref_video_paths.size()); for (const auto& path : gen_params.ref_video_paths) { std::vector frames; - if (!load_images_from_dir(path, frames, 0, 0, 0, cli_params.verbose) || frames.empty()) { + if (!load_images_from_dir(path, frames) || frames.empty()) { LOG_ERROR("load reference video frames from '%s' failed", path.c_str()); return 1; } @@ -890,8 +887,7 @@ int main(int argc, const char* argv[]) { gen_params.control_frames, gen_params.get_resolved_width(), gen_params.get_resolved_height(), - gen_params.video_frames, - cli_params.verbose)) { + gen_params.video_frames)) { return 1; } } @@ -902,8 +898,7 @@ int main(int argc, const char* argv[]) { gen_params.pm_id_images, 0, 0, - 0, - cli_params.verbose)) { + 0)) { return 1; } } diff --git a/examples/common/common.cpp b/examples/common/common.cpp index aa18f499f..fbaaea85a 100644 --- a/examples/common/common.cpp +++ b/examples/common/common.cpp @@ -239,6 +239,26 @@ void ArgOptions::print() const { } } +void add_log_options(ArgOptions& options, sd_log_level_t& level) { + options.manual_options.push_back({"", "--log-level", + "minimum log level, one of [debug, verbose, info, warn, error] (default: info)", + [&level](int argc, const char** argv, int index) { + if (++index >= argc) { + return -1; + } + if (!parse_log_level(argv[index], level)) { + LOG_ERROR("invalid log level %s, must be one of [debug, verbose, info, warn, error]", argv[index]); + return -1; + } + return 1; + }}); + options.manual_options.push_back({"-v", "--verbose", "equivalent to --log-level verbose", + [&level](int, const char**, int) { + level = SD_LOG_VERBOSE; + return 0; + }}); +} + bool parse_options(int argc, const char** argv, const std::vector& options_list) { bool invalid_arg = false; std::string arg; diff --git a/examples/common/common.h b/examples/common/common.h index 83185d37f..54ddad7a1 100644 --- a/examples/common/common.h +++ b/examples/common/common.h @@ -107,6 +107,7 @@ struct ArgOptions { void print() const; }; +void add_log_options(ArgOptions& options, sd_log_level_t& level); bool parse_options(int argc, const char** argv, const std::vector& options_list); bool decode_base64_image(const std::string& encoded_input, int target_channels, diff --git a/examples/common/log.cpp b/examples/common/log.cpp index 61988ad80..c272c2376 100644 --- a/examples/common/log.cpp +++ b/examples/common/log.cpp @@ -2,8 +2,8 @@ #include -bool log_verbose = false; -bool log_color = false; +sd_log_level_t log_level = SD_LOG_INFO; +bool log_color = false; std::string sd_basename(const std::string& path) { size_t pos = path.find_last_of('/'); @@ -51,12 +51,40 @@ void print_utf8(FILE* stream, const char* utf8) { #endif } -void log_print(enum sd_log_level_t level, const char* log, bool verbose, bool color) { +const char* log_level_name(sd_log_level_t level) { + switch (level) { + case SD_LOG_DEBUG: + return "debug"; + case SD_LOG_VERBOSE: + return "verbose"; + case SD_LOG_INFO: + return "info"; + case SD_LOG_WARN: + return "warn"; + case SD_LOG_ERROR: + return "error"; + default: + return "unknown"; + } +} + +bool parse_log_level(const std::string& name, sd_log_level_t& level) { + const sd_log_level_t levels[] = {SD_LOG_DEBUG, SD_LOG_VERBOSE, SD_LOG_INFO, SD_LOG_WARN, SD_LOG_ERROR}; + for (sd_log_level_t candidate : levels) { + if (name == log_level_name(candidate)) { + level = candidate; + return true; + } + } + return false; +} + +void log_print(enum sd_log_level_t level, const char* log, sd_log_level_t min_level, bool color) { int tag_color; const char* level_str; FILE* out_stream = (level == SD_LOG_ERROR) ? stderr : stdout; - if (!log || (!verbose && level <= SD_LOG_DEBUG)) { + if (!log || level < min_level) { return; } @@ -65,6 +93,10 @@ void log_print(enum sd_log_level_t level, const char* log, bool verbose, bool co tag_color = 37; level_str = "DEBUG"; break; + case SD_LOG_VERBOSE: + tag_color = 37; + level_str = "VERBOSE"; + break; case SD_LOG_INFO: tag_color = 34; level_str = "INFO"; @@ -84,9 +116,9 @@ void log_print(enum sd_log_level_t level, const char* log, bool verbose, bool co } if (color) { - fprintf(out_stream, "\033[%d;1m[%-5s]\033[0m ", tag_color, level_str); + fprintf(out_stream, "\033[%d;1m[%-7s]\033[0m ", tag_color, level_str); } else { - fprintf(out_stream, "[%-5s] ", level_str); + fprintf(out_stream, "[%-7s] ", level_str); } fflush(out_stream); print_utf8(out_stream, log); @@ -110,7 +142,7 @@ void example_log_printf(sd_log_level_t level, const char* file, int line, const strncat(log_buffer, "\n", LOG_BUFFER_SIZE - len); } - log_print(level, log_buffer, log_verbose, log_color); + log_print(level, log_buffer, log_level, log_color); va_end(args); } diff --git a/examples/common/log.h b/examples/common/log.h index f28b4b4ea..f623b0ead 100644 --- a/examples/common/log.h +++ b/examples/common/log.h @@ -16,15 +16,18 @@ #include "stable-diffusion.h" -extern bool log_verbose; +extern sd_log_level_t log_level; extern bool log_color; std::string sd_basename(const std::string& path); void print_utf8(FILE* stream, const char* utf8); -void log_print(sd_log_level_t level, const char* log, bool verbose, bool color); +const char* log_level_name(sd_log_level_t level); +bool parse_log_level(const std::string& name, sd_log_level_t& level); +void log_print(sd_log_level_t level, const char* log, sd_log_level_t min_level, bool color); void example_log_printf(sd_log_level_t level, const char* file, int line, const char* format, ...); #define LOG_DEBUG(format, ...) example_log_printf(SD_LOG_DEBUG, __FILE__, __LINE__, format, ##__VA_ARGS__) +#define LOG_VERBOSE(format, ...) example_log_printf(SD_LOG_VERBOSE, __FILE__, __LINE__, format, ##__VA_ARGS__) #define LOG_INFO(format, ...) example_log_printf(SD_LOG_INFO, __FILE__, __LINE__, format, ##__VA_ARGS__) #define LOG_WARN(format, ...) example_log_printf(SD_LOG_WARN, __FILE__, __LINE__, format, ##__VA_ARGS__) #define LOG_ERROR(format, ...) example_log_printf(SD_LOG_ERROR, __FILE__, __LINE__, format, ##__VA_ARGS__) diff --git a/examples/common/media_io.cpp b/examples/common/media_io.cpp index 9ebd0b5a1..721aa6641 100644 --- a/examples/common/media_io.cpp +++ b/examples/common/media_io.cpp @@ -836,7 +836,7 @@ std::vector create_mjpg_avi_from_sd_images_to_vector(sd_image_t* images const uint32_t audio_data_size = has_audio ? static_cast(audio_pcm.size()) : 0; if (mjpg_quality != quality) - LOG_DEBUG("create_mjpg_avi...(): compression quality was limited from %i to %i", quality, mjpg_quality); + LOG_VERBOSE("create_mjpg_avi...(): compression quality was limited from %i to %i", quality, mjpg_quality); std::vector avi_data; avi_data.reserve(static_cast(num_images) * 1024); diff --git a/examples/server/README.md b/examples/server/README.md index c24ed0833..7622eb407 100644 --- a/examples/server/README.md +++ b/examples/server/README.md @@ -13,9 +13,14 @@ What this example does: * `--llm` selects the text encoder / language model used by this pipeline * `--diffusion-fa` enables flash attention in the diffusion model * `--offload-to-cpu` reduces VRAM pressure by keeping weights in RAM when possible -* `-v` enables verbose logging +* `-v` enables verbose logging (equivalent to `--log-level verbose`) * `--cfg-scale 1.0` sets the default CFG scale for generation +Logging defaults to `info`. Use `--log-level ` to select `debug`, `verbose`, +`info`, `warn`, or `error` (from most to least detailed). Each level includes +messages at that level and all less detailed levels. `-v` and `--verbose` are +equivalent to `--log-level verbose`. If repeated, the last logging option wins. + After the server starts successfully: * the web UI is available at `http://127.0.0.1:1234/` diff --git a/examples/server/main.cpp b/examples/server/main.cpp index dce35c118..1f93e0dc7 100644 --- a/examples/server/main.cpp +++ b/examples/server/main.cpp @@ -44,6 +44,9 @@ static void parse_args(int argc, exit(svr_params.normal_exit ? 0 : 1); } + log_level = svr_params.log_level; + log_color = svr_params.color; + const bool random_seed_requested = default_gen_params.seed < 0; if (!svr_params.resolve_and_validate() || @@ -62,7 +65,7 @@ static void parse_args(int argc, void sd_log_cb(enum sd_log_level_t level, const char* log, void* data) { SDSvrParams* svr_params = (SDSvrParams*)data; - log_print(level, log, svr_params->verbose, svr_params->color); + log_print(level, log, svr_params->log_level, svr_params->color); } int main(int argc, const char** argv) { @@ -76,14 +79,12 @@ int main(int argc, const char** argv) { parse_args(argc, argv, svr_params, ctx_params, default_gen_params); sd_set_log_callback(sd_log_cb, (void*)&svr_params); - log_verbose = svr_params.verbose; - log_color = svr_params.color; - - LOG_DEBUG("version: %s", version_string().c_str()); - LOG_DEBUG("%s", sd_get_system_info()); - LOG_DEBUG("%s", svr_params.to_string().c_str()); - LOG_DEBUG("%s", ctx_params.to_string().c_str()); - LOG_DEBUG("%s", default_gen_params.to_string().c_str()); + + LOG_VERBOSE("version: %s", version_string().c_str()); + LOG_VERBOSE("%s", sd_get_system_info()); + LOG_VERBOSE("%s", svr_params.to_string().c_str()); + LOG_VERBOSE("%s", ctx_params.to_string().c_str()); + LOG_VERBOSE("%s", default_gen_params.to_string().c_str()); sd_ctx_params_t sd_ctx_params = ctx_params.to_sd_ctx_params_t(false); SDCtxPtr sd_ctx(new_sd_ctx(&sd_ctx_params)); diff --git a/examples/server/routes_openai.cpp b/examples/server/routes_openai.cpp index 5f52fabd1..0f122922c 100644 --- a/examples/server/routes_openai.cpp +++ b/examples/server/routes_openai.cpp @@ -270,7 +270,7 @@ void register_openai_api_endpoints(httplib::Server& svr, ServerRuntime& rt) { return; } - LOG_DEBUG("%s\n", request.gen_params.to_string().c_str()); + LOG_VERBOSE("%s\n", request.gen_params.to_string().c_str()); SDImageVec results; if (!execute_sync_img_gen_request(*runtime, request, results, error_message)) { @@ -344,7 +344,7 @@ void register_openai_api_endpoints(httplib::Server& svr, ServerRuntime& rt) { return; } - LOG_DEBUG("%s\n", request.gen_params.to_string().c_str()); + LOG_VERBOSE("%s\n", request.gen_params.to_string().c_str()); SDImageVec results; if (!execute_sync_img_gen_request(*runtime, request, results, error_message)) { diff --git a/examples/server/routes_sdapi.cpp b/examples/server/routes_sdapi.cpp index 53ab20db6..699ba022d 100644 --- a/examples/server/routes_sdapi.cpp +++ b/examples/server/routes_sdapi.cpp @@ -330,7 +330,7 @@ void register_sdapi_endpoints(httplib::Server& svr, ServerRuntime& rt) { return; } - LOG_DEBUG("%s\n", request.gen_params.to_string().c_str()); + LOG_VERBOSE("%s\n", request.gen_params.to_string().c_str()); sd_img_gen_params_t img_gen_params = request.to_sd_img_gen_params_t(); SDImageVec results; diff --git a/examples/server/runtime.cpp b/examples/server/runtime.cpp index 1fb41c716..cd0e2e722 100644 --- a/examples/server/runtime.cpp +++ b/examples/server/runtime.cpp @@ -199,7 +199,6 @@ ArgOptions SDSvrParams::get_options() { }; options.bool_options = { - {"-v", "--verbose", "print extra info", true, &verbose}, {"", "--color", "colors the logging tags according to level", true, &color}, }; @@ -212,6 +211,7 @@ ArgOptions SDSvrParams::get_options() { options.manual_options = { {"-h", "--help", "show this help message and exit", on_help_arg}, }; + add_log_options(options, log_level); return options; } @@ -243,6 +243,7 @@ bool SDSvrParams::resolve_and_validate() { std::string SDSvrParams::to_string() const { std::ostringstream oss; oss << "SDSvrParams {\n" + << " log_level: " << log_level_name(log_level) << ",\n" << " listen_ip: " << listen_ip << ",\n" << " listen_port: \"" << listen_port << "\",\n" << " serve_html_path: \"" << serve_html_path << "\",\n" diff --git a/examples/server/runtime.h b/examples/server/runtime.h index 5c5f2d480..677bb0ba0 100644 --- a/examples/server/runtime.h +++ b/examples/server/runtime.h @@ -22,7 +22,7 @@ struct SDSvrParams { int listen_port = 1234; std::string serve_html_path; bool normal_exit = false; - bool verbose = false; + sd_log_level_t log_level = SD_LOG_INFO; bool color = false; ArgOptions get_options(); diff --git a/include/stable-diffusion.h b/include/stable-diffusion.h index ff4e30637..08bc27aee 100644 --- a/include/stable-diffusion.h +++ b/include/stable-diffusion.h @@ -147,6 +147,7 @@ enum sd_type_t { enum sd_log_level_t { SD_LOG_DEBUG, + SD_LOG_VERBOSE, SD_LOG_INFO, SD_LOG_WARN, SD_LOG_ERROR diff --git a/src/conditioning/conditioner.hpp b/src/conditioning/conditioner.hpp index db28baab2..de3c1fa5c 100644 --- a/src/conditioning/conditioner.hpp +++ b/src/conditioning/conditioner.hpp @@ -251,7 +251,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner { } auto iter = embedding_pos_map.find(embd_name); if (iter != embedding_pos_map.end()) { - LOG_DEBUG("embedding already read in: %s", embd_name.c_str()); + LOG_VERBOSE("embedding already read in: %s", embd_name.c_str()); for (int i = iter->second.first; i < iter->second.second; i++) { bpe_tokens.push_back(text_model->model.vocab_size + i); } @@ -271,11 +271,11 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner { embd2 = ggml_new_tensor_2d(embd_ctx, tensor_storage.type, text_model2->model.hidden_size, tensor_storage.n_dims > 1 ? tensor_storage.ne[1] : 1); *dst_tensor = embd2; } else { - LOG_DEBUG("embedding wrong hidden size, got %i, expected %i or %i", tensor_storage.ne[0], text_model->model.hidden_size, text_model2->model.hidden_size); + LOG_VERBOSE("embedding wrong hidden size, got %i, expected %i or %i", tensor_storage.ne[0], text_model->model.hidden_size, text_model2->model.hidden_size); return false; } } else { - LOG_DEBUG("embedding wrong hidden size, got %i, expected %i", tensor_storage.ne[0], text_model->model.hidden_size); + LOG_VERBOSE("embedding wrong hidden size, got %i, expected %i", tensor_storage.ne[0], text_model->model.hidden_size); return false; } } else { @@ -295,10 +295,10 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner { ggml_nbytes(embd)); for (int i = 0; i < embd->ne[1]; i++) { bpe_tokens.push_back(text_model->model.vocab_size + num_custom_embeddings); - // LOG_DEBUG("new custom token: %i", text_model.vocab_size + num_custom_embeddings); + // LOG_VERBOSE("new custom token: %i", text_model.vocab_size + num_custom_embeddings); num_custom_embeddings++; } - LOG_DEBUG("embedding '%s' applied, custom embeddings: %i", embd_name.c_str(), num_custom_embeddings); + LOG_VERBOSE("embedding '%s' applied, custom embeddings: %i", embd_name.c_str(), num_custom_embeddings); } if (embd2) { int64_t hidden_size = text_model2->model.hidden_size; @@ -308,10 +308,10 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner { ggml_nbytes(embd2)); for (int i = 0; i < embd2->ne[1]; i++) { bpe_tokens.push_back(text_model2->model.vocab_size + num_custom_embeddings_2); - // LOG_DEBUG("new custom token: %i", text_model.vocab_size + num_custom_embeddings); + // LOG_VERBOSE("new custom token: %i", text_model.vocab_size + num_custom_embeddings); num_custom_embeddings_2++; } - LOG_DEBUG("embedding '%s' applied, custom embeddings: %i (text model 2)", embd_name.c_str(), num_custom_embeddings_2); + LOG_VERBOSE("embedding '%s' applied, custom embeddings: %i (text model 2)", embd_name.c_str(), num_custom_embeddings_2); } int pos_end = num_custom_embeddings; if (pos_end == pos_start) { @@ -360,7 +360,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } auto on_new_token_cb = [&](std::string& str, std::vector& bpe_tokens) -> bool { @@ -381,7 +381,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner { size_t padding_size = (75 - (current_size % 75)) % 75; // Ensure no negative padding if (padding_size > 0) { - LOG_DEBUG("BREAK token encountered, padding current chunk by %zu tokens.", padding_size); + LOG_VERBOSE("BREAK token encountered, padding current chunk by %zu tokens.", padding_size); tokens.insert(tokens.end(), padding_size, tokenizer.EOS_TOKEN_ID); weights.insert(weights.end(), padding_size, 1.0f); } @@ -480,7 +480,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner { } } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); chunk_hidden_states = apply_token_weights(std::move(chunk_hidden_states), chunk_weights); @@ -752,7 +752,7 @@ struct SD3CLIPEmbedder : public Conditioner { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } auto on_new_token_cb = [&](std::string& str, std::vector& bpe_tokens) -> bool { @@ -960,7 +960,7 @@ struct SD3CLIPEmbedder : public Conditioner { } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); if (zero_out_masked) { chunk_hidden_states.fill_(0.0f); } @@ -1115,7 +1115,7 @@ struct FluxCLIPEmbedder : public Conditioner { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } auto on_new_token_cb = [&](std::string& str, std::vector& bpe_tokens) -> bool { @@ -1232,7 +1232,7 @@ struct FluxCLIPEmbedder : public Conditioner { } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); if (!hidden_states.empty()) { hidden_states = sd::ops::concat(hidden_states, chunk_hidden_states, 1); } else { @@ -1371,7 +1371,7 @@ struct T5CLIPEmbedder : public Conditioner { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } auto on_new_token_cb = [&](std::string& str, std::vector& bpe_tokens) -> bool { @@ -1412,7 +1412,7 @@ struct T5CLIPEmbedder : public Conditioner { ++num_pad; } } - // LOG_DEBUG("PAD: %d", num_pad); + // LOG_VERBOSE("PAD: %d", num_pad); } SDCondition get_learned_condition_common(int n_threads, @@ -1464,7 +1464,7 @@ struct T5CLIPEmbedder : public Conditioner { } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); if (!hidden_states.empty()) { hidden_states = sd::ops::concat(hidden_states, chunk_hidden_states, 1); @@ -1669,7 +1669,7 @@ struct AnimaConditioner : public Conditioner { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } std::vector qwen_tokens; @@ -1725,7 +1725,7 @@ struct AnimaConditioner : public Conditioner { auto t5_weight_tensor = sd::Tensor::from_vector(t5_weights); int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); SDCondition result; result.c_crossattn = std::move(hidden_states); @@ -1906,7 +1906,7 @@ struct LLMEmbedder : public Conditioner { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } std::vector tokens; @@ -2224,7 +2224,7 @@ struct LLMEmbedder : public Conditioner { prompt_template_encode_start_idx++; } } - LOG_DEBUG("prompt_template_encode_start_idx %d", prompt_template_encode_start_idx); + LOG_VERBOSE("prompt_template_encode_start_idx %d", prompt_template_encode_start_idx); prompt = prompt_prefix; if (llm->enable_vision && conditioner_params.ref_images != nullptr && !conditioner_params.ref_images->empty()) { @@ -2264,7 +2264,7 @@ struct LLMEmbedder : public Conditioner { resize_image_dims(height, width, h_bar, w_bar, factor, min_pixels, max_pixels, resize_mode); - LOG_DEBUG("resize LingBotVideo ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); + LOG_VERBOSE("resize LingBotVideo ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); auto resized_image = clip_preprocess(image, w_bar, h_bar); auto image_embed = llm->encode_image(n_threads, resized_image, false); GGML_ASSERT(!image_embed.empty()); @@ -2321,7 +2321,7 @@ struct LLMEmbedder : public Conditioner { resize_image_dims(height, width, h_bar, w_bar, factor, min_pixels, max_pixels, resize_mode); - LOG_DEBUG("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); + LOG_VERBOSE("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); auto resized_image = clip_preprocess(image, w_bar, h_bar); @@ -2405,7 +2405,7 @@ struct LLMEmbedder : public Conditioner { resize_image_dims(height, width, h_bar, w_bar, factor, min_pixels, max_pixels, resize_mode); - LOG_DEBUG("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); + LOG_VERBOSE("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); auto resized_image = clip_preprocess(image, w_bar, h_bar); auto image_embed = llm->encode_image(n_threads, resized_image, false); @@ -2473,7 +2473,7 @@ struct LLMEmbedder : public Conditioner { resize_image_dims(height, width, h_bar, w_bar, factor, min_pixels, max_pixels, resize_mode); - LOG_DEBUG("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); + LOG_VERBOSE("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); auto resized_image = clip_preprocess(image, w_bar, h_bar); auto image_embed = llm->encode_image(n_threads, resized_image, false); @@ -2536,7 +2536,7 @@ struct LLMEmbedder : public Conditioner { resize_image_dims(height, width, h_bar, w_bar, factor, min_pixels, max_pixels, resize_mode); - LOG_DEBUG("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); + LOG_VERBOSE("resize conditioner ref image %d from %dx%d to %dx%d", i, height, width, h_bar, w_bar); auto resized_image = clip_preprocess(image, w_bar, h_bar); auto image_embed = llm->encode_image(n_threads, resized_image, false); @@ -2716,7 +2716,7 @@ struct LLMEmbedder : public Conditioner { } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); SDCondition result; result.c_crossattn = std::move(hidden_states); @@ -2791,7 +2791,7 @@ struct LLMEmbedder : public Conditioner { } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing condition graph completed, taking %" PRId64 " ms", t1 - t0); SDCondition result; result.c_crossattn = std::move(hidden_states); result.extra_c_crossattns = std::move(extra_hidden_states_vec); @@ -3115,7 +3115,7 @@ struct LTXAVEmbedder : public Conditioner { GGML_ASSERT(!hidden_states.empty()); int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing LTXAV condition graph completed, taking %" PRId64 " ms", t1 - t0); + LOG_VERBOSE("computing LTXAV condition graph completed, taking %" PRId64 " ms", t1 - t0); SDCondition result; result.c_crossattn = std::move(hidden_states); diff --git a/src/core/ggml_extend.hpp b/src/core/ggml_extend.hpp index df0924790..f98309be0 100644 --- a/src/core/ggml_extend.hpp +++ b/src/core/ggml_extend.hpp @@ -63,7 +63,7 @@ __STATIC_INLINE__ int align_up(int n, int multiple) { __STATIC_INLINE__ void ggml_log_callback_default(ggml_log_level level, const char* text, void*) { switch (level) { case GGML_LOG_LEVEL_DEBUG: - LOG_DEBUG(text); + LOG_VERBOSE(text); break; case GGML_LOG_LEVEL_INFO: LOG_INFO(text); @@ -75,7 +75,7 @@ __STATIC_INLINE__ void ggml_log_callback_default(ggml_log_level level, const cha LOG_ERROR(text); break; default: - LOG_DEBUG(text); + LOG_VERBOSE(text); } } @@ -346,7 +346,7 @@ __STATIC_INLINE__ ggml_tensor* load_tensor_from_file(ggml_context* ctx, const st file.read(reinterpret_cast(&length), sizeof(length)); file.read(reinterpret_cast(&ttype), sizeof(ttype)); - LOG_DEBUG("load_tensor_from_file %d %d %d", n_dims, length, ttype); + LOG_VERBOSE("load_tensor_from_file %d %d %d", n_dims, length, ttype); if (file.eof()) { LOG_ERROR("incomplete file '%s'", file_path.c_str()); @@ -884,9 +884,9 @@ __STATIC_INLINE__ sd::Tensor process_tiles_2d(const sd::Tensor& in bool last_x = false; float last_time = 0.0f; if (!silent) { - LOG_DEBUG("num tiles : %d, %d ", num_tiles_x, num_tiles_y); - LOG_DEBUG("optimal overlap : %f, %f (targeting %f)", tile_overlap_factor_x, tile_overlap_factor_y, tile_overlap_factor); - LOG_DEBUG("processing %i tiles", num_tiles); + LOG_VERBOSE("num tiles : %d, %d ", num_tiles_x, num_tiles_y); + LOG_VERBOSE("optimal overlap : %f, %f (targeting %f)", tile_overlap_factor_x, tile_overlap_factor_y, tile_overlap_factor); + LOG_VERBOSE("processing %i tiles", num_tiles); pretty_progress(0, num_tiles, 0.0f); } for (int y = 0; y < small_height && !last_y; y += non_tile_overlap_y) { @@ -1436,7 +1436,7 @@ __STATIC_INLINE__ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx, }; if (flash_attn) { - // LOG_DEBUG("attention_ext L_q:%d L_k:%d n_head:%d C:%d d_head:%d N:%d", L_q, L_k, n_head, C, d_head, N); + // LOG_VERBOSE("attention_ext L_q:%d L_k:%d n_head:%d C:%d d_head:%d N:%d", L_q, L_k, n_head, C, d_head, N); bool can_use_flash_attn = true; if (mask != nullptr) { // TODO: figure out if we can bend t5 to work too @@ -1462,7 +1462,7 @@ __STATIC_INLINE__ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx, if (kqv == nullptr) { // if (flash_attn) { - // LOG_DEBUG("fallback to default attention, L_q:%d L_k:%d n_head:%d C:%d d_head:%d N:%d", L_q, L_k, n_head, C, d_head, N); + // LOG_VERBOSE("fallback to default attention, L_q:%d L_k:%d n_head:%d C:%d d_head:%d N:%d", L_q, L_k, n_head, C, d_head, N); // } v = ggml_ext_cont(ctx, ggml_permute(ctx, v, 1, 2, 0, 3)); // [N, n_kv_head, d_head, L_k] v = ggml_reshape_3d(ctx, v, L_k, d_head, n_kv_head * N); // [N * n_kv_head, d_head, L_k] @@ -2255,10 +2255,10 @@ struct GGMLRunner { graph_params.size()); graph_cut_layer_split_primary_notice_logged_ = true; } else { - LOG_DEBUG("%s graph-cut layer split: graph has no mark_graph_cut segments; using primary backend %s for %zu graph params", - get_desc().c_str(), - sd::layer_split_backend_device_display_name(runtime_backend).c_str(), - graph_params.size()); + LOG_VERBOSE("%s graph-cut layer split: graph has no mark_graph_cut segments; using primary backend %s for %zu graph params", + get_desc().c_str(), + sd::layer_split_backend_device_display_name(runtime_backend).c_str(), + graph_params.size()); } return true; } diff --git a/src/core/ggml_extend_backend.cpp b/src/core/ggml_extend_backend.cpp index a83166438..62b7e14ae 100644 --- a/src/core/ggml_extend_backend.cpp +++ b/src/core/ggml_extend_backend.cpp @@ -392,7 +392,7 @@ static bool backend_name_exists(const std::string& name) { static ggml_backend_t init_named_backend(const std::string& name) { ggml_backend_load_all_once(); - LOG_DEBUG("Initializing backend: %s", name.c_str()); + LOG_VERBOSE("Initializing backend: %s", name.c_str()); if (trim_copy(name).empty()) { return ggml_backend_init_best(); } @@ -542,10 +542,10 @@ static ggml_backend_t sd_get_default_backend() { if (dev_count == 0) { LOG_ERROR("No devices found!"); } else { - LOG_DEBUG("Found %zu backend devices:", dev_count); + LOG_VERBOSE("Found %zu backend devices:", dev_count); for (size_t i = 0; i < dev_count; ++i) { auto dev = ggml_backend_dev_get(i); - LOG_DEBUG("#%zu: %s", i, ggml_backend_dev_name(dev)); + LOG_VERBOSE("#%zu: %s", i, ggml_backend_dev_name(dev)); } } }); @@ -587,7 +587,7 @@ static ggml_backend_t sd_get_default_backend() { } if (sd_backend_is_cpu(backend)) { - LOG_DEBUG("Using CPU backend"); + LOG_VERBOSE("Using CPU backend"); } return backend; diff --git a/src/core/ggml_runner.cpp b/src/core/ggml_runner.cpp index c3d69fd72..24f19c98b 100644 --- a/src/core/ggml_runner.cpp +++ b/src/core/ggml_runner.cpp @@ -170,8 +170,8 @@ std::optional> GGMLRunner::execute_graph(ggml_cgraph* graph, int n } const bool segments_changed = plan.segments.size() != logged_segment_count_; if (segments_changed && (segmented || logged_segment_count_ > 1)) { - LOG_DEBUG("%s using %zu segment%s", get_desc().c_str(), - plan.segments.size(), plan.segments.size() == 1 ? "" : "s"); + LOG_VERBOSE("%s using %zu segment%s", get_desc().c_str(), + plan.segments.size(), plan.segments.size() == 1 ? "" : "s"); } SegmentGraphBindings bindings(cut_cache_, plan, graph); SegmentWeightPipeline weights(manager, runtime_backend, reinterpret_cast(this), @@ -261,6 +261,8 @@ std::optional> GGMLRunner::execute_graph(ggml_cgraph* graph, int n if (!prefetch_requests.empty()) { weights.enqueue_next(index, prefetch_requests.front()); } + LOG_DEBUG("%s executing segment %zu/%zu: %s", get_desc().c_str(), + index + 1, plan.segments.size(), segment.group_name.c_str()); if (!execute_segment(segment_graph, n_threads) || !cache_.capture(segment_graph) || !cut_cache_.capture(graph, segment, get_desc().c_str())) { @@ -284,10 +286,10 @@ std::optional> GGMLRunner::execute_graph(ggml_cgraph* graph, int n } if (segments_changed || peak_compute_bytes != logged_compute_bytes_) { for (const auto& entry : peak_compute_bytes) { - LOG_DEBUG("%s compute buffer size: %.2f MB(%s) on %s (peak across %zu segment%s)", - get_desc().c_str(), entry.second / (1024.0 * 1024.0), - sd_backend_is_cpu(entry.first) ? "RAM" : "VRAM", ggml_backend_name(entry.first), - plan.segments.size(), plan.segments.size() == 1 ? "" : "s"); + LOG_VERBOSE("%s compute buffer size: %.2f MB(%s) on %s (peak across %zu segment%s)", + get_desc().c_str(), entry.second / (1024.0 * 1024.0), + sd_backend_is_cpu(entry.first) ? "RAM" : "VRAM", ggml_backend_name(entry.first), + plan.segments.size(), plan.segments.size() == 1 ? "" : "s"); } logged_compute_bytes_ = std::move(peak_compute_bytes); logged_segment_count_ = plan.segments.size(); diff --git a/src/core/layer_split_partition.cpp b/src/core/layer_split_partition.cpp index f4059b043..e19f47b26 100644 --- a/src/core/layer_split_partition.cpp +++ b/src/core/layer_split_partition.cpp @@ -251,13 +251,13 @@ namespace sd { assignment.tensors_by_backend[i].size(), assignment.bytes_by_backend[i] / (1024.0 * 1024.0)); } else { - LOG_DEBUG("%s graph-cut layer split: %s <- segments [%zu, %zu), %zu tensors, %.1f MB", - desc, - layer_split_backend_device_display_name(split_backends[i]).c_str(), - first_segment, - last_segment, - assignment.tensors_by_backend[i].size(), - assignment.bytes_by_backend[i] / (1024.0 * 1024.0)); + LOG_VERBOSE("%s graph-cut layer split: %s <- segments [%zu, %zu), %zu tensors, %.1f MB", + desc, + layer_split_backend_device_display_name(split_backends[i]).c_str(), + first_segment, + last_segment, + assignment.tensors_by_backend[i].size(), + assignment.bytes_by_backend[i] / (1024.0 * 1024.0)); } } } diff --git a/src/core/util.h b/src/core/util.h index 35b52061b..1801b4176 100644 --- a/src/core/util.h +++ b/src/core/util.h @@ -105,6 +105,7 @@ void* sd_get_backend_eval_callback_data(); bool sd_backend_is(ggml_backend_t backend, const std::string& name); #define LOG_DEBUG(format, ...) log_printf(SD_LOG_DEBUG, __FILE__, __LINE__, format, ##__VA_ARGS__) +#define LOG_VERBOSE(format, ...) log_printf(SD_LOG_VERBOSE, __FILE__, __LINE__, format, ##__VA_ARGS__) #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__) diff --git a/src/model/adapter/lora.hpp b/src/model/adapter/lora.hpp index 4d701c903..e1a3bbd07 100644 --- a/src/model/adapter/lora.hpp +++ b/src/model/adapter/lora.hpp @@ -120,7 +120,7 @@ struct LoraModel : public GGMLRunner { return false; } - LOG_DEBUG("finished loaded lora"); + LOG_VERBOSE("finished loaded lora"); return true; } @@ -242,7 +242,7 @@ struct LoraModel : public GGMLRunner { if (iter != lora_tensors.end()) { float alpha = ggml_ext_backend_tensor_get_f32(iter->second); scale_value = alpha / rank; - // LOG_DEBUG("rank %s %ld %.2f %.2f", alpha_name.c_str(), rank, alpha, scale_value); + // LOG_VERBOSE("rank %s %ld %.2f %.2f", alpha_name.c_str(), rank, alpha, scale_value); applied_lora_tensors.insert(alpha_name); } } @@ -798,7 +798,7 @@ struct LoraModel : public GGMLRunner { float alpha = ggml_ext_backend_tensor_get_f32(iter->second); scale_value = alpha / rank; scale_tensor_name = alpha_name; - // LOG_DEBUG("rank %s %ld %.2f %.2f", alpha_name.c_str(), rank, alpha, scale_value); + // LOG_VERBOSE("rank %s %ld %.2f %.2f", alpha_name.c_str(), rank, alpha, scale_value); } } scale_value *= multiplier; diff --git a/src/model/adapter/pmid.hpp b/src/model/adapter/pmid.hpp index 58e907564..c71ca16da 100644 --- a/src/model/adapter/pmid.hpp +++ b/src/model/adapter/pmid.hpp @@ -639,7 +639,7 @@ struct PhotoMakerIDEmbed : public GGMLRunner { return false; } - LOG_DEBUG("finished loading PhotoMaker ID Embeds "); + LOG_VERBOSE("finished loading PhotoMaker ID Embeds "); return true; } diff --git a/src/model/common/block.hpp b/src/model/common/block.hpp index 6eb387d9f..54faf81fc 100644 --- a/src/model/common/block.hpp +++ b/src/model/common/block.hpp @@ -340,7 +340,7 @@ class CrossAttention : public GGMLBlock { enable_ip(enable_ip) { int64_t inner_dim = d_head * n_head; if (context_dim == 320 && d_head == 320) { - // LOG_DEBUG("CrossAttention: temp set dim to 1024 for sdxs_09"); + // LOG_VERBOSE("CrossAttention: temp set dim to 1024 for sdxs_09"); xtra_dim = true; context_dim = 1024; } @@ -370,7 +370,7 @@ class CrossAttention : public GGMLBlock { auto q = to_q->forward(ctx, x); // [N, n_token, inner_dim] if (xtra_dim) { - // LOG_DEBUG("CrossAttention: temp set dim to 1024 for sdxs_09"); + // LOG_VERBOSE("CrossAttention: temp set dim to 1024 for sdxs_09"); context->ne[0] = 1024; // patch dim } auto k = to_k->forward(ctx, context); // [N, n_context, inner_dim] diff --git a/src/model/detector/yolov8.h b/src/model/detector/yolov8.h index 3e9cd3b01..ca837e960 100644 --- a/src/model/detector/yolov8.h +++ b/src/model/detector/yolov8.h @@ -68,12 +68,12 @@ struct YOLOv8Config { } if (config.valid) { - LOG_DEBUG("yolov8: classes=%d, reg_max=%d, p3=%d, p4=%d, p5=%d", - config.num_classes, - config.reg_max, - config.out_channels[15], - config.out_channels[18], - config.out_channels[21]); + LOG_VERBOSE("yolov8: classes=%d, reg_max=%d, p3=%d, p4=%d, p5=%d", + config.num_classes, + config.reg_max, + config.out_channels[15], + config.out_channels[18], + config.out_channels[21]); } return config; } diff --git a/src/model/diffusion/anima.hpp b/src/model/diffusion/anima.hpp index 867f397bd..73c57a048 100644 --- a/src/model/diffusion/anima.hpp +++ b/src/model/diffusion/anima.hpp @@ -46,11 +46,11 @@ namespace Anima { } if (detected_layers > 0) { config.num_layers = detected_layers; - LOG_DEBUG("anima: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", head_dim = %" PRId64, - config.num_layers, - config.hidden_size, - config.num_heads, - config.head_dim); + LOG_VERBOSE("anima: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", head_dim = %" PRId64, + config.num_layers, + config.hidden_size, + config.num_heads, + config.head_dim); } return config; } diff --git a/src/model/diffusion/boogu.hpp b/src/model/diffusion/boogu.hpp index b199208d8..a678c1f78 100644 --- a/src/model/diffusion/boogu.hpp +++ b/src/model/diffusion/boogu.hpp @@ -109,16 +109,16 @@ namespace Boogu { } config.timestep_embed_dim = std::min(config.hidden_size, 1024); - LOG_DEBUG("boogu_image: layers=%" PRId64 ", double_stream_layers=%" PRId64 ", refiner_layers=%" PRId64 ", hidden=%" PRId64 ", heads=%" PRId64 ", kv_heads=%" PRId64 ", head_dim=%" PRId64 ", in_channels=%" PRId64 ", out_channels=%" PRId64, - config.num_layers, - config.num_double_stream_layers, - config.num_refiner_layers, - config.hidden_size, - config.num_attention_heads, - config.num_kv_heads, - config.head_dim, - config.in_channels, - config.out_channels); + LOG_VERBOSE("boogu_image: layers=%" PRId64 ", double_stream_layers=%" PRId64 ", refiner_layers=%" PRId64 ", hidden=%" PRId64 ", heads=%" PRId64 ", kv_heads=%" PRId64 ", head_dim=%" PRId64 ", in_channels=%" PRId64 ", out_channels=%" PRId64, + config.num_layers, + config.num_double_stream_layers, + config.num_refiner_layers, + config.hidden_size, + config.num_attention_heads, + config.num_kv_heads, + config.head_dim, + config.in_channels, + config.out_channels); return config; } }; diff --git a/src/model/diffusion/ernie_image.hpp b/src/model/diffusion/ernie_image.hpp index 4dfb7a892..70aa0f510 100644 --- a/src/model/diffusion/ernie_image.hpp +++ b/src/model/diffusion/ernie_image.hpp @@ -72,13 +72,13 @@ namespace ErnieImage { for (int axis_dim : config.axes_dim) { config.axes_dim_sum += axis_dim; } - LOG_DEBUG("ernie_image: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", ffn_hidden_size = %" PRId64 ", in_channels = %" PRId64 ", out_channels = %" PRId64, - config.num_layers, - config.hidden_size, - config.num_heads, - config.ffn_hidden_size, - config.in_channels, - config.out_channels); + LOG_VERBOSE("ernie_image: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", ffn_hidden_size = %" PRId64 ", in_channels = %" PRId64 ", out_channels = %" PRId64, + config.num_layers, + config.hidden_size, + config.num_heads, + config.ffn_hidden_size, + config.in_channels, + config.out_channels); return config; } }; diff --git a/src/model/diffusion/flux.hpp b/src/model/diffusion/flux.hpp index 28a19a8a7..98416afa2 100644 --- a/src/model/diffusion/flux.hpp +++ b/src/model/diffusion/flux.hpp @@ -123,16 +123,16 @@ namespace Flux { config.guidance_embed = true; } if (name.find("__x0__") != std::string::npos) { - LOG_DEBUG("using x0 prediction"); + LOG_VERBOSE("using x0 prediction"); config.chroma_radiance_params.use_x0 = true; } if (name.find("__32x32__") != std::string::npos) { - LOG_DEBUG("using patch size 32"); + LOG_VERBOSE("using patch size 32"); config.patch_size = 32; } if (name.find("img_in_patch.weight") != std::string::npos) { actual_radiance_patch_size = tensor_storage.ne[0]; - LOG_DEBUG("actual radiance patch size: %" PRId64, actual_radiance_patch_size); + LOG_VERBOSE("actual radiance patch size: %" PRId64, actual_radiance_patch_size); } if (name.find("distilled_guidance_layer.in_proj.weight") != std::string::npos) { config.is_chroma = true; @@ -169,7 +169,7 @@ namespace Flux { } if (actual_radiance_patch_size > 0 && actual_radiance_patch_size != config.patch_size) { GGML_ASSERT(config.patch_size == 2 * actual_radiance_patch_size); - LOG_DEBUG("using fake x2 patch size"); + LOG_VERBOSE("using fake x2 patch size"); config.chroma_radiance_params.fake_patch_size_x2 = true; } if (head_dim > 0) { @@ -179,13 +179,13 @@ namespace Flux { for (int axis_dim : config.axes_dim) { config.axes_dim_sum += axis_dim; } - LOG_DEBUG("flux: depth = %d, depth_single_blocks = %d, guidance_embed = %s, context_in_dim = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %d", - config.depth, - config.depth_single_blocks, - config.guidance_embed ? "true" : "false", - config.context_in_dim, - config.hidden_size, - config.num_heads); + LOG_VERBOSE("flux: depth = %d, depth_single_blocks = %d, guidance_embed = %s, context_in_dim = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %d", + config.depth, + config.depth_single_blocks, + config.guidance_embed ? "true" : "false", + config.context_in_dim, + config.hidden_size, + config.num_heads); return config; } }; @@ -1560,7 +1560,7 @@ namespace Flux { config.axes_dim, sd_version_is_longcat(version)); int pos_len = static_cast(pe_vec.size() / config.axes_dim_sum / 2); - // LOG_DEBUG("pos_len %d", pos_len); + // LOG_VERBOSE("pos_len %d", pos_len); auto pe = ggml_new_tensor_4d(compute_ctx, GGML_TYPE_F32, 2, 2, config.axes_dim_sum / 2, pos_len); // pe->data = pe_vec.data(); // print_ggml_tensor(pe); @@ -1702,7 +1702,7 @@ namespace Flux { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("flux test done in %lldms", t1 - t0); + LOG_VERBOSE("flux test done in %lldms", t1 - t0); } } diff --git a/src/model/diffusion/hunyuan.hpp b/src/model/diffusion/hunyuan.hpp index 241c3560f..a5e2ed664 100644 --- a/src/model/diffusion/hunyuan.hpp +++ b/src/model/diffusion/hunyuan.hpp @@ -266,16 +266,16 @@ namespace Hunyuan { GGML_ASSERT(config.hidden_size / config.num_heads == config.axes_dim_sum); if (inferred) { - LOG_DEBUG("hunyuan video: depth = %d, single depth = %d, in_channels = %" PRId64 ", out_channels = %" PRId64 ", hidden_size = %" PRId64 ", context_in_dim = %" PRId64 ", patch_size = %dx%dx%d", - config.depth, - config.depth_single_blocks, - config.in_channels, - config.out_channels, - config.hidden_size, - config.context_in_dim, - std::get<0>(config.patch_size), - std::get<1>(config.patch_size), - std::get<2>(config.patch_size)); + LOG_VERBOSE("hunyuan video: depth = %d, single depth = %d, in_channels = %" PRId64 ", out_channels = %" PRId64 ", hidden_size = %" PRId64 ", context_in_dim = %" PRId64 ", patch_size = %dx%dx%d", + config.depth, + config.depth_single_blocks, + config.in_channels, + config.out_channels, + config.hidden_size, + config.context_in_dim, + std::get<0>(config.patch_size), + std::get<1>(config.patch_size), + std::get<2>(config.patch_size)); } return config; } @@ -615,7 +615,7 @@ namespace Hunyuan { config.theta, config.axes_dim); int64_t pos_len = static_cast(pe_vec.size() / config.axes_dim_sum / 2); - // LOG_DEBUG("pos_len %d", pos_len); + // LOG_VERBOSE("pos_len %d", pos_len); auto pe = ggml_new_tensor_4d(compute_ctx, GGML_TYPE_F32, 2, 2, config.axes_dim_sum / 2, pos_len); // pe->data = pe_vec.data(); // print_ggml_tensor(pe, true, "pe"); diff --git a/src/model/diffusion/ideogram4.hpp b/src/model/diffusion/ideogram4.hpp index 1d2d94985..43ab4d120 100644 --- a/src/model/diffusion/ideogram4.hpp +++ b/src/model/diffusion/ideogram4.hpp @@ -58,11 +58,11 @@ namespace Ideogram4 { } if (detected_layers > 0) { config.num_layers = detected_layers; - LOG_DEBUG("ideogram4: num_layers = %" PRId64 ", emb_dim = %" PRId64 ", num_heads = %" PRId64 ", intermediate_size = %" PRId64, - config.num_layers, - config.emb_dim, - config.num_heads, - config.intermediate_size); + LOG_VERBOSE("ideogram4: num_layers = %" PRId64 ", emb_dim = %" PRId64 ", num_heads = %" PRId64 ", intermediate_size = %" PRId64, + config.num_layers, + config.emb_dim, + config.num_heads, + config.intermediate_size); } return config; } @@ -465,7 +465,7 @@ namespace Ideogram4 { } } if (has_uncond_model) { - LOG_DEBUG("using uncond model"); + LOG_VERBOSE("using uncond model"); uncond_model = Ideogram4Transformer(config); uncond_model.init(params_ctx, tensor_storage_map, uncond_prefix); } diff --git a/src/model/diffusion/krea2.hpp b/src/model/diffusion/krea2.hpp index a80f5e42a..9fe583765 100644 --- a/src/model/diffusion/krea2.hpp +++ b/src/model/diffusion/krea2.hpp @@ -143,16 +143,16 @@ namespace Krea2 { } config.update_axes_dim(); - LOG_DEBUG("krea2: layers=%" PRId64 ", features=%" PRId64 ", heads=%" PRId64 ", kv_heads=%" PRId64 ", text_dim=%" PRId64 ", text_layers=%" PRId64 ", text_heads=%" PRId64 ", text_kv_heads=%" PRId64 ", channels=%" PRId64, - config.layers, - config.features, - config.heads, - config.kv_heads, - config.text_dim, - config.text_layers, - config.text_heads, - config.text_kv_heads, - config.in_channels); + LOG_VERBOSE("krea2: layers=%" PRId64 ", features=%" PRId64 ", heads=%" PRId64 ", kv_heads=%" PRId64 ", text_dim=%" PRId64 ", text_layers=%" PRId64 ", text_heads=%" PRId64 ", text_kv_heads=%" PRId64 ", channels=%" PRId64, + config.layers, + config.features, + config.heads, + config.kv_heads, + config.text_dim, + config.text_layers, + config.text_heads, + config.text_kv_heads, + config.in_channels); return config; } }; diff --git a/src/model/diffusion/lens.hpp b/src/model/diffusion/lens.hpp index 2658359ce..16b50c27d 100644 --- a/src/model/diffusion/lens.hpp +++ b/src/model/diffusion/lens.hpp @@ -66,14 +66,14 @@ namespace Lens { for (int axis_dim : config.axes_dim) { config.axes_dim_sum += axis_dim; } - LOG_DEBUG("lens: num_layers = %d, selected_layer_count = %d, hidden_size = %" PRId64 ", num_attention_heads = %" PRId64 ", attention_head_dim = %" PRId64 ", in_channels = %" PRId64 ", out_channels = %" PRId64, - config.num_layers, - config.selected_layer_count, - config.num_attention_heads * config.attention_head_dim, - config.num_attention_heads, - config.attention_head_dim, - config.in_channels, - config.out_channels); + LOG_VERBOSE("lens: num_layers = %d, selected_layer_count = %d, hidden_size = %" PRId64 ", num_attention_heads = %" PRId64 ", attention_head_dim = %" PRId64 ", in_channels = %" PRId64 ", out_channels = %" PRId64, + config.num_layers, + config.selected_layer_count, + config.num_attention_heads * config.attention_head_dim, + config.num_attention_heads, + config.attention_head_dim, + config.in_channels, + config.out_channels); return config; } }; diff --git a/src/model/diffusion/lingbot_video.hpp b/src/model/diffusion/lingbot_video.hpp index 94af7199c..b57a6ce03 100644 --- a/src/model/diffusion/lingbot_video.hpp +++ b/src/model/diffusion/lingbot_video.hpp @@ -127,17 +127,17 @@ namespace LingBotVideo { config.topk_group = 2; config.routed_scaling_factor = 2.5f; } - LOG_DEBUG("lingbot_video: depth = %" PRId64 ", hidden_size = %" PRId64 ", heads = %" PRId64 ", text_dim = %" PRId64 ", experts = %" PRId64 ", experts_per_tok = %" PRId64 ", n_group = %" PRId64 ", topk_group = %" PRId64 ", route_scale = %.2f, sparse_layers = %zu", - config.depth, - config.hidden_size, - config.num_attention_heads, - config.text_dim, - config.num_experts, - config.num_experts_per_tok, - config.n_group, - config.topk_group, - config.routed_scaling_factor, - config.sparse_layers.size()); + LOG_VERBOSE("lingbot_video: depth = %" PRId64 ", hidden_size = %" PRId64 ", heads = %" PRId64 ", text_dim = %" PRId64 ", experts = %" PRId64 ", experts_per_tok = %" PRId64 ", n_group = %" PRId64 ", topk_group = %" PRId64 ", route_scale = %.2f, sparse_layers = %zu", + config.depth, + config.hidden_size, + config.num_attention_heads, + config.text_dim, + config.num_experts, + config.num_experts_per_tok, + config.n_group, + config.topk_group, + config.routed_scaling_factor, + config.sparse_layers.size()); return config; } }; diff --git a/src/model/diffusion/ltxv.hpp b/src/model/diffusion/ltxv.hpp index e33448d21..3406e4a00 100644 --- a/src/model/diffusion/ltxv.hpp +++ b/src/model/diffusion/ltxv.hpp @@ -274,12 +274,12 @@ namespace LTXV { config.audio_connector_apply_gated_attention = true; } } - LOG_DEBUG("ltxav: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_attention_heads = %" PRId64 ", audio_hidden_size = %" PRId64 ", audio_num_attention_heads = %" PRId64, - config.num_layers, - config.hidden_size, - config.num_attention_heads, - config.audio_hidden_size, - config.audio_num_attention_heads); + LOG_VERBOSE("ltxav: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_attention_heads = %" PRId64 ", audio_hidden_size = %" PRId64 ", audio_num_attention_heads = %" PRId64, + config.num_layers, + config.hidden_size, + config.num_attention_heads, + config.audio_hidden_size, + config.audio_num_attention_heads); return config; } }; @@ -2070,7 +2070,7 @@ namespace LTXV { GGML_ASSERT(!out_opt.empty()); print_sd_tensor(out_opt, false, "ltxav_out"); - LOG_DEBUG("ltxav test done in %lldms", t1 - t0); + LOG_VERBOSE("ltxav test done in %lldms", t1 - t0); } static void load_from_file_and_test(const std::string& model_path, diff --git a/src/model/diffusion/minimax_h3.hpp b/src/model/diffusion/minimax_h3.hpp index a927cd651..1acd7d9d3 100644 --- a/src/model/diffusion/minimax_h3.hpp +++ b/src/model/diffusion/minimax_h3.hpp @@ -106,14 +106,14 @@ namespace MiniMaxH3 { config.rope_inv_freq_len = inv_freq->ne[0]; } - LOG_DEBUG("minimax_h3: layers=%" PRId64 ", hidden=%" PRId64 ", heads=%" PRId64 - ", head_dim=%" PRId64 ", ffn=%" PRId64 ", adaln_curve=%" PRId64, - config.num_layers, - config.hidden_size, - config.num_attention_heads, - config.attention_head_dim, - config.ffn_hidden_size, - config.adaln_curve_grid); + LOG_VERBOSE("minimax_h3: layers=%" PRId64 ", hidden=%" PRId64 ", heads=%" PRId64 + ", head_dim=%" PRId64 ", ffn=%" PRId64 ", adaln_curve=%" PRId64, + config.num_layers, + config.hidden_size, + config.num_attention_heads, + config.attention_head_dim, + config.ffn_hidden_size, + config.adaln_curve_grid); return config; } }; diff --git a/src/model/diffusion/minit2i.hpp b/src/model/diffusion/minit2i.hpp index 110a7f766..613c20280 100644 --- a/src/model/diffusion/minit2i.hpp +++ b/src/model/diffusion/minit2i.hpp @@ -108,15 +108,15 @@ namespace MiniT2I { config.head_dim = config.hidden_size == 1248 ? 52 : 64; config.num_heads = config.hidden_size / config.head_dim; } - LOG_DEBUG("minit2i: hidden_size=%" PRId64 ", txt_hidden_size=%" PRId64 ", heads=%" PRId64 ", head_dim=%" PRId64 ", double_blocks=%" PRId64 ", txt_blocks=%" PRId64 ", patch=%" PRId64 ", in_channels=%" PRId64, - config.hidden_size, - config.txt_hidden_size, - config.num_heads, - config.head_dim, - config.depth_double, - config.txt_preamble_depth, - config.patch_size, - config.in_channels); + LOG_VERBOSE("minit2i: hidden_size=%" PRId64 ", txt_hidden_size=%" PRId64 ", heads=%" PRId64 ", head_dim=%" PRId64 ", double_blocks=%" PRId64 ", txt_blocks=%" PRId64 ", patch=%" PRId64 ", in_channels=%" PRId64, + config.hidden_size, + config.txt_hidden_size, + config.num_heads, + config.head_dim, + config.depth_double, + config.txt_preamble_depth, + config.patch_size, + config.in_channels); return config; } }; diff --git a/src/model/diffusion/mmdit.hpp b/src/model/diffusion/mmdit.hpp index 2982742cc..8a6efee77 100644 --- a/src/model/diffusion/mmdit.hpp +++ b/src/model/diffusion/mmdit.hpp @@ -120,16 +120,16 @@ struct MMDiTConfig { } if (has_weight_config) { - LOG_DEBUG("mmdit: num_layers = %" PRId64 ", num_mmdit_x_layers = %" PRId64 ", hidden_size = %" PRId64 ", patch_size = %d, in_channels = %" PRId64 ", out_channels = %" PRId64 ", context_size = %" PRId64 ", adm_in_channels = %" PRId64 ", qk_norm = %s", - config.depth, - config.d_self + 1, - config.hidden_size, - config.patch_size, - config.in_channels, - config.out_channels, - config.context_size, - config.adm_in_channels, - config.qk_norm.empty() ? "none" : config.qk_norm.c_str()); + LOG_VERBOSE("mmdit: num_layers = %" PRId64 ", num_mmdit_x_layers = %" PRId64 ", hidden_size = %" PRId64 ", patch_size = %d, in_channels = %" PRId64 ", out_channels = %" PRId64 ", context_size = %" PRId64 ", adm_in_channels = %" PRId64 ", qk_norm = %s", + config.depth, + config.d_self + 1, + config.hidden_size, + config.patch_size, + config.in_channels, + config.out_channels, + config.context_size, + config.adm_in_channels, + config.qk_norm.empty() ? "none" : config.qk_norm.c_str()); } return config; } @@ -1045,7 +1045,7 @@ struct MMDiTRunner : public DiffusionModelRunner { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("mmdit test done in %lldms", t1 - t0); + LOG_VERBOSE("mmdit test done in %lldms", t1 - t0); } } diff --git a/src/model/diffusion/pid.hpp b/src/model/diffusion/pid.hpp index 24db7765f..6ee5dde8f 100644 --- a/src/model/diffusion/pid.hpp +++ b/src/model/diffusion/pid.hpp @@ -109,16 +109,16 @@ namespace Pid { config.lq_latent_channels = latent_proj_in_channels; config.lq_latent_down_factor = latent_proj_in_channels >= 64 ? 16 : 8; } - LOG_DEBUG("pid: version = %s, patch_depth = %" PRId64 ", pixel_depth = %" PRId64 ", patch_mlp_hidden_dim = %" PRId64 ", lq_latent_channels = %" PRId64 ", lq_hidden_dim = %" PRId64 ", lq_latent_down_factor = %" PRId64 ", lq_latent_unpatchify_factor = %" PRId64 ", lq_interval = %" PRId64, - config.pit_lq_inject ? "1.5" : "1", - config.patch_depth, - config.pixel_depth, - config.patch_mlp_hidden_dim, - config.lq_latent_channels, - config.lq_hidden_dim, - config.lq_latent_down_factor, - config.lq_latent_unpatchify_factor, - config.lq_interval); + LOG_VERBOSE("pid: version = %s, patch_depth = %" PRId64 ", pixel_depth = %" PRId64 ", patch_mlp_hidden_dim = %" PRId64 ", lq_latent_channels = %" PRId64 ", lq_hidden_dim = %" PRId64 ", lq_latent_down_factor = %" PRId64 ", lq_latent_unpatchify_factor = %" PRId64 ", lq_interval = %" PRId64, + config.pit_lq_inject ? "1.5" : "1", + config.patch_depth, + config.pixel_depth, + config.patch_mlp_hidden_dim, + config.lq_latent_channels, + config.lq_hidden_dim, + config.lq_latent_down_factor, + config.lq_latent_unpatchify_factor, + config.lq_interval); return config; } }; diff --git a/src/model/diffusion/qwen_image.hpp b/src/model/diffusion/qwen_image.hpp index 14d339162..18da323d1 100644 --- a/src/model/diffusion/qwen_image.hpp +++ b/src/model/diffusion/qwen_image.hpp @@ -49,9 +49,9 @@ namespace Qwen { } } } - LOG_DEBUG("qwen_image: num_layers = %d, zero_cond_t = %s", - config.num_layers, - config.zero_cond_t ? "true" : "false"); + LOG_VERBOSE("qwen_image: num_layers = %d, zero_cond_t = %s", + config.num_layers, + config.zero_cond_t ? "true" : "false"); return config; } }; @@ -646,7 +646,7 @@ namespace Qwen { circular_x_enabled, config.axes_dim); int pos_len = static_cast(pe_vec.size() / config.axes_dim_sum / 2); - // LOG_DEBUG("pos_len %d", pos_len); + // LOG_VERBOSE("pos_len %d", pos_len); auto pe = ggml_new_tensor_4d(compute_ctx, GGML_TYPE_F32, 2, 2, config.axes_dim_sum / 2, pos_len); // pe->data = pe_vec.data(); // print_ggml_tensor(pe, true, "pe"); @@ -760,7 +760,7 @@ namespace Qwen { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("qwen_image test done in %lldms", t1 - t0); + LOG_VERBOSE("qwen_image test done in %lldms", t1 - t0); } } diff --git a/src/model/diffusion/sefi_image.hpp b/src/model/diffusion/sefi_image.hpp index 271919882..281efefd3 100644 --- a/src/model/diffusion/sefi_image.hpp +++ b/src/model/diffusion/sefi_image.hpp @@ -34,10 +34,10 @@ namespace SefiImage { config.hidden_size = tensor_storage.ne[1] * 2; } } - LOG_DEBUG("sefi_image: semantic_channels = %" PRId64 ", texture_latent_channels = %" PRId64 ", hidden_size = %" PRId64, - config.semantic_channels, - config.texture_latent_channels, - config.hidden_size); + LOG_VERBOSE("sefi_image: semantic_channels = %" PRId64 ", texture_latent_channels = %" PRId64 ", hidden_size = %" PRId64, + config.semantic_channels, + config.texture_latent_channels, + config.hidden_size); return config; } }; diff --git a/src/model/diffusion/unet.hpp b/src/model/diffusion/unet.hpp index 3f2a87aaf..10e865833 100644 --- a/src/model/diffusion/unet.hpp +++ b/src/model/diffusion/unet.hpp @@ -128,15 +128,15 @@ struct UNetConfig { } } - LOG_DEBUG("unet: in_channels = %d, out_channels = %d, model_channels = %d, time_embed_dim = %d, context_dim = %d, adm_in_channels = %d, num_res_blocks = %d, tiny_unet = %s", - config.in_channels, - config.out_channels, - config.model_channels, - config.time_embed_dim, - config.context_dim, - config.adm_in_channels, - config.num_res_blocks, - config.tiny_unet ? "true" : "false"); + LOG_VERBOSE("unet: in_channels = %d, out_channels = %d, model_channels = %d, time_embed_dim = %d, context_dim = %d, adm_in_channels = %d, num_res_blocks = %d, tiny_unet = %s", + config.in_channels, + config.out_channels, + config.model_channels, + config.time_embed_dim, + config.context_dim, + config.adm_in_channels, + config.num_res_blocks, + config.tiny_unet ? "true" : "false"); return config; } }; @@ -904,7 +904,7 @@ struct UNetModelRunner : public DiffusionModelRunner { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("unet test done in %lldms", t1 - t0); + LOG_VERBOSE("unet test done in %lldms", t1 - t0); } } }; diff --git a/src/model/diffusion/wan.hpp b/src/model/diffusion/wan.hpp index dc7042b15..69f5c86d2 100644 --- a/src/model/diffusion/wan.hpp +++ b/src/model/diffusion/wan.hpp @@ -75,13 +75,13 @@ namespace WAN { config.flf_pos_embed_token_number = 514; } } - LOG_DEBUG("wan: model_type = %s, num_layers = %d, vace_layers = %d, dim = %" PRId64 ", ffn_dim = %" PRId64 ", num_heads = %" PRId64, - config.model_type.c_str(), - config.num_layers, - config.vace_layers, - config.dim, - config.ffn_dim, - config.num_heads); + LOG_VERBOSE("wan: model_type = %s, num_layers = %d, vace_layers = %d, dim = %" PRId64 ", ffn_dim = %" PRId64 ", num_heads = %" PRId64, + config.model_type.c_str(), + config.num_layers, + config.vace_layers, + config.dim, + config.ffn_dim, + config.num_heads); return config; } }; @@ -909,7 +909,7 @@ namespace WAN { config.theta, config.axes_dim); int pos_len = static_cast(pe_vec.size() / config.axes_dim_sum / 2); - // LOG_DEBUG("pos_len %d", pos_len); + // LOG_VERBOSE("pos_len %d", pos_len); auto pe = ggml_new_tensor_4d(compute_ctx, GGML_TYPE_F32, 2, 2, config.axes_dim_sum / 2, pos_len); // pe->data = pe_vec.data(); // print_ggml_tensor(pe); @@ -1007,7 +1007,7 @@ namespace WAN { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("wan test done in %lldms", t1 - t0); + LOG_VERBOSE("wan test done in %lldms", t1 - t0); } } diff --git a/src/model/diffusion/z_image.hpp b/src/model/diffusion/z_image.hpp index d2604261d..dacd9ddc4 100644 --- a/src/model/diffusion/z_image.hpp +++ b/src/model/diffusion/z_image.hpp @@ -107,14 +107,14 @@ namespace ZImage { config.num_kv_heads = std::max(1, (qkv_heads - config.num_heads) / 2); } } - LOG_DEBUG("z_image: num_layers = %" PRId64 ", num_refiner_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", num_kv_heads = %" PRId64 ", in_channels = %" PRId64 ", out_channels = %" PRId64, - config.num_layers, - config.num_refiner_layers, - config.hidden_size, - config.num_heads, - config.num_kv_heads, - config.in_channels, - config.out_channels); + LOG_VERBOSE("z_image: num_layers = %" PRId64 ", num_refiner_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", num_kv_heads = %" PRId64 ", in_channels = %" PRId64 ", out_channels = %" PRId64, + config.num_layers, + config.num_refiner_layers, + config.hidden_size, + config.num_heads, + config.num_kv_heads, + config.in_channels, + config.out_channels); return config; } }; @@ -603,7 +603,7 @@ namespace ZImage { circular_x_enabled, config.axes_dim); int pos_len = static_cast(pe_vec.size() / config.axes_dim_sum / 2); - // LOG_DEBUG("pos_len %d", pos_len); + // LOG_VERBOSE("pos_len %d", pos_len); auto pe = ggml_new_tensor_4d(compute_ctx, GGML_TYPE_F32, 2, 2, config.axes_dim_sum / 2, pos_len); // pe->data = pe_vec.data(); // print_ggml_tensor(pe, true, "pe"); @@ -689,7 +689,7 @@ namespace ZImage { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("z_image test done in %lldms", t1 - t0); + LOG_VERBOSE("z_image test done in %lldms", t1 - t0); } } diff --git a/src/model/te/clip.hpp b/src/model/te/clip.hpp index 83d2646d9..dd566e1aa 100644 --- a/src/model/te/clip.hpp +++ b/src/model/te/clip.hpp @@ -100,13 +100,13 @@ struct CLIPEncoder : public GGMLBlock { const std::string& graph_cut_prefix = "") { // x: [N, n_token, d_model] int layer_idx = n_layer - 1; - // LOG_DEBUG("clip_skip %d", clip_skip); + // LOG_VERBOSE("clip_skip %d", clip_skip); if (clip_skip > 0) { layer_idx = n_layer - clip_skip; } for (int i = 0; i < n_layer; i++) { - // LOG_DEBUG("layer %d", i); + // LOG_VERBOSE("layer %d", i); if (i == layer_idx + 1) { break; } @@ -116,7 +116,7 @@ struct CLIPEncoder : public GGMLBlock { if (!graph_cut_prefix.empty()) { sd::ggml_graph_cut::mark_graph_cut(x, graph_cut_prefix + ".layers." + std::to_string(i), "x"); } - // LOG_DEBUG("layer %d", i); + // LOG_VERBOSE("layer %d", i); } return x; } @@ -320,7 +320,7 @@ class CLIPTextModel : public GGMLBlock { if (text_projection != nullptr) { pooled = ggml_ext_linear(ctx->ggml_ctx, pooled, text_projection, nullptr); } else { - LOG_DEBUG("identity projection"); + LOG_VERBOSE("identity projection"); } return pooled; // [hidden_size, 1, 1] } diff --git a/src/model/te/llm.hpp b/src/model/te/llm.hpp index 79752d4b8..8781af0cf 100644 --- a/src/model/te/llm.hpp +++ b/src/model/te/llm.hpp @@ -319,11 +319,11 @@ namespace LLM { config.vision.deepstack_visual_indexes = {8, 16, 24}; } } - LOG_DEBUG("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64, - config.num_layers, - config.vocab_size, - config.hidden_size, - config.intermediate_size); + LOG_VERBOSE("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64, + config.num_layers, + config.vocab_size, + config.hidden_size, + config.intermediate_size); return config; } }; @@ -1887,9 +1887,9 @@ namespace LLM { enable_vision = false; } if (enable_vision) { - LOG_DEBUG("enable llm vision"); + LOG_VERBOSE("enable llm vision"); if (config.llama_cpp_style) { - LOG_DEBUG("llama.cpp style vision weight"); + LOG_VERBOSE("llama.cpp style vision weight"); } } model = LLM(config, enable_vision, config.llama_cpp_style); @@ -2375,7 +2375,7 @@ namespace LLM { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } std::vector tokens; @@ -2426,7 +2426,7 @@ namespace LLM { out = std::move(out_opt); print_sd_tensor(out, false, "image_embed"); image_embed = out; - LOG_DEBUG("llm encode_image test done in %lldms", t1 - t0); + LOG_VERBOSE("llm encode_image test done in %lldms", t1 - t0); } std::string placeholder = "<|image_pad|>"; @@ -2466,7 +2466,7 @@ namespace LLM { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("llm test done in %lldms", t1 - t0); + LOG_VERBOSE("llm test done in %lldms", t1 - t0); } else if (test_vit) { // auto image = ggml_new_tensor_3d(ctx, GGML_TYPE_F32, 280, 280, 3); // ggml_set_f32(image, 0.f); @@ -2485,7 +2485,7 @@ namespace LLM { // auto ref_out = load_tensor_from_file(ctx, "qwen2vl.bin"); // ggml_ext_tensor_diff(ref_out, out, 0.01f); - LOG_DEBUG("llm test done in %lldms", t1 - t0); + LOG_VERBOSE("llm test done in %lldms", t1 - t0); } else if (test_mistral) { std::pair prompt_attn_range; std::string text = "[SYSTEM_PROMPT]You are an AI that reasons about image descriptions. You give structured responses focusing on object relationships, object\nattribution and actions without speculation.[/SYSTEM_PROMPT][INST]"; @@ -2510,7 +2510,7 @@ namespace LLM { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("llm test done in %lldms", t1 - t0); + LOG_VERBOSE("llm test done in %lldms", t1 - t0); } else if (test_qwen3) { std::pair prompt_attn_range; std::string text = "<|im_start|>user\n"; @@ -2535,7 +2535,7 @@ namespace LLM { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("llm test done in %lldms", t1 - t0); + LOG_VERBOSE("llm test done in %lldms", t1 - t0); } else { std::pair prompt_attn_range; std::string text = "<|im_start|>system\nDescribe the image by detailing the color, shape, size, texture, quantity, text, spatial relationships of the objects and background:<|im_end|>\n<|im_start|>user\n"; @@ -2560,7 +2560,7 @@ namespace LLM { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("llm test done in %lldms", t1 - t0); + LOG_VERBOSE("llm test done in %lldms", t1 - t0); } } diff --git a/src/model/te/t5.hpp b/src/model/te/t5.hpp index f9f643f92..e676dc210 100644 --- a/src/model/te/t5.hpp +++ b/src/model/te/t5.hpp @@ -554,7 +554,7 @@ struct T5Embedder { ss << "['" << item.first << "', " << item.second << "], "; } ss << "]"; - LOG_DEBUG("parse '%s' to %s", text.c_str(), ss.str().c_str()); + LOG_VERBOSE("parse '%s' to %s", text.c_str(), ss.str().c_str()); } std::vector tokens; @@ -612,7 +612,7 @@ struct T5Embedder { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("t5 test done in %lldms", t1 - t0); + LOG_VERBOSE("t5 test done in %lldms", t1 - t0); } } diff --git a/src/model/upscaler/esrgan.hpp b/src/model/upscaler/esrgan.hpp index be02fb70c..21214b5ca 100644 --- a/src/model/upscaler/esrgan.hpp +++ b/src/model/upscaler/esrgan.hpp @@ -74,13 +74,13 @@ struct ESRGANConfig { } if (has_model_tensor || has_conv_up1 || has_conv_up2) { - LOG_DEBUG("esrgan: scale = %d, num_block = %d, num_in_ch = %d, num_out_ch = %d, num_feat = %d, num_grow_ch = %d", - config.scale, - config.num_block, - config.num_in_ch, - config.num_out_ch, - config.num_feat, - config.num_grow_ch); + LOG_VERBOSE("esrgan: scale = %d, num_block = %d, num_in_ch = %d, num_out_ch = %d, num_feat = %d, num_grow_ch = %d", + config.scale, + config.num_block, + config.num_in_ch, + config.num_out_ch, + config.num_feat, + config.num_grow_ch); } return config; } diff --git a/src/model/upscaler/ltx_latent_upscaler.hpp b/src/model/upscaler/ltx_latent_upscaler.hpp index 388799b0d..48a8ba34c 100644 --- a/src/model/upscaler/ltx_latent_upscaler.hpp +++ b/src/model/upscaler/ltx_latent_upscaler.hpp @@ -115,13 +115,13 @@ namespace LTXVUpsampler { } if (inferred) { - LOG_DEBUG("ltx latent upsampler: in_channels = %" PRId64 ", mid_channels = %" PRId64 ", num_blocks_per_stage = %d, spatial_scale = %.3f, temporal_up_factor = %d, rational_resampler = %d", - config.in_channels, - config.mid_channels, - config.num_blocks_per_stage, - config.spatial_scale, - config.temporal_up_factor, - config.rational_resampler); + LOG_VERBOSE("ltx latent upsampler: in_channels = %" PRId64 ", mid_channels = %" PRId64 ", num_blocks_per_stage = %d, spatial_scale = %.3f, temporal_up_factor = %d, rational_resampler = %d", + config.in_channels, + config.mid_channels, + config.num_blocks_per_stage, + config.spatial_scale, + config.temporal_up_factor, + config.rational_resampler); } return config; } diff --git a/src/model/vae/auto_encoder_kl.hpp b/src/model/vae/auto_encoder_kl.hpp index bf0a0381f..bc00ddd8d 100644 --- a/src/model/vae/auto_encoder_kl.hpp +++ b/src/model/vae/auto_encoder_kl.hpp @@ -864,7 +864,7 @@ struct AutoEncoderKL : public VAE { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("encode test done in %lldms", t1 - t0); + LOG_VERBOSE("encode test done in %lldms", t1 - t0); } if (false) { @@ -884,7 +884,7 @@ struct AutoEncoderKL : public VAE { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("decode test done in %lldms", t1 - t0); + LOG_VERBOSE("decode test done in %lldms", t1 - t0); } }; }; diff --git a/src/model/vae/ltx_audio_vae.hpp b/src/model/vae/ltx_audio_vae.hpp index 95ad01ceb..d265b4ed5 100644 --- a/src/model/vae/ltx_audio_vae.hpp +++ b/src/model/vae/ltx_audio_vae.hpp @@ -172,12 +172,12 @@ namespace LTXV { if (config.audio_channels != 2 || config.latent_channels != 8 || config.mel_bins != 64) { return config; } - LOG_DEBUG("ltx_audio_vae: sample_rate = %d, mel_bins = %d, latent_channels = %d, latent_frequency_bins = %d, has_bwe = %s", - config.sample_rate, - config.mel_bins, - config.latent_channels, - config.latent_frequency_bins, - config.has_bwe ? "true" : "false"); + LOG_VERBOSE("ltx_audio_vae: sample_rate = %d, mel_bins = %d, latent_channels = %d, latent_frequency_bins = %d, has_bwe = %s", + config.sample_rate, + config.mel_bins, + config.latent_channels, + config.latent_frequency_bins, + config.has_bwe ? "true" : "false"); return config; } }; @@ -1063,7 +1063,7 @@ namespace LTXV { GGML_ASSERT(!out.empty()); print_sd_tensor(out, false, "ltx_audio_vae_out"); - LOG_DEBUG("ltx audio vae test done in %lldms", t1 - t0); + LOG_VERBOSE("ltx audio vae test done in %lldms", t1 - t0); } static void load_from_file_and_test(const std::string& model_path, diff --git a/src/model/vae/ltx_vae.hpp b/src/model/vae/ltx_vae.hpp index 53971d935..64805116c 100644 --- a/src/model/vae/ltx_vae.hpp +++ b/src/model/vae/ltx_vae.hpp @@ -1126,11 +1126,11 @@ namespace LTXVAE { overlap, window); overlap = window - 1; } - LOG_DEBUG("Using temporal tiling: temporal_tile_frames = %d, temporal_tile_overlap = %d, total frames = %d, resulting in %d tiles", - window, - overlap, - (int)T, - (T + window - overlap - 1) / (window - overlap)); + LOG_VERBOSE("Using temporal tiling: temporal_tile_frames = %d, temporal_tile_overlap = %d, total frames = %d, resulting in %d tiles", + window, + overlap, + (int)T, + (T + window - overlap - 1) / (window - overlap)); ggml_tensor* out = nullptr; for (int i = 0; i < (int)T - overlap; i += (window - overlap)) { int feat_idx = 0; @@ -1327,21 +1327,21 @@ struct LTXVideoVAE : public VAE { const int64_t total_frames = input.shape()[2]; auto plan = make_vae_temporal_tile_plan(total_frames, config); - LOG_DEBUG("Using streaming temporal tiling: temporal_tile_frames=%d, temporal_tile_overlap=%d, total latent frames=%lld, resulting in %d tiles", - plan.tile_frames, - plan.overlap, - (long long)total_frames, - (int)plan.tiles.size()); + LOG_VERBOSE("Using streaming temporal tiling: temporal_tile_frames=%d, temporal_tile_overlap=%d, total latent frames=%lld, resulting in %d tiles", + plan.tile_frames, + plan.overlap, + (long long)total_frames, + (int)plan.tiles.size()); free_cache_ctx_and_buffer(); auto output = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor& z_chunk, const VAETemporalTile& tile) { - LOG_DEBUG("LTX VAE temporal tile %lld/%d: latent frames [%lld, %lld), overlap=%d", - (long long)tile.index + 1, - (int)plan.tiles.size(), - (long long)tile.start, - (long long)tile.end, - tile.overlap); + LOG_VERBOSE("LTX VAE temporal tile %lld/%d: latent frames [%lld, %lld), overlap=%d", + (long long)tile.index + 1, + (int)plan.tiles.size(), + (long long)tile.start, + (long long)tile.end, + tile.overlap); auto get_graph = [&]() -> ggml_cgraph* { return build_temporal_tile_graph(z_chunk, @@ -1465,7 +1465,7 @@ struct LTXVideoVAE : public VAE { GGML_ASSERT(!out.empty()); print_sd_tensor(out, false, "ltx_vae_out"); - LOG_DEBUG("ltx vae test done in %lldms", t1 - t0); + LOG_VERBOSE("ltx vae test done in %lldms", t1 - t0); } static void load_from_file_and_test(const std::string& model_path, diff --git a/src/model/vae/tae.hpp b/src/model/vae/tae.hpp index caa580fca..27fe70a2f 100644 --- a/src/model/vae/tae.hpp +++ b/src/model/vae/tae.hpp @@ -65,7 +65,7 @@ class TAEBlock : public UnaryBlock { if (n_in != n_out) { auto skip = std::dynamic_pointer_cast(blocks["skip"]); - LOG_DEBUG("skip"); + LOG_VERBOSE("skip"); x = skip->forward(ctx, x); } diff --git a/src/model/vae/vae.hpp b/src/model/vae/vae.hpp index 758fb5ee8..c0eceac4d 100644 --- a/src/model/vae/vae.hpp +++ b/src/model/vae/vae.hpp @@ -54,23 +54,23 @@ struct VAE : public GGMLRunner { } auto plan = make_vae_temporal_tile_plan(input.shape()[2], resolved_config); - LOG_DEBUG("%s temporal tiling: tile_frames=%d, overlap=%d, total_frames=%lld, tiles=%d", - get_desc().c_str(), - plan.tile_frames, - plan.overlap, - (long long)input.shape()[2], - (int)plan.tiles.size()); + LOG_VERBOSE("%s temporal tiling: tile_frames=%d, overlap=%d, total_frames=%lld, tiles=%d", + get_desc().c_str(), + plan.tile_frames, + plan.overlap, + (long long)input.shape()[2], + (int)plan.tiles.size()); return process_vae_temporal_tiles_blended( input, plan, output_scale, [&](const sd::Tensor& input_tile, const VAETemporalTile& tile) { - LOG_DEBUG("%s temporal tile %d/%d: input frames [%lld, %lld)", - get_desc().c_str(), - tile.index + 1, - (int)plan.tiles.size(), - (long long)tile.start, - (long long)tile.end); + LOG_VERBOSE("%s temporal tile %d/%d: input frames [%lld, %lld)", + get_desc().c_str(), + tile.index + 1, + (int)plan.tiles.size(), + (long long)tile.start, + (long long)tile.end); return _compute(n_threads, input_tile, true); }); } @@ -230,7 +230,7 @@ struct VAE : public GGMLRunner { const float encode_tile_factor = sd_version_is_minimax_h3(version) ? 1.f : (sd_version_is_wan(version) || sd_version_is_hunyuan_video(version) || sd_version_is_ltxav(version)) ? 1.30539f : 2.0f; get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, tiling_params, W, H, encode_tile_factor); - LOG_DEBUG("VAE Tile size: %dx%d", tile_size_x, tile_size_y); + LOG_VERBOSE("VAE Tile size: %dx%d", tile_size_x, tile_size_y); output = tiled_compute(input, n_threads, static_cast(W), @@ -258,7 +258,7 @@ struct VAE : public GGMLRunner { return {}; } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing vae encode graph completed, taking %.2fs", (t1 - t0) * 1.0f / 1000); + LOG_VERBOSE("computing vae encode graph completed, taking %.2fs", (t1 - t0) * 1.0f / 1000); return std::move(output); } @@ -281,7 +281,7 @@ struct VAE : public GGMLRunner { int tile_size_x, tile_size_y; get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, tiling_params, input.shape()[0], input.shape()[1]); if (!silent) { - LOG_DEBUG("VAE Tile size: %dx%d", tile_size_x, tile_size_y); + LOG_VERBOSE("VAE Tile size: %dx%d", tile_size_x, tile_size_y); } output = tiled_compute( input, @@ -315,7 +315,7 @@ struct VAE : public GGMLRunner { scale_tensor_to_0_1(&output); } int64_t t1 = ggml_time_ms(); - LOG_DEBUG("computing vae decode graph completed, taking %.2fs", (t1 - t0) * 1.0f / 1000); + LOG_VERBOSE("computing vae decode graph completed, taking %.2fs", (t1 - t0) * 1.0f / 1000); return std::move(output); } diff --git a/src/model/vae/wan_vae.hpp b/src/model/vae/wan_vae.hpp index 517b49c97..9cb115c48 100644 --- a/src/model/vae/wan_vae.hpp +++ b/src/model/vae/wan_vae.hpp @@ -1278,7 +1278,7 @@ namespace WAN { } } if (is_2D) { - LOG_DEBUG("USING 2D VAE"); + LOG_VERBOSE("USING 2D VAE"); } ae = WanVAE(decode_only, version, is_2D); ae.init(params_ctx, tensor_storage_map, prefix); @@ -1409,20 +1409,20 @@ namespace WAN { stateful_config.overlap = 0; auto plan = make_vae_temporal_tile_plan(input.shape()[2], stateful_config); - LOG_DEBUG("Wan VAE stateful temporal tiling: tile_frames=%d, total latent frames=%lld, tiles=%d", - plan.tile_frames, - (long long)input.shape()[2], - (int)plan.tiles.size()); + LOG_VERBOSE("Wan VAE stateful temporal tiling: tile_frames=%d, total latent frames=%lld, tiles=%d", + plan.tile_frames, + (long long)input.shape()[2], + (int)plan.tiles.size()); free_cache_ctx_and_buffer(); ae.clear_cache(); auto output = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor& input_tile, const VAETemporalTile& tile) { - LOG_DEBUG("Wan VAE temporal tile %d/%d: latent frames [%lld, %lld)", - tile.index + 1, - (int)plan.tiles.size(), - (long long)tile.start, - (long long)tile.end); + LOG_VERBOSE("Wan VAE temporal tile %d/%d: latent frames [%lld, %lld)", + tile.index + 1, + (int)plan.tiles.size(), + (long long)tile.start, + (long long)tile.end); auto get_graph = [&]() -> ggml_cgraph* { return build_temporal_tile_graph(input_tile, static_cast(tile.start)); }; @@ -1479,7 +1479,7 @@ namespace WAN { GGML_ASSERT(!out_opt.empty()); out = std::move(out_opt); print_sd_tensor(out); - LOG_DEBUG("decode test done in %ldms", t1 - t0); + LOG_VERBOSE("decode test done in %ldms", t1 - t0); } }; diff --git a/src/model_io/gguf_reader_ext.h b/src/model_io/gguf_reader_ext.h index 7da20d0a5..7b372e4f5 100644 --- a/src/model_io/gguf_reader_ext.h +++ b/src/model_io/gguf_reader_ext.h @@ -77,7 +77,7 @@ class GGUFReader { if (align_val != 0 && (align_val & (align_val - 1)) == 0) { alignment_ = align_val; - LOG_DEBUG("Found alignment: %zu", alignment_); + LOG_VERBOSE("Found alignment: %zu", alignment_); } else { LOG_ERROR("Invalid alignment value %u, fallback to default %zu", align_val, alignment_); } @@ -197,8 +197,8 @@ class GGUFReader { if (!safe_read(fin, metadata_kv_count)) return false; - LOG_DEBUG("GGUF v%u, tensor_count=%llu, metadata_kv_count=%llu", - version, (unsigned long long)tensor_count, (unsigned long long)metadata_kv_count); + LOG_VERBOSE("GGUF v%u, tensor_count=%llu, metadata_kv_count=%llu", + version, (unsigned long long)tensor_count, (unsigned long long)metadata_kv_count); // --- Read Metadata --- for (uint64_t i = 0; i < metadata_kv_count; i++) { diff --git a/src/model_io/safetensors_io.cpp b/src/model_io/safetensors_io.cpp index 1d1269488..dfcb4a929 100644 --- a/src/model_io/safetensors_io.cpp +++ b/src/model_io/safetensors_io.cpp @@ -237,7 +237,7 @@ bool read_safetensors_file(const std::string& file_path, for (auto& item : header_.items()) { std::string name = item.key(); nlohmann::json tensor_info = item.value(); - // LOG_DEBUG("%s %s\n", name.c_str(), tensor_info.dump().c_str()); + // LOG_VERBOSE("%s %s\n", name.c_str(), tensor_info.dump().c_str()); if (name == "__metadata__") { continue; @@ -350,7 +350,7 @@ bool read_safetensors_file(const std::string& file_path, tensor_storages.push_back(tensor_storage); - // LOG_DEBUG("%s %s", tensor_storage.to_string().c_str(), dtype.c_str()); + // LOG_VERBOSE("%s %s", tensor_storage.to_string().c_str(), dtype.c_str()); } return true; diff --git a/src/model_loader.cpp b/src/model_loader.cpp index dc2bb4bf0..9252240b6 100644 --- a/src/model_loader.cpp +++ b/src/model_loader.cpp @@ -165,7 +165,7 @@ void ModelLoader::add_tensor_storage(const TensorStorage& tensor_storage) { void ModelLoader::set_n_threads(int n_threads) { n_threads_ = n_threads > 0 ? n_threads : sd_get_num_physical_cores(); - LOG_DEBUG("using %d threads for model loading", n_threads_); + LOG_VERBOSE("using %d threads for model loading", n_threads_); } bool ModelLoader::init_from_file(const std::string& file_path, const std::string& prefix) { @@ -203,7 +203,7 @@ void ModelLoader::convert_tensors_name() { for (auto& [_, tensor_storage] : tensor_storage_map) { auto new_name = convert_tensor_name(tensor_storage.name, version); - // LOG_DEBUG("%s -> %s", tensor_storage.name.c_str(), new_name.c_str()); + // LOG_VERBOSE("%s -> %s", tensor_storage.name.c_str(), new_name.c_str()); tensor_storage.name = new_name; new_map[new_name] = std::move(tensor_storage); } @@ -225,7 +225,7 @@ bool ModelLoader::init_from_file_and_convert_name(const std::string& file_path, /*================================================= GGUFModelLoader ==================================================*/ bool ModelLoader::init_from_gguf_file(const std::string& file_path, const std::string& prefix) { - LOG_DEBUG("init from '%s'", file_path.c_str()); + LOG_VERBOSE("init from '%s'", file_path.c_str()); std::vector tensor_storages; std::string error; @@ -237,7 +237,7 @@ bool ModelLoader::init_from_gguf_file(const std::string& file_path, const std::s size_t file_index = add_file_path(file_path); for (auto& tensor_storage : tensor_storages) { - // LOG_DEBUG("%s", tensor_storage.name.c_str()); + // LOG_VERBOSE("%s", tensor_storage.name.c_str()); if (!starts_with(tensor_storage.name, prefix)) { tensor_storage.name = prefix + tensor_storage.name; @@ -253,7 +253,7 @@ bool ModelLoader::init_from_gguf_file(const std::string& file_path, const std::s /*================================================= SafeTensorsModelLoader ==================================================*/ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const std::string& prefix) { - LOG_DEBUG("init from '%s', prefix = '%s'", file_path.c_str(), prefix.c_str()); + LOG_VERBOSE("init from '%s', prefix = '%s'", file_path.c_str(), prefix.c_str()); std::vector tensor_storages; std::string error; @@ -276,14 +276,14 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const add_tensor_storage(tensor_storage); - // LOG_DEBUG("%s", tensor_storage.to_string().c_str()); + // LOG_VERBOSE("%s", tensor_storage.to_string().c_str()); } return true; } bool ModelLoader::init_from_safetensors_index_file(const std::string& file_path, const std::string& prefix) { - LOG_DEBUG("init from safetensors index '%s', prefix = '%s'", file_path.c_str(), prefix.c_str()); + LOG_VERBOSE("init from safetensors index '%s', prefix = '%s'", file_path.c_str(), prefix.c_str()); std::vector shard_paths; std::string error; @@ -304,7 +304,7 @@ bool ModelLoader::init_from_safetensors_index_file(const std::string& file_path, /*================================================= TorchLegacyModelLoader ==================================================*/ bool ModelLoader::init_from_torch_legacy_file(const std::string& file_path, const std::string& prefix) { - LOG_DEBUG("init from torch legacy '%s'", file_path.c_str()); + LOG_VERBOSE("init from torch legacy '%s'", file_path.c_str()); std::vector tensor_storages; std::string error; @@ -336,7 +336,7 @@ bool ModelLoader::init_from_torch_legacy_file(const std::string& file_path, cons /*================================================= TorchZipModelLoader ==================================================*/ bool ModelLoader::init_from_torch_zip_file(const std::string& file_path, const std::string& prefix) { - LOG_DEBUG("init from '%s'", file_path.c_str()); + LOG_VERBOSE("init from '%s'", file_path.c_str()); std::vector tensor_storages; std::string error; @@ -355,7 +355,7 @@ bool ModelLoader::init_from_torch_zip_file(const std::string& file_path, const s add_tensor_storage(tensor_storage); - // LOG_DEBUG("%s", tensor_storage.to_string().c_str()); + // LOG_VERBOSE("%s", tensor_storage.to_string().c_str()); } return true; @@ -382,7 +382,7 @@ bool ModelLoader::init_from_diffusers_file(const std::string& file_path, const s // return false; } if (!init_from_safetensors_file(clip_g_path, "te.1.")) { - LOG_DEBUG("Couldn't find working second text encoder in %s", file_path.c_str()); + LOG_VERBOSE("Couldn't find working second text encoder in %s", file_path.c_str()); } return true; } @@ -546,7 +546,7 @@ SDVersion ModelLoader::get_sd_version() { } } if (is_wan) { - LOG_DEBUG("patch_embedding_channels %d", patch_embedding_channels); + LOG_VERBOSE("patch_embedding_channels %d", patch_embedding_channels); if (patch_embedding_channels == 184320 && !has_img_emb) { return VERSION_WAN2_2_I2V; } @@ -803,7 +803,7 @@ void ModelLoader::process_model_files(bool enable_mmap, bool writable_mmap) { fdata.tensors = std::move(file_tensors); if (enable_mmap && !is_zip) { - LOG_DEBUG("using mmap for I/O"); + LOG_VERBOSE("using mmap for I/O"); std::unique_ptr mmapped = MmapWrapper::create(file_path, writable_mmap); if (mmapped) { uint8_t* mmap_data = static_cast(mmapped->writable_data()); @@ -835,7 +835,7 @@ std::vector ModelLoader::mmap_tensors(std::map& tensors, std::mutex tensor_names_mutex; auto on_new_tensor_cb = [&](const TensorStorage& tensor_storage, ggml_tensor** dst_tensor) -> bool { const std::string& name = tensor_storage.name; - // LOG_DEBUG("%s", tensor_storage.to_string().c_str()); + // LOG_VERBOSE("%s", tensor_storage.to_string().c_str()); { std::lock_guard lock(tensor_names_mutex); tensor_names_in_file.insert(name); diff --git a/src/model_manager.cpp b/src/model_manager.cpp index e7c52af49..166030a5c 100644 --- a/src/model_manager.cpp +++ b/src/model_manager.cpp @@ -421,11 +421,11 @@ bool ModelManager::load_tensors_to_params_backend(const std::vector& states, initialized->data = nullptr; initialized->extra = nullptr; } - LOG_DEBUG("model manager releasing params backend buffer (%6.2f MB, %zu tensors, %s)", - ggml_backend_buffer_get_size(buffer) / (1024.f * 1024.f), - initialized_tensors.size(), - ggml_backend_buffer_is_host(buffer) ? "RAM" : "VRAM"); + LOG_VERBOSE("model manager releasing params backend buffer (%6.2f MB, %zu tensors, %s)", + ggml_backend_buffer_get_size(buffer) / (1024.f * 1024.f), + initialized_tensors.size(), + ggml_backend_buffer_is_host(buffer) ? "RAM" : "VRAM"); ggml_backend_buffer_free(buffer); return false; } @@ -1107,11 +1107,11 @@ void ModelManager::release_params_storage_blocks(bool force, } } for (const auto& entry : released) { - LOG_DEBUG("model manager released params backend buffers (%6.2f MB, %zu tensors, %zu blocks, %s) from %s", - entry.second.bytes / (1024.f * 1024.f), - entry.second.tensors, entry.second.blocks, - ggml_backend_buft_is_host(entry.first) ? "RAM" : "VRAM", - ggml_backend_buft_name(entry.first)); + LOG_VERBOSE("model manager released params backend buffers (%6.2f MB, %zu tensors, %zu blocks, %s) from %s", + entry.second.bytes / (1024.f * 1024.f), + entry.second.tensors, entry.second.blocks, + ggml_backend_buft_is_host(entry.first) ? "RAM" : "VRAM", + ggml_backend_buft_name(entry.first)); } } diff --git a/src/name_conversion.cpp b/src/name_conversion.cpp index 7e528c77c..d0ff45c8e 100644 --- a/src/name_conversion.cpp +++ b/src/name_conversion.cpp @@ -1448,7 +1448,7 @@ std::string convert_tensor_name(std::string name, SDVersion version) { } } - // LOG_DEBUG("name %s %d", name.c_str(), version); + // LOG_VERBOSE("name %s %d", name.c_str(), version); if (sd_version_is_unet(version) || is_underline || is_lycoris_underline) { name = convert_sep_to_dot(name); diff --git a/src/runtime/denoiser.hpp b/src/runtime/denoiser.hpp index b6f1843ec..c094fbd18 100644 --- a/src/runtime/denoiser.hpp +++ b/src/runtime/denoiser.hpp @@ -311,7 +311,7 @@ struct BetaScheduler : SigmaScheduler { explicit BetaScheduler(const char* extra_sample_args = nullptr) { parse_extra_sample_args(extra_sample_args); - LOG_DEBUG("Beta scheduler: alpha=%.4f, beta=%.4f", alpha, beta); + LOG_VERBOSE("Beta scheduler: alpha=%.4f, beta=%.4f", alpha, beta); } void parse_extra_sample_args(const char* extra_sample_args) { @@ -692,7 +692,7 @@ struct LTX2Scheduler : SigmaScheduler { float exp_shift = std::exp(sigma_shift); float target_terminal = std::clamp(terminal, 0.0f, 0.99f); - LOG_DEBUG("LTX2 scheduler: tokens=%d, shift=%.4f, stretch=%d, terminal=%.4f", token_count, sigma_shift, stretch ? 1 : 0, target_terminal); + LOG_VERBOSE("LTX2 scheduler: tokens=%d, shift=%.4f, stretch=%d, terminal=%.4f", token_count, sigma_shift, stretch ? 1 : 0, target_terminal); sigmas.reserve(n + 1); for (uint32_t i = 0; i <= n; ++i) { @@ -760,7 +760,7 @@ struct FluxScheduler : SigmaScheduler { sigmas.reserve(n + 1); float mu = compute_mu(); - LOG_DEBUG("Flux scheduler: image_seq_len=%d, steps=%u, mu=%.3f", image_seq_len, n, mu); + LOG_VERBOSE("Flux scheduler: image_seq_len=%d, steps=%u, mu=%.3f", image_seq_len, n, mu); if (n == 0) { sigmas.push_back(1.0f); @@ -811,7 +811,7 @@ struct Flux2Scheduler : SigmaScheduler { sigmas.reserve(n + 1); float mu = compute_empirical_mu(image_seq_len, n); - LOG_DEBUG("Flux2 scheduler: image_seq_len=%d, steps=%u, mu=%.3f", image_seq_len, n, mu); + LOG_VERBOSE("Flux2 scheduler: image_seq_len=%d, steps=%u, mu=%.3f", image_seq_len, n, mu); if (n == 0) { sigmas.push_back(1.0f); @@ -1413,8 +1413,8 @@ struct SefiFlowDenoiser : public FluxFlowDenoiser { sem_sigmas.push_back(sigma_sem); tex_sigmas.push_back(sigma_tex); } - LOG_DEBUG("SefiFlowDenoiser: built %u-step dual schedule (alpha=%.2f delta_t=%.2f)", - n, timestep_shift_alpha, delta_t); + LOG_VERBOSE("SefiFlowDenoiser: built %u-step dual schedule (alpha=%.2f delta_t=%.2f)", + n, timestep_shift_alpha, delta_t); return tex_sigmas; } }; @@ -2690,7 +2690,7 @@ static sd::Tensor sample_lms(denoise_cb_t model, int steps = static_cast(sigmas.size()) - 1; max_order = std::min(max_order, steps); // history can not be larger than steps - LOG_DEBUG("linear multi-step sampler: lms_max_order = %i, lms_shift = %i, lms_divisions = %i", max_order, shift, divisions); + LOG_VERBOSE("linear multi-step sampler: lms_max_order = %i, lms_shift = %i, lms_divisions = %i", max_order, shift, divisions); std::vector lms_coeff(max_order); std::vector> hist = {}; @@ -2793,7 +2793,7 @@ static sd::Tensor sample_gradient_estimation(denoise_cb_t model, LOG_WARN("ignoring invalid euler_ge extra sample arg '%s=%s'", key.c_str(), value.c_str()); continue; } - LOG_DEBUG("setting euler_ge gamma to %.2f", parsed); + LOG_VERBOSE("setting euler_ge gamma to %.2f", parsed); ge_gamma = parsed; } } diff --git a/src/stable-diffusion.cpp b/src/stable-diffusion.cpp index c0ba9ebd0..4a5feee88 100644 --- a/src/stable-diffusion.cpp +++ b/src/stable-diffusion.cpp @@ -709,7 +709,7 @@ class StableDiffusionGGML { } file_alphas_cumprod = std::move(loaded_alphas); - LOG_DEBUG("loaded alphas_cumprod from model file"); + LOG_VERBOSE("loaded alphas_cumprod from model file"); } bool init_model_loader(ModelLoader& model_loader, @@ -968,7 +968,7 @@ class StableDiffusionGGML { LOG_INFO("Diffusion model weight type stat: %s", wtype_stat_to_str(diffusion_model_wtype_stat).c_str()); LOG_INFO("VAE weight type stat: %s", wtype_stat_to_str(vae_wtype_stat).c_str()); - LOG_DEBUG("ggml tensor size = %d bytes", (int)sizeof(ggml_tensor)); + LOG_VERBOSE("ggml tensor size = %d bytes", (int)sizeof(ggml_tensor)); bool have_int8_tensorwise = false; for (const auto& [_, tensor_storage] : model_loader.get_tensor_storage_map()) { @@ -1650,7 +1650,7 @@ class StableDiffusionGGML { } } - LOG_DEBUG("validating model metadata"); + LOG_VERBOSE("validating model metadata"); std::set ignore_tensors; if (use_tae && !tae_preview_only) { @@ -1707,9 +1707,9 @@ class StableDiffusionGGML { LOG_ERROR("model params eager load failed"); return false; } - LOG_DEBUG("model metadata validated; weights pre-loaded to params backend"); + LOG_VERBOSE("model metadata validated; weights pre-loaded to params backend"); } else { - LOG_DEBUG("model metadata validated; weights will be prepared lazily"); + LOG_VERBOSE("model metadata validated; weights will be prepared lazily"); } { @@ -1939,7 +1939,7 @@ class StableDiffusionGGML { double result = static_cast((out - x_t).mean()); int64_t t1 = ggml_time_ms(); - LOG_DEBUG("check is_using_v_parameterization_for_sd2, taking %.2fs", (t1 - t0) * 1.0f / 1000); + LOG_VERBOSE("check is_using_v_parameterization_for_sd2, taking %.2fs", (t1 - t0) * 1.0f / 1000); return result < -1; } @@ -1954,7 +1954,7 @@ class StableDiffusionGGML { return nullptr; } if (lora_spec.is_high_noise) { - LOG_DEBUG("high noise lora: %s", lora_spec.path.c_str()); + LOG_VERBOSE("high noise lora: %s", lora_spec.path.c_str()); } auto lora = std::make_shared(lora_log_id(lora_spec), backend_for(module), @@ -2128,7 +2128,7 @@ class StableDiffusionGGML { if (loras[i].is_high_noise) { lora_id = "|high_noise|" + lora_id; } - LOG_DEBUG("lora %s:%.2f", lora_id.c_str(), loras[i].multiplier); + LOG_VERBOSE("lora %s:%.2f", lora_id.c_str(), loras[i].multiplier); } for (auto& extension : generation_extensions) { @@ -2424,7 +2424,7 @@ class StableDiffusionGGML { float shifted_t_float = t * (float(shifted_timestep) / float(TIMESTEPS)); int64_t shifted_t = static_cast(roundf(shifted_t_float)); shifted_t = std::max((int64_t)0, std::min((int64_t)(TIMESTEPS - 1), shifted_t)); - LOG_DEBUG("shifting timestep from %.2f to %" PRId64 " (sigma: %.4f)", t, shifted_t, sigma); + LOG_VERBOSE("shifting timestep from %.2f to %" PRId64 " (sigma: %.4f)", t, shifted_t, sigma); return std::vector{(float)shifted_t}; } if (sd_version_is_anima(version)) { @@ -2585,7 +2585,7 @@ class StableDiffusionGGML { } } schedule_str += "]"; - LOG_DEBUG("using guidance schedule: %s", schedule_str.c_str()); + LOG_VERBOSE("using guidance schedule: %s", schedule_str.c_str()); } sd_sample::SampleCacheRuntime cache_runtime = sd_sample::init_sample_cache_runtime(version, @@ -2642,7 +2642,7 @@ class StableDiffusionGGML { auto denoise = [&](const sd::Tensor& x, float sigma, int step) -> sd::guidance::GuiderOutput { if (get_cancel_flag() == SD_CANCEL_ALL) { - LOG_DEBUG("cancelling generation"); + LOG_VERBOSE("cancelling generation"); return {}; } @@ -2848,7 +2848,7 @@ class StableDiffusionGGML { } const std::vector* uncond_skip_layers = nullptr; if (is_skiplayer_step && slg_uncond) { - LOG_DEBUG("Skipping layers at uncond step %d\n", step); + LOG_VERBOSE("Skipping layers at uncond step %d\n", step); uncond_skip_layers = &skip_layer_guidance.layers(); } uncond_out = run_condition(uncond, @@ -2883,7 +2883,7 @@ class StableDiffusionGGML { } if (is_skiplayer_step && slg_scale != 0.0f) { - LOG_DEBUG("Skipping layers at step %d\n", step); + LOG_VERBOSE("Skipping layers at step %d\n", step); if (!step_cache.is_step_skipped()) { guidance_input.predict_skip_layer = [&]() -> sd::Tensor { return run_condition(cond, @@ -4392,7 +4392,7 @@ struct SamplePlan { break; } } - LOG_DEBUG("switching from high noise model at step %d", high_noise_sample_steps); + LOG_VERBOSE("switching from high noise model at step %d", high_noise_sample_steps); } LOG_INFO("sampling using %s method", sampling_methods_str[sample_method]); @@ -4969,7 +4969,7 @@ static std::optional prepare_image_generation_latents(sd t_enc--; } } else { - LOG_DEBUG("Interpreting denoise strength as relative noise level"); + LOG_VERBOSE("Interpreting denoise strength as relative noise level"); // assume x_noised = K * (x * (1-noise_level) + noise * noise_level) = K * lerp(x, noise, noise_level) // K = 1, noise_level = sigma for flow models // K = 1+sigma, noise_level=sigma/(1+sigma) for diffusion models @@ -4993,7 +4993,7 @@ static std::optional prepare_image_generation_latents(sd sigma_sched.assign(plan->sigmas.begin() + plan->sample_steps - t_enc - 1, plan->sigmas.end()); if (target_sigma > 0 && force_first_sigma && strength_as_noise_level) { - LOG_DEBUG("force_first_sigma to %.4f (from %.4f)", target_sigma, sigma_sched[0]); + LOG_VERBOSE("force_first_sigma to %.4f (from %.4f)", target_sigma, sigma_sched[0]); sigma_sched[0] = target_sigma; } @@ -5095,7 +5095,7 @@ static std::optional prepare_image_generation_latents(sd } sd::Tensor ref_latent; if (ref_image_params.resize_before_vae && !sd_version_is_pid(sd_ctx->sd->version)) { - LOG_DEBUG("auto resize ref images"); + LOG_VERBOSE("auto resize ref images"); double vae_width; double vae_height; if (ref_image_params.resize_vae_to_target) { @@ -5118,12 +5118,12 @@ static std::optional prepare_image_generation_latents(sd ref_images[i].shape()[2], ref_images[i].shape()[3]}); - LOG_DEBUG("resize vae ref image %d from %" PRId64 "x%" PRId64 " to %" PRId64 "x%" PRId64, - static_cast(i), - ref_images[i].shape()[1], - ref_images[i].shape()[0], - resized_ref_img.shape()[1], - resized_ref_img.shape()[0]); + LOG_VERBOSE("resize vae ref image %d from %" PRId64 "x%" PRId64 " to %" PRId64 "x%" PRId64, + static_cast(i), + ref_images[i].shape()[1], + ref_images[i].shape()[0], + resized_ref_img.shape()[1], + resized_ref_img.shape()[0]); ref_latent = sd_ctx->sd->encode_first_stage(resized_ref_img); } else { @@ -6595,11 +6595,11 @@ static sd_image_t* decode_video_outputs(sd_ctx_t* sd_ctx, video_latent.shape()[3] > sd_ctx->sd->get_latent_channel()) { video_latent = sd::ops::slice(video_latent, 3, 0, sd_ctx->sd->get_latent_channel()); } - LOG_DEBUG("decode_video_outputs latent %dx%dx%dx%d", - (int)video_latent.shape()[0], - (int)video_latent.shape()[1], - (int)video_latent.shape()[2], - (int)video_latent.shape()[3]); + LOG_VERBOSE("decode_video_outputs latent %dx%dx%dx%d", + (int)video_latent.shape()[0], + (int)video_latent.shape()[1], + (int)video_latent.shape()[2], + (int)video_latent.shape()[3]); // auto z = sd::load_tensor_from_file_as_tensor("ltx_vae_z.bin"); int64_t t4 = ggml_time_ms(); sd::Tensor vid = sd_ctx->sd->decode_first_stage(video_latent, true); @@ -6609,11 +6609,11 @@ static sd_image_t* decode_video_outputs(sd_ctx_t* sd_ctx, LOG_ERROR("decode_first_stage failed for video"); return nullptr; } - LOG_DEBUG("decode_video_outputs decoded %dx%dx%dx%d", - (int)vid.shape()[0], - (int)vid.shape()[1], - (int)vid.shape()[2], - (int)vid.shape()[3]); + LOG_VERBOSE("decode_video_outputs decoded %dx%dx%dx%d", + (int)vid.shape()[0], + (int)vid.shape()[1], + (int)vid.shape()[2], + (int)vid.shape()[3]); if (request.frames > 0 && vid.shape()[2] > request.frames) { vid = sd::ops::slice(vid, 2, 0, request.frames); @@ -6954,7 +6954,7 @@ SD_API bool generate_video(sd_ctx_t* sd_ctx, LOG_ERROR("cancelling generation before high-noise sampling"); return false; } - LOG_DEBUG("sample(high noise) %dx%dx%d", W, H, T); + LOG_VERBOSE("sample(high noise) %dx%dx%d", W, H, T); int64_t sampling_start = ggml_time_ms(); std::vector high_noise_sigmas(plan.sigmas.begin(), plan.sigmas.begin() + plan.high_noise_sample_steps + 1); @@ -7001,7 +7001,7 @@ SD_API bool generate_video(sd_ctx_t* sd_ctx, LOG_ERROR("cancelling generation before sampling"); return false; } - LOG_DEBUG("sample %dx%dx%d", W, H, T); + LOG_VERBOSE("sample %dx%dx%d", W, H, T); int64_t sampling_start = ggml_time_ms(); sd::Tensor final_latent = sd_ctx->sd->sample(sd_ctx->sd->diffusion_model, true, @@ -7133,7 +7133,7 @@ SD_API bool generate_video(sd_ctx_t* sd_ctx, sd_vid_gen_params->sample_params.eta, hires_sample_method); - LOG_DEBUG("sample(latent upscale) %dx%dx%d", W, H, T); + LOG_VERBOSE("sample(latent upscale) %dx%dx%d", W, H, T); LOG_INFO("LTX latent spatial upscale refine: scheduler_steps=%d, denoising_strength=%.2f, sampler=%s, sigma_sched_size=%zu%s", hires_scheduler_steps, request.hires.denoising_strength, @@ -7199,11 +7199,11 @@ SD_API bool generate_video(sd_ctx_t* sd_ctx, latents.audio_length, sd_ctx->sd->get_latent_channel()); if (!audio_latent.empty()) { - LOG_DEBUG("decode audio latent %dx%dx%dx%d", - (int)audio_latent.shape()[0], - (int)audio_latent.shape()[1], - (int)audio_latent.shape()[2], - (int)audio_latent.shape()[3]); + LOG_VERBOSE("decode audio latent %dx%dx%dx%d", + (int)audio_latent.shape()[0], + (int)audio_latent.shape()[1], + (int)audio_latent.shape()[2], + (int)audio_latent.shape()[3]); auto waveform = sd_ctx->sd->decode_ltx_audio_latent(audio_latent); if (!waveform.empty()) { generated_audio = waveform_to_sd_audio(sd_ctx->sd, waveform); diff --git a/src/tokenizers/bpe_tokenizer.cpp b/src/tokenizers/bpe_tokenizer.cpp index 2858e346f..a4001b5cf 100644 --- a/src/tokenizers/bpe_tokenizer.cpp +++ b/src/tokenizers/bpe_tokenizer.cpp @@ -205,7 +205,7 @@ std::vector BPETokenizer::encode(const std::string& text, on_new_token_cb_t ss << "\"" << token << "\", "; } ss << "]"; - LOG_DEBUG("split prompt \"%s\" to %zu tokens %s", text.c_str(), bpe_tokens.size(), ss.str().c_str()); + LOG_VERBOSE("split prompt \"%s\" to %zu tokens %s", text.c_str(), bpe_tokens.size(), ss.str().c_str()); return bpe_tokens; } diff --git a/src/tokenizers/clip_tokenizer.cpp b/src/tokenizers/clip_tokenizer.cpp index d51eadec4..ceabb40ee 100644 --- a/src/tokenizers/clip_tokenizer.cpp +++ b/src/tokenizers/clip_tokenizer.cpp @@ -63,7 +63,7 @@ void CLIPTokenizer::load_from_merges(const std::string& merges_utf8_str) { } vocab.push_back(utf8_to_utf32("<|startoftext|>")); vocab.push_back(utf8_to_utf32("<|endoftext|>")); - LOG_DEBUG("vocab size: %zu", vocab.size()); + LOG_VERBOSE("vocab size: %zu", vocab.size()); int i = 0; for (const auto& token : vocab) { encoder[token] = i; diff --git a/src/tokenizers/gemma_tokenizer.cpp b/src/tokenizers/gemma_tokenizer.cpp index a7b67ef14..8838bf1e0 100644 --- a/src/tokenizers/gemma_tokenizer.cpp +++ b/src/tokenizers/gemma_tokenizer.cpp @@ -29,7 +29,7 @@ void GemmaTokenizer::load_from_merges(const std::string& merges_utf8_str, const decoder[i] = token; } encoder_len = static_cast(vocab.size()); - LOG_DEBUG("vocab size: %d", encoder_len); + LOG_VERBOSE("vocab size: %d", encoder_len); std::vector merges = split_utf32(merges_utf8_str); std::vector> merge_pairs; @@ -37,7 +37,7 @@ void GemmaTokenizer::load_from_merges(const std::string& merges_utf8_str, const size_t space_pos = merge.find(' '); merge_pairs.emplace_back(merge.substr(0, space_pos), merge.substr(space_pos + 1)); } - LOG_DEBUG("merges size %zu", merge_pairs.size()); + LOG_VERBOSE("merges size %zu", merge_pairs.size()); int rank = 0; for (const auto& merge : merge_pairs) { @@ -214,7 +214,7 @@ void Gemma2Tokenizer::load_from_merges(const std::string& merges_utf8_str, const decoder[i] = token; } encoder_len = static_cast(vocab.size()); - LOG_DEBUG("vocab size: %d", encoder_len); + LOG_VERBOSE("vocab size: %d", encoder_len); std::vector merges = split_utf32(merges_utf8_str); std::vector> merge_pairs; @@ -222,7 +222,7 @@ void Gemma2Tokenizer::load_from_merges(const std::string& merges_utf8_str, const size_t space_pos = merge.find(' '); merge_pairs.emplace_back(merge.substr(0, space_pos), merge.substr(space_pos + 1)); } - LOG_DEBUG("merges size %zu", merge_pairs.size()); + LOG_VERBOSE("merges size %zu", merge_pairs.size()); int rank = 0; for (const auto& merge : merge_pairs) { diff --git a/src/tokenizers/gpt_oss_tokenizer.cpp b/src/tokenizers/gpt_oss_tokenizer.cpp index 9779734ce..bb11839f2 100644 --- a/src/tokenizers/gpt_oss_tokenizer.cpp +++ b/src/tokenizers/gpt_oss_tokenizer.cpp @@ -31,7 +31,7 @@ void GPTOSSTokenizer::load_from_merges(const std::string& merges_utf8_str, const encoder_len++; } encoder_len = static_cast(encoder.size()); - LOG_DEBUG("vocab size: %d", encoder_len); + LOG_VERBOSE("vocab size: %d", encoder_len); std::vector merges = split_utf32(merges_utf8_str); std::vector> merge_pairs; @@ -39,7 +39,7 @@ void GPTOSSTokenizer::load_from_merges(const std::string& merges_utf8_str, const size_t space_pos = merge.find(' '); merge_pairs.emplace_back(merge.substr(0, space_pos), merge.substr(space_pos + 1)); } - LOG_DEBUG("merges size %zu", merge_pairs.size()); + LOG_VERBOSE("merges size %zu", merge_pairs.size()); int rank = 0; for (const auto& merge : merge_pairs) { diff --git a/src/tokenizers/mistral_tokenizer.cpp b/src/tokenizers/mistral_tokenizer.cpp index cc418710b..13e361cab 100644 --- a/src/tokenizers/mistral_tokenizer.cpp +++ b/src/tokenizers/mistral_tokenizer.cpp @@ -20,7 +20,7 @@ void MistralTokenizer::load_from_merges(const std::string& merges_utf8_str, cons decoder[i] = token; } encoder_len = static_cast(vocab.size()); - LOG_DEBUG("vocab size: %d", encoder_len); + LOG_VERBOSE("vocab size: %d", encoder_len); auto byte_unicode_pairs = bytes_to_unicode(); byte_encoder = std::map(byte_unicode_pairs.begin(), byte_unicode_pairs.end()); @@ -28,7 +28,7 @@ void MistralTokenizer::load_from_merges(const std::string& merges_utf8_str, cons byte_decoder[pair.second] = pair.first; } std::vector merges = split_utf32(merges_utf8_str); - LOG_DEBUG("merges size %zu", merges.size()); + LOG_VERBOSE("merges size %zu", merges.size()); std::vector> merge_pairs; for (const auto& merge : merges) { size_t space_pos = merge.find(' '); diff --git a/src/tokenizers/qwen2_tokenizer.cpp b/src/tokenizers/qwen2_tokenizer.cpp index 79e683e7b..a0c2e3bdb 100644 --- a/src/tokenizers/qwen2_tokenizer.cpp +++ b/src/tokenizers/qwen2_tokenizer.cpp @@ -11,7 +11,7 @@ void Qwen2Tokenizer::load_from_merges(const std::string& merges_utf8_str) { } std::vector merges = split_utf32(merges_utf8_str); - LOG_DEBUG("merges size %zu", merges.size()); + LOG_VERBOSE("merges size %zu", merges.size()); std::vector> merge_pairs; for (const auto& merge : merges) { size_t space_pos = merge.find(' '); @@ -36,7 +36,7 @@ void Qwen2Tokenizer::load_from_merges(const std::string& merges_utf8_str) { i++; } encoder_len = i; - LOG_DEBUG("vocab size: %d", encoder_len); + LOG_VERBOSE("vocab size: %d", encoder_len); int rank = 0; for (const auto& merge : merge_pairs) { diff --git a/src/tokenizers/t5_unigram_tokenizer.cpp b/src/tokenizers/t5_unigram_tokenizer.cpp index 64e9e0712..7ea6fd1e3 100644 --- a/src/tokenizers/t5_unigram_tokenizer.cpp +++ b/src/tokenizers/t5_unigram_tokenizer.cpp @@ -333,7 +333,7 @@ std::vector T5UniGramTokenizer::encode(const std::string& input, on_new_tok ss << "\"" << token_str << "\", "; } ss << "]"; - LOG_DEBUG("split prompt \"%s\" to tokens %s", input.c_str(), ss.str().c_str()); + LOG_VERBOSE("split prompt \"%s\" to tokens %s", input.c_str(), ss.str().c_str()); return tokens; }