feat: add verbose logging and log-level selection (#1941)

This commit is contained in:
leejet 2026-09-06 23:14:03 +08:00 committed by GitHub
parent 462d675018
commit dbb611264e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
69 changed files with 551 additions and 484 deletions

View File

@ -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 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 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 ## 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`. end of `detect_from_weights`.
Example: Example:
```cpp ```cpp
LOG_DEBUG("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64, LOG_VERBOSE("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64,
config.num_layers, config.num_layers,
config.vocab_size, config.vocab_size,
config.hidden_size, config.hidden_size,
config.intermediate_size); config.intermediate_size);
``` ```
Only print the config detection log when the function actually inferred values Only print the config detection log when the function actually inferred values

View File

@ -6,6 +6,11 @@ For detailed command-line arguments, run:
./bin/sd-cli -h ./bin/sd-cli -h
``` ```
Logging defaults to `info`. Use `--log-level <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 For direct image repair or automatic post-generation YOLOv8 detection followed by cropped inpainting, see
[ADetailer](../../docs/adetailer.md). [ADetailer](../../docs/adetailer.md).

View File

@ -40,9 +40,9 @@ struct SDCliParams {
std::string image_path; std::string image_path;
std::string metadata_format = "text"; std::string metadata_format = "text";
bool verbose = false; sd_log_level_t log_level = SD_LOG_INFO;
bool canny_preprocess = false; bool canny_preprocess = false;
bool convert_name = false; bool convert_name = false;
preview_t preview_method = PREVIEW_NONE; preview_t preview_method = PREVIEW_NONE;
int preview_interval = 1; int preview_interval = 1;
@ -115,10 +115,6 @@ struct SDCliParams {
"--convert-name", "--convert-name",
"convert tensor name (for convert mode)", "convert tensor name (for convert mode)",
true, &convert_name}, true, &convert_name},
{"-v",
"--verbose",
"print extra info",
true, &verbose},
{"", {"",
"--color", "--color",
"colors the logging tags according to level", "colors the logging tags according to level",
@ -220,6 +216,7 @@ struct SDCliParams {
on_imatrix_in_arg}, on_imatrix_in_arg},
}; };
add_log_options(options, log_level);
return options; return options;
}; };
@ -269,7 +266,7 @@ struct SDCliParams {
<< " output_path: \"" << output_path << "\",\n" << " output_path: \"" << output_path << "\",\n"
<< " image_path: \"" << image_path << "\",\n" << " image_path: \"" << image_path << "\",\n"
<< " metadata_format: \"" << metadata_format << "\",\n" << " metadata_format: \"" << metadata_format << "\",\n"
<< " verbose: " << (verbose ? "true" : "false") << ",\n" << " log_level: " << log_level_name(log_level) << ",\n"
<< " color: " << (color ? "true" : "false") << ",\n" << " color: " << (color ? "true" : "false") << ",\n"
<< " canny_preprocess: " << (canny_preprocess ? "true" : "false") << ",\n" << " canny_preprocess: " << (canny_preprocess ? "true" : "false") << ",\n"
<< " convert_name: " << (convert_name ? "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); 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(); bool valid = cli_params.resolve_and_validate();
if (valid && cli_params.mode != METADATA) { if (valid && cli_params.mode != METADATA) {
valid = ctx_params.resolve_and_validate(cli_params.mode) && 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) { void sd_log_cb(enum sd_log_level_t level, const char* log, void* data) {
SDCliParams* cli_params = (SDCliParams*)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, bool load_images_from_dir(const std::string dir,
std::vector<SDImageOwner>& images, std::vector<SDImageOwner>& images,
int expected_width = 0, int expected_width = 0,
int expected_height = 0, int expected_height = 0,
int max_image_num = 0, int max_image_num = 0) {
bool verbose = false) {
if (!fs::exists(dir) || !fs::is_directory(dir)) { if (!fs::exists(dir) || !fs::is_directory(dir)) {
LOG_ERROR("'%s' is not a valid directory\n", dir.c_str()); LOG_ERROR("'%s' is not a valid directory\n", dir.c_str());
return false; return false;
@ -355,7 +354,7 @@ bool load_images_from_dir(const std::string dir,
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".webp") { 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 width = 0;
int height = 0; int height = 0;
uint8_t* image_buffer = load_image_from_file(path.c_str(), width, height, expected_width, expected_height); 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); parse_args(argc, argv, cli_params, ctx_params, gen_params);
sd_set_log_callback(sd_log_cb, (void*)&cli_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) { if (cli_params.mode == METADATA) {
MetadataReadOptions options; MetadataReadOptions options;
@ -700,11 +697,11 @@ int main(int argc, const char* argv[]) {
cli_params.preview_noisy, cli_params.preview_noisy,
(void*)&cli_params); (void*)&cli_params);
LOG_DEBUG("version: %s", version_string().c_str()); LOG_VERBOSE("version: %s", version_string().c_str());
LOG_DEBUG("%s", sd_get_system_info()); LOG_VERBOSE("%s", sd_get_system_info());
LOG_DEBUG("%s", cli_params.to_string().c_str()); LOG_VERBOSE("%s", cli_params.to_string().c_str());
LOG_DEBUG("%s", ctx_params.to_string().c_str()); LOG_VERBOSE("%s", ctx_params.to_string().c_str());
LOG_DEBUG("%s", gen_params.to_string().c_str()); LOG_VERBOSE("%s", gen_params.to_string().c_str());
if (!cli_params.imatrix_out.empty()) { if (!cli_params.imatrix_out.empty()) {
if (fs::exists(cli_params.imatrix_out) && 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()); gen_params.ref_videos.reserve(gen_params.ref_video_paths.size());
for (const auto& path : gen_params.ref_video_paths) { for (const auto& path : gen_params.ref_video_paths) {
std::vector<SDImageOwner> frames; std::vector<SDImageOwner> 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()); LOG_ERROR("load reference video frames from '%s' failed", path.c_str());
return 1; return 1;
} }
@ -890,8 +887,7 @@ int main(int argc, const char* argv[]) {
gen_params.control_frames, gen_params.control_frames,
gen_params.get_resolved_width(), gen_params.get_resolved_width(),
gen_params.get_resolved_height(), gen_params.get_resolved_height(),
gen_params.video_frames, gen_params.video_frames)) {
cli_params.verbose)) {
return 1; return 1;
} }
} }
@ -902,8 +898,7 @@ int main(int argc, const char* argv[]) {
gen_params.pm_id_images, gen_params.pm_id_images,
0, 0,
0, 0,
0, 0)) {
cli_params.verbose)) {
return 1; return 1;
} }
} }

View File

@ -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<ArgOptions>& options_list) { bool parse_options(int argc, const char** argv, const std::vector<ArgOptions>& options_list) {
bool invalid_arg = false; bool invalid_arg = false;
std::string arg; std::string arg;

View File

@ -107,6 +107,7 @@ struct ArgOptions {
void print() const; 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<ArgOptions>& options_list); bool parse_options(int argc, const char** argv, const std::vector<ArgOptions>& options_list);
bool decode_base64_image(const std::string& encoded_input, bool decode_base64_image(const std::string& encoded_input,
int target_channels, int target_channels,

View File

@ -2,8 +2,8 @@
#include <vector> #include <vector>
bool log_verbose = false; sd_log_level_t log_level = SD_LOG_INFO;
bool log_color = false; bool log_color = false;
std::string sd_basename(const std::string& path) { std::string sd_basename(const std::string& path) {
size_t pos = path.find_last_of('/'); size_t pos = path.find_last_of('/');
@ -51,12 +51,40 @@ void print_utf8(FILE* stream, const char* utf8) {
#endif #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; int tag_color;
const char* level_str; const char* level_str;
FILE* out_stream = (level == SD_LOG_ERROR) ? stderr : stdout; FILE* out_stream = (level == SD_LOG_ERROR) ? stderr : stdout;
if (!log || (!verbose && level <= SD_LOG_DEBUG)) { if (!log || level < min_level) {
return; return;
} }
@ -65,6 +93,10 @@ void log_print(enum sd_log_level_t level, const char* log, bool verbose, bool co
tag_color = 37; tag_color = 37;
level_str = "DEBUG"; level_str = "DEBUG";
break; break;
case SD_LOG_VERBOSE:
tag_color = 37;
level_str = "VERBOSE";
break;
case SD_LOG_INFO: case SD_LOG_INFO:
tag_color = 34; tag_color = 34;
level_str = "INFO"; 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) { 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 { } else {
fprintf(out_stream, "[%-5s] ", level_str); fprintf(out_stream, "[%-7s] ", level_str);
} }
fflush(out_stream); fflush(out_stream);
print_utf8(out_stream, log); 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); 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); va_end(args);
} }

View File

@ -16,15 +16,18 @@
#include "stable-diffusion.h" #include "stable-diffusion.h"
extern bool log_verbose; extern sd_log_level_t log_level;
extern bool log_color; extern bool log_color;
std::string sd_basename(const std::string& path); std::string sd_basename(const std::string& path);
void print_utf8(FILE* stream, const char* utf8); 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, ...); 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_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_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_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__) #define LOG_ERROR(format, ...) example_log_printf(SD_LOG_ERROR, __FILE__, __LINE__, format, ##__VA_ARGS__)

View File

@ -836,7 +836,7 @@ std::vector<uint8_t> create_mjpg_avi_from_sd_images_to_vector(sd_image_t* images
const uint32_t audio_data_size = has_audio ? static_cast<uint32_t>(audio_pcm.size()) : 0; const uint32_t audio_data_size = has_audio ? static_cast<uint32_t>(audio_pcm.size()) : 0;
if (mjpg_quality != quality) 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<uint8_t> avi_data; std::vector<uint8_t> avi_data;
avi_data.reserve(static_cast<size_t>(num_images) * 1024); avi_data.reserve(static_cast<size_t>(num_images) * 1024);

View File

@ -13,9 +13,14 @@ What this example does:
* `--llm` selects the text encoder / language model used by this pipeline * `--llm` selects the text encoder / language model used by this pipeline
* `--diffusion-fa` enables flash attention in the diffusion model * `--diffusion-fa` enables flash attention in the diffusion model
* `--offload-to-cpu` reduces VRAM pressure by keeping weights in RAM when possible * `--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 * `--cfg-scale 1.0` sets the default CFG scale for generation
Logging defaults to `info`. Use `--log-level <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: After the server starts successfully:
* the web UI is available at `http://127.0.0.1:1234/` * the web UI is available at `http://127.0.0.1:1234/`

View File

@ -44,6 +44,9 @@ static void parse_args(int argc,
exit(svr_params.normal_exit ? 0 : 1); 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; const bool random_seed_requested = default_gen_params.seed < 0;
if (!svr_params.resolve_and_validate() || 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) { void sd_log_cb(enum sd_log_level_t level, const char* log, void* data) {
SDSvrParams* svr_params = (SDSvrParams*)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) { 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); parse_args(argc, argv, svr_params, ctx_params, default_gen_params);
sd_set_log_callback(sd_log_cb, (void*)&svr_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_VERBOSE("version: %s", version_string().c_str());
LOG_DEBUG("%s", sd_get_system_info()); LOG_VERBOSE("%s", sd_get_system_info());
LOG_DEBUG("%s", svr_params.to_string().c_str()); LOG_VERBOSE("%s", svr_params.to_string().c_str());
LOG_DEBUG("%s", ctx_params.to_string().c_str()); LOG_VERBOSE("%s", ctx_params.to_string().c_str());
LOG_DEBUG("%s", default_gen_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); sd_ctx_params_t sd_ctx_params = ctx_params.to_sd_ctx_params_t(false);
SDCtxPtr sd_ctx(new_sd_ctx(&sd_ctx_params)); SDCtxPtr sd_ctx(new_sd_ctx(&sd_ctx_params));

View File

@ -270,7 +270,7 @@ void register_openai_api_endpoints(httplib::Server& svr, ServerRuntime& rt) {
return; 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; SDImageVec results;
if (!execute_sync_img_gen_request(*runtime, request, results, error_message)) { 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; 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; SDImageVec results;
if (!execute_sync_img_gen_request(*runtime, request, results, error_message)) { if (!execute_sync_img_gen_request(*runtime, request, results, error_message)) {

View File

@ -330,7 +330,7 @@ void register_sdapi_endpoints(httplib::Server& svr, ServerRuntime& rt) {
return; 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(); sd_img_gen_params_t img_gen_params = request.to_sd_img_gen_params_t();
SDImageVec results; SDImageVec results;

View File

@ -199,7 +199,6 @@ ArgOptions SDSvrParams::get_options() {
}; };
options.bool_options = { options.bool_options = {
{"-v", "--verbose", "print extra info", true, &verbose},
{"", "--color", "colors the logging tags according to level", true, &color}, {"", "--color", "colors the logging tags according to level", true, &color},
}; };
@ -212,6 +211,7 @@ ArgOptions SDSvrParams::get_options() {
options.manual_options = { options.manual_options = {
{"-h", "--help", "show this help message and exit", on_help_arg}, {"-h", "--help", "show this help message and exit", on_help_arg},
}; };
add_log_options(options, log_level);
return options; return options;
} }
@ -243,6 +243,7 @@ bool SDSvrParams::resolve_and_validate() {
std::string SDSvrParams::to_string() const { std::string SDSvrParams::to_string() const {
std::ostringstream oss; std::ostringstream oss;
oss << "SDSvrParams {\n" oss << "SDSvrParams {\n"
<< " log_level: " << log_level_name(log_level) << ",\n"
<< " listen_ip: " << listen_ip << ",\n" << " listen_ip: " << listen_ip << ",\n"
<< " listen_port: \"" << listen_port << "\",\n" << " listen_port: \"" << listen_port << "\",\n"
<< " serve_html_path: \"" << serve_html_path << "\",\n" << " serve_html_path: \"" << serve_html_path << "\",\n"

View File

@ -22,7 +22,7 @@ struct SDSvrParams {
int listen_port = 1234; int listen_port = 1234;
std::string serve_html_path; std::string serve_html_path;
bool normal_exit = false; bool normal_exit = false;
bool verbose = false; sd_log_level_t log_level = SD_LOG_INFO;
bool color = false; bool color = false;
ArgOptions get_options(); ArgOptions get_options();

View File

@ -147,6 +147,7 @@ enum sd_type_t {
enum sd_log_level_t { enum sd_log_level_t {
SD_LOG_DEBUG, SD_LOG_DEBUG,
SD_LOG_VERBOSE,
SD_LOG_INFO, SD_LOG_INFO,
SD_LOG_WARN, SD_LOG_WARN,
SD_LOG_ERROR SD_LOG_ERROR

View File

@ -251,7 +251,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
} }
auto iter = embedding_pos_map.find(embd_name); auto iter = embedding_pos_map.find(embd_name);
if (iter != embedding_pos_map.end()) { 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++) { for (int i = iter->second.first; i < iter->second.second; i++) {
bpe_tokens.push_back(text_model->model.vocab_size + 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); 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; *dst_tensor = embd2;
} else { } 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; return false;
} }
} else { } 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; return false;
} }
} else { } else {
@ -295,10 +295,10 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
ggml_nbytes(embd)); ggml_nbytes(embd));
for (int i = 0; i < embd->ne[1]; i++) { for (int i = 0; i < embd->ne[1]; i++) {
bpe_tokens.push_back(text_model->model.vocab_size + num_custom_embeddings); 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++; 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) { if (embd2) {
int64_t hidden_size = text_model2->model.hidden_size; int64_t hidden_size = text_model2->model.hidden_size;
@ -308,10 +308,10 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
ggml_nbytes(embd2)); ggml_nbytes(embd2));
for (int i = 0; i < embd2->ne[1]; i++) { for (int i = 0; i < embd2->ne[1]; i++) {
bpe_tokens.push_back(text_model2->model.vocab_size + num_custom_embeddings_2); 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++; 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; int pos_end = num_custom_embeddings;
if (pos_end == pos_start) { if (pos_end == pos_start) {
@ -360,7 +360,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
ss << "['" << item.first << "', " << item.second << "], "; ss << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int32_t>& bpe_tokens) -> bool { auto on_new_token_cb = [&](std::string& str, std::vector<int32_t>& bpe_tokens) -> bool {
@ -381,7 +381,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
size_t padding_size = (75 - (current_size % 75)) % 75; // Ensure no negative padding size_t padding_size = (75 - (current_size % 75)) % 75; // Ensure no negative padding
if (padding_size > 0) { 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); tokens.insert(tokens.end(), padding_size, tokenizer.EOS_TOKEN_ID);
weights.insert(weights.end(), padding_size, 1.0f); weights.insert(weights.end(), padding_size, 1.0f);
} }
@ -480,7 +480,7 @@ struct FrozenCLIPEmbedderWithCustomWords : public Conditioner {
} }
} }
int64_t t1 = ggml_time_ms(); 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); 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 << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int32_t>& bpe_tokens) -> bool { auto on_new_token_cb = [&](std::string& str, std::vector<int32_t>& bpe_tokens) -> bool {
@ -960,7 +960,7 @@ struct SD3CLIPEmbedder : public Conditioner {
} }
int64_t t1 = ggml_time_ms(); 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) { if (zero_out_masked) {
chunk_hidden_states.fill_(0.0f); chunk_hidden_states.fill_(0.0f);
} }
@ -1115,7 +1115,7 @@ struct FluxCLIPEmbedder : public Conditioner {
ss << "['" << item.first << "', " << item.second << "], "; ss << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int32_t>& bpe_tokens) -> bool { auto on_new_token_cb = [&](std::string& str, std::vector<int32_t>& bpe_tokens) -> bool {
@ -1232,7 +1232,7 @@ struct FluxCLIPEmbedder : public Conditioner {
} }
int64_t t1 = ggml_time_ms(); 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()) { if (!hidden_states.empty()) {
hidden_states = sd::ops::concat(hidden_states, chunk_hidden_states, 1); hidden_states = sd::ops::concat(hidden_states, chunk_hidden_states, 1);
} else { } else {
@ -1371,7 +1371,7 @@ struct T5CLIPEmbedder : public Conditioner {
ss << "['" << item.first << "', " << item.second << "], "; ss << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int32_t>& bpe_tokens) -> bool { auto on_new_token_cb = [&](std::string& str, std::vector<int32_t>& bpe_tokens) -> bool {
@ -1412,7 +1412,7 @@ struct T5CLIPEmbedder : public Conditioner {
++num_pad; ++num_pad;
} }
} }
// LOG_DEBUG("PAD: %d", num_pad); // LOG_VERBOSE("PAD: %d", num_pad);
} }
SDCondition get_learned_condition_common(int n_threads, SDCondition get_learned_condition_common(int n_threads,
@ -1464,7 +1464,7 @@ struct T5CLIPEmbedder : public Conditioner {
} }
int64_t t1 = ggml_time_ms(); 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()) { if (!hidden_states.empty()) {
hidden_states = sd::ops::concat(hidden_states, chunk_hidden_states, 1); 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 << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int> qwen_tokens; std::vector<int> qwen_tokens;
@ -1725,7 +1725,7 @@ struct AnimaConditioner : public Conditioner {
auto t5_weight_tensor = sd::Tensor<float>::from_vector(t5_weights); auto t5_weight_tensor = sd::Tensor<float>::from_vector(t5_weights);
int64_t t1 = ggml_time_ms(); 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; SDCondition result;
result.c_crossattn = std::move(hidden_states); result.c_crossattn = std::move(hidden_states);
@ -1906,7 +1906,7 @@ struct LLMEmbedder : public Conditioner {
ss << "['" << item.first << "', " << item.second << "], "; ss << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int> tokens; std::vector<int> tokens;
@ -2224,7 +2224,7 @@ struct LLMEmbedder : public Conditioner {
prompt_template_encode_start_idx++; 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; prompt = prompt_prefix;
if (llm->enable_vision && conditioner_params.ref_images != nullptr && !conditioner_params.ref_images->empty()) { 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); 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 resized_image = clip_preprocess(image, w_bar, h_bar);
auto image_embed = llm->encode_image(n_threads, resized_image, false); auto image_embed = llm->encode_image(n_threads, resized_image, false);
GGML_ASSERT(!image_embed.empty()); 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); 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 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); 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 resized_image = clip_preprocess(image, w_bar, h_bar);
auto image_embed = llm->encode_image(n_threads, resized_image, false); 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); 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 resized_image = clip_preprocess(image, w_bar, h_bar);
auto image_embed = llm->encode_image(n_threads, resized_image, false); 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); 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 resized_image = clip_preprocess(image, w_bar, h_bar);
auto image_embed = llm->encode_image(n_threads, resized_image, false); 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(); 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; SDCondition result;
result.c_crossattn = std::move(hidden_states); result.c_crossattn = std::move(hidden_states);
@ -2791,7 +2791,7 @@ struct LLMEmbedder : public Conditioner {
} }
int64_t t1 = ggml_time_ms(); 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; SDCondition result;
result.c_crossattn = std::move(hidden_states); result.c_crossattn = std::move(hidden_states);
result.extra_c_crossattns = std::move(extra_hidden_states_vec); result.extra_c_crossattns = std::move(extra_hidden_states_vec);
@ -3115,7 +3115,7 @@ struct LTXAVEmbedder : public Conditioner {
GGML_ASSERT(!hidden_states.empty()); GGML_ASSERT(!hidden_states.empty());
int64_t t1 = ggml_time_ms(); 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; SDCondition result;
result.c_crossattn = std::move(hidden_states); result.c_crossattn = std::move(hidden_states);

View File

@ -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*) { __STATIC_INLINE__ void ggml_log_callback_default(ggml_log_level level, const char* text, void*) {
switch (level) { switch (level) {
case GGML_LOG_LEVEL_DEBUG: case GGML_LOG_LEVEL_DEBUG:
LOG_DEBUG(text); LOG_VERBOSE(text);
break; break;
case GGML_LOG_LEVEL_INFO: case GGML_LOG_LEVEL_INFO:
LOG_INFO(text); LOG_INFO(text);
@ -75,7 +75,7 @@ __STATIC_INLINE__ void ggml_log_callback_default(ggml_log_level level, const cha
LOG_ERROR(text); LOG_ERROR(text);
break; break;
default: 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<char*>(&length), sizeof(length)); file.read(reinterpret_cast<char*>(&length), sizeof(length));
file.read(reinterpret_cast<char*>(&ttype), sizeof(ttype)); file.read(reinterpret_cast<char*>(&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()) { if (file.eof()) {
LOG_ERROR("incomplete file '%s'", file_path.c_str()); LOG_ERROR("incomplete file '%s'", file_path.c_str());
@ -884,9 +884,9 @@ __STATIC_INLINE__ sd::Tensor<float> process_tiles_2d(const sd::Tensor<float>& in
bool last_x = false; bool last_x = false;
float last_time = 0.0f; float last_time = 0.0f;
if (!silent) { if (!silent) {
LOG_DEBUG("num tiles : %d, %d ", num_tiles_x, num_tiles_y); LOG_VERBOSE("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_VERBOSE("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("processing %i tiles", num_tiles);
pretty_progress(0, num_tiles, 0.0f); pretty_progress(0, num_tiles, 0.0f);
} }
for (int y = 0; y < small_height && !last_y; y += non_tile_overlap_y) { 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) { 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; bool can_use_flash_attn = true;
if (mask != nullptr) { if (mask != nullptr) {
// TODO: figure out if we can bend t5 to work too // 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 (kqv == nullptr) {
// if (flash_attn) { // 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_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] 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 @@ protected:
graph_params.size()); graph_params.size());
graph_cut_layer_split_primary_notice_logged_ = true; graph_cut_layer_split_primary_notice_logged_ = true;
} else { } else {
LOG_DEBUG("%s graph-cut layer split: graph has no mark_graph_cut segments; using primary backend %s for %zu graph params", 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(), get_desc().c_str(),
sd::layer_split_backend_device_display_name(runtime_backend).c_str(), sd::layer_split_backend_device_display_name(runtime_backend).c_str(),
graph_params.size()); graph_params.size());
} }
return true; return true;
} }

View File

@ -392,7 +392,7 @@ static bool backend_name_exists(const std::string& name) {
static ggml_backend_t init_named_backend(const std::string& name) { static ggml_backend_t init_named_backend(const std::string& name) {
ggml_backend_load_all_once(); 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()) { if (trim_copy(name).empty()) {
return ggml_backend_init_best(); return ggml_backend_init_best();
} }
@ -542,10 +542,10 @@ static ggml_backend_t sd_get_default_backend() {
if (dev_count == 0) { if (dev_count == 0) {
LOG_ERROR("No devices found!"); LOG_ERROR("No devices found!");
} else { } 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) { for (size_t i = 0; i < dev_count; ++i) {
auto dev = ggml_backend_dev_get(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)) { if (sd_backend_is_cpu(backend)) {
LOG_DEBUG("Using CPU backend"); LOG_VERBOSE("Using CPU backend");
} }
return backend; return backend;

View File

@ -170,8 +170,8 @@ std::optional<Tensor<float>> GGMLRunner::execute_graph(ggml_cgraph* graph, int n
} }
const bool segments_changed = plan.segments.size() != logged_segment_count_; const bool segments_changed = plan.segments.size() != logged_segment_count_;
if (segments_changed && (segmented || logged_segment_count_ > 1)) { if (segments_changed && (segmented || logged_segment_count_ > 1)) {
LOG_DEBUG("%s using %zu segment%s", get_desc().c_str(), LOG_VERBOSE("%s using %zu segment%s", get_desc().c_str(),
plan.segments.size(), plan.segments.size() == 1 ? "" : "s"); plan.segments.size(), plan.segments.size() == 1 ? "" : "s");
} }
SegmentGraphBindings bindings(cut_cache_, plan, graph); SegmentGraphBindings bindings(cut_cache_, plan, graph);
SegmentWeightPipeline weights(manager, runtime_backend, reinterpret_cast<uintptr_t>(this), SegmentWeightPipeline weights(manager, runtime_backend, reinterpret_cast<uintptr_t>(this),
@ -261,6 +261,8 @@ std::optional<Tensor<float>> GGMLRunner::execute_graph(ggml_cgraph* graph, int n
if (!prefetch_requests.empty()) { if (!prefetch_requests.empty()) {
weights.enqueue_next(index, prefetch_requests.front()); 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) || if (!execute_segment(segment_graph, n_threads) ||
!cache_.capture(segment_graph) || !cache_.capture(segment_graph) ||
!cut_cache_.capture(graph, segment, get_desc().c_str())) { !cut_cache_.capture(graph, segment, get_desc().c_str())) {
@ -284,10 +286,10 @@ std::optional<Tensor<float>> GGMLRunner::execute_graph(ggml_cgraph* graph, int n
} }
if (segments_changed || peak_compute_bytes != logged_compute_bytes_) { if (segments_changed || peak_compute_bytes != logged_compute_bytes_) {
for (const auto& entry : peak_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)", 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), get_desc().c_str(), entry.second / (1024.0 * 1024.0),
sd_backend_is_cpu(entry.first) ? "RAM" : "VRAM", ggml_backend_name(entry.first), sd_backend_is_cpu(entry.first) ? "RAM" : "VRAM", ggml_backend_name(entry.first),
plan.segments.size(), plan.segments.size() == 1 ? "" : "s"); plan.segments.size(), plan.segments.size() == 1 ? "" : "s");
} }
logged_compute_bytes_ = std::move(peak_compute_bytes); logged_compute_bytes_ = std::move(peak_compute_bytes);
logged_segment_count_ = plan.segments.size(); logged_segment_count_ = plan.segments.size();

View File

@ -251,13 +251,13 @@ namespace sd {
assignment.tensors_by_backend[i].size(), assignment.tensors_by_backend[i].size(),
assignment.bytes_by_backend[i] / (1024.0 * 1024.0)); assignment.bytes_by_backend[i] / (1024.0 * 1024.0));
} else { } else {
LOG_DEBUG("%s graph-cut layer split: %s <- segments [%zu, %zu), %zu tensors, %.1f MB", LOG_VERBOSE("%s graph-cut layer split: %s <- segments [%zu, %zu), %zu tensors, %.1f MB",
desc, desc,
layer_split_backend_device_display_name(split_backends[i]).c_str(), layer_split_backend_device_display_name(split_backends[i]).c_str(),
first_segment, first_segment,
last_segment, last_segment,
assignment.tensors_by_backend[i].size(), assignment.tensors_by_backend[i].size(),
assignment.bytes_by_backend[i] / (1024.0 * 1024.0)); assignment.bytes_by_backend[i] / (1024.0 * 1024.0));
} }
} }
} }

View File

@ -105,6 +105,7 @@ void* sd_get_backend_eval_callback_data();
bool sd_backend_is(ggml_backend_t backend, const std::string& name); 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_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_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_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__) #define LOG_ERROR(format, ...) log_printf(SD_LOG_ERROR, __FILE__, __LINE__, format, ##__VA_ARGS__)

View File

@ -120,7 +120,7 @@ struct LoraModel : public GGMLRunner {
return false; return false;
} }
LOG_DEBUG("finished loaded lora"); LOG_VERBOSE("finished loaded lora");
return true; return true;
} }
@ -242,7 +242,7 @@ struct LoraModel : public GGMLRunner {
if (iter != lora_tensors.end()) { if (iter != lora_tensors.end()) {
float alpha = ggml_ext_backend_tensor_get_f32(iter->second); float alpha = ggml_ext_backend_tensor_get_f32(iter->second);
scale_value = alpha / rank; 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); applied_lora_tensors.insert(alpha_name);
} }
} }
@ -798,7 +798,7 @@ struct LoraModel : public GGMLRunner {
float alpha = ggml_ext_backend_tensor_get_f32(iter->second); float alpha = ggml_ext_backend_tensor_get_f32(iter->second);
scale_value = alpha / rank; scale_value = alpha / rank;
scale_tensor_name = alpha_name; 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; scale_value *= multiplier;

View File

@ -639,7 +639,7 @@ struct PhotoMakerIDEmbed : public GGMLRunner {
return false; return false;
} }
LOG_DEBUG("finished loading PhotoMaker ID Embeds "); LOG_VERBOSE("finished loading PhotoMaker ID Embeds ");
return true; return true;
} }

View File

@ -340,7 +340,7 @@ public:
enable_ip(enable_ip) { enable_ip(enable_ip) {
int64_t inner_dim = d_head * n_head; int64_t inner_dim = d_head * n_head;
if (context_dim == 320 && d_head == 320) { 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; xtra_dim = true;
context_dim = 1024; context_dim = 1024;
} }
@ -370,7 +370,7 @@ public:
auto q = to_q->forward(ctx, x); // [N, n_token, inner_dim] auto q = to_q->forward(ctx, x); // [N, n_token, inner_dim]
if (xtra_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 context->ne[0] = 1024; // patch dim
} }
auto k = to_k->forward(ctx, context); // [N, n_context, inner_dim] auto k = to_k->forward(ctx, context); // [N, n_context, inner_dim]

View File

@ -68,12 +68,12 @@ struct YOLOv8Config {
} }
if (config.valid) { if (config.valid) {
LOG_DEBUG("yolov8: classes=%d, reg_max=%d, p3=%d, p4=%d, p5=%d", LOG_VERBOSE("yolov8: classes=%d, reg_max=%d, p3=%d, p4=%d, p5=%d",
config.num_classes, config.num_classes,
config.reg_max, config.reg_max,
config.out_channels[15], config.out_channels[15],
config.out_channels[18], config.out_channels[18],
config.out_channels[21]); config.out_channels[21]);
} }
return config; return config;
} }

View File

@ -46,11 +46,11 @@ namespace Anima {
} }
if (detected_layers > 0) { if (detected_layers > 0) {
config.num_layers = detected_layers; config.num_layers = detected_layers;
LOG_DEBUG("anima: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", head_dim = %" PRId64, LOG_VERBOSE("anima: num_layers = %" PRId64 ", hidden_size = %" PRId64 ", num_heads = %" PRId64 ", head_dim = %" PRId64,
config.num_layers, config.num_layers,
config.hidden_size, config.hidden_size,
config.num_heads, config.num_heads,
config.head_dim); config.head_dim);
} }
return config; return config;
} }

View File

@ -109,16 +109,16 @@ namespace Boogu {
} }
config.timestep_embed_dim = std::min<int64_t>(config.hidden_size, 1024); config.timestep_embed_dim = std::min<int64_t>(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, 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_layers,
config.num_double_stream_layers, config.num_double_stream_layers,
config.num_refiner_layers, config.num_refiner_layers,
config.hidden_size, config.hidden_size,
config.num_attention_heads, config.num_attention_heads,
config.num_kv_heads, config.num_kv_heads,
config.head_dim, config.head_dim,
config.in_channels, config.in_channels,
config.out_channels); config.out_channels);
return config; return config;
} }
}; };

View File

@ -72,13 +72,13 @@ namespace ErnieImage {
for (int axis_dim : config.axes_dim) { for (int axis_dim : config.axes_dim) {
config.axes_dim_sum += axis_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, 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.num_layers,
config.hidden_size, config.hidden_size,
config.num_heads, config.num_heads,
config.ffn_hidden_size, config.ffn_hidden_size,
config.in_channels, config.in_channels,
config.out_channels); config.out_channels);
return config; return config;
} }
}; };

View File

@ -123,16 +123,16 @@ namespace Flux {
config.guidance_embed = true; config.guidance_embed = true;
} }
if (name.find("__x0__") != std::string::npos) { if (name.find("__x0__") != std::string::npos) {
LOG_DEBUG("using x0 prediction"); LOG_VERBOSE("using x0 prediction");
config.chroma_radiance_params.use_x0 = true; config.chroma_radiance_params.use_x0 = true;
} }
if (name.find("__32x32__") != std::string::npos) { if (name.find("__32x32__") != std::string::npos) {
LOG_DEBUG("using patch size 32"); LOG_VERBOSE("using patch size 32");
config.patch_size = 32; config.patch_size = 32;
} }
if (name.find("img_in_patch.weight") != std::string::npos) { if (name.find("img_in_patch.weight") != std::string::npos) {
actual_radiance_patch_size = tensor_storage.ne[0]; 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) { if (name.find("distilled_guidance_layer.in_proj.weight") != std::string::npos) {
config.is_chroma = true; config.is_chroma = true;
@ -169,7 +169,7 @@ namespace Flux {
} }
if (actual_radiance_patch_size > 0 && actual_radiance_patch_size != config.patch_size) { if (actual_radiance_patch_size > 0 && actual_radiance_patch_size != config.patch_size) {
GGML_ASSERT(config.patch_size == 2 * actual_radiance_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; config.chroma_radiance_params.fake_patch_size_x2 = true;
} }
if (head_dim > 0) { if (head_dim > 0) {
@ -179,13 +179,13 @@ namespace Flux {
for (int axis_dim : config.axes_dim) { for (int axis_dim : config.axes_dim) {
config.axes_dim_sum += axis_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", 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,
config.depth_single_blocks, config.depth_single_blocks,
config.guidance_embed ? "true" : "false", config.guidance_embed ? "true" : "false",
config.context_in_dim, config.context_in_dim,
config.hidden_size, config.hidden_size,
config.num_heads); config.num_heads);
return config; return config;
} }
}; };
@ -1560,7 +1560,7 @@ namespace Flux {
config.axes_dim, config.axes_dim,
sd_version_is_longcat(version)); sd_version_is_longcat(version));
int pos_len = static_cast<int>(pe_vec.size() / config.axes_dim_sum / 2); int pos_len = static_cast<int>(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); 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(); // pe->data = pe_vec.data();
// print_ggml_tensor(pe); // print_ggml_tensor(pe);
@ -1702,7 +1702,7 @@ namespace Flux {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("flux test done in %lldms", t1 - t0); LOG_VERBOSE("flux test done in %lldms", t1 - t0);
} }
} }

View File

@ -266,16 +266,16 @@ namespace Hunyuan {
GGML_ASSERT(config.hidden_size / config.num_heads == config.axes_dim_sum); GGML_ASSERT(config.hidden_size / config.num_heads == config.axes_dim_sum);
if (inferred) { 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", 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,
config.depth_single_blocks, config.depth_single_blocks,
config.in_channels, config.in_channels,
config.out_channels, config.out_channels,
config.hidden_size, config.hidden_size,
config.context_in_dim, config.context_in_dim,
std::get<0>(config.patch_size), std::get<0>(config.patch_size),
std::get<1>(config.patch_size), std::get<1>(config.patch_size),
std::get<2>(config.patch_size)); std::get<2>(config.patch_size));
} }
return config; return config;
} }
@ -615,7 +615,7 @@ namespace Hunyuan {
config.theta, config.theta,
config.axes_dim); config.axes_dim);
int64_t pos_len = static_cast<int64_t>(pe_vec.size() / config.axes_dim_sum / 2); int64_t pos_len = static_cast<int64_t>(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); 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(); // pe->data = pe_vec.data();
// print_ggml_tensor(pe, true, "pe"); // print_ggml_tensor(pe, true, "pe");

View File

@ -58,11 +58,11 @@ namespace Ideogram4 {
} }
if (detected_layers > 0) { if (detected_layers > 0) {
config.num_layers = detected_layers; config.num_layers = detected_layers;
LOG_DEBUG("ideogram4: num_layers = %" PRId64 ", emb_dim = %" PRId64 ", num_heads = %" PRId64 ", intermediate_size = %" PRId64, LOG_VERBOSE("ideogram4: num_layers = %" PRId64 ", emb_dim = %" PRId64 ", num_heads = %" PRId64 ", intermediate_size = %" PRId64,
config.num_layers, config.num_layers,
config.emb_dim, config.emb_dim,
config.num_heads, config.num_heads,
config.intermediate_size); config.intermediate_size);
} }
return config; return config;
} }
@ -465,7 +465,7 @@ namespace Ideogram4 {
} }
} }
if (has_uncond_model) { if (has_uncond_model) {
LOG_DEBUG("using uncond model"); LOG_VERBOSE("using uncond model");
uncond_model = Ideogram4Transformer(config); uncond_model = Ideogram4Transformer(config);
uncond_model.init(params_ctx, tensor_storage_map, uncond_prefix); uncond_model.init(params_ctx, tensor_storage_map, uncond_prefix);
} }

View File

@ -143,16 +143,16 @@ namespace Krea2 {
} }
config.update_axes_dim(); 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, 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.layers,
config.features, config.features,
config.heads, config.heads,
config.kv_heads, config.kv_heads,
config.text_dim, config.text_dim,
config.text_layers, config.text_layers,
config.text_heads, config.text_heads,
config.text_kv_heads, config.text_kv_heads,
config.in_channels); config.in_channels);
return config; return config;
} }
}; };

View File

@ -66,14 +66,14 @@ namespace Lens {
for (int axis_dim : config.axes_dim) { for (int axis_dim : config.axes_dim) {
config.axes_dim_sum += axis_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, 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.num_layers,
config.selected_layer_count, config.selected_layer_count,
config.num_attention_heads * config.attention_head_dim, config.num_attention_heads * config.attention_head_dim,
config.num_attention_heads, config.num_attention_heads,
config.attention_head_dim, config.attention_head_dim,
config.in_channels, config.in_channels,
config.out_channels); config.out_channels);
return config; return config;
} }
}; };

View File

@ -127,17 +127,17 @@ namespace LingBotVideo {
config.topk_group = 2; config.topk_group = 2;
config.routed_scaling_factor = 2.5f; 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", 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.depth,
config.hidden_size, config.hidden_size,
config.num_attention_heads, config.num_attention_heads,
config.text_dim, config.text_dim,
config.num_experts, config.num_experts,
config.num_experts_per_tok, config.num_experts_per_tok,
config.n_group, config.n_group,
config.topk_group, config.topk_group,
config.routed_scaling_factor, config.routed_scaling_factor,
config.sparse_layers.size()); config.sparse_layers.size());
return config; return config;
} }
}; };

View File

@ -274,12 +274,12 @@ namespace LTXV {
config.audio_connector_apply_gated_attention = true; 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, 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.num_layers,
config.hidden_size, config.hidden_size,
config.num_attention_heads, config.num_attention_heads,
config.audio_hidden_size, config.audio_hidden_size,
config.audio_num_attention_heads); config.audio_num_attention_heads);
return config; return config;
} }
}; };
@ -2070,7 +2070,7 @@ namespace LTXV {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
print_sd_tensor(out_opt, false, "ltxav_out"); 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, static void load_from_file_and_test(const std::string& model_path,

View File

@ -106,14 +106,14 @@ namespace MiniMaxH3 {
config.rope_inv_freq_len = inv_freq->ne[0]; config.rope_inv_freq_len = inv_freq->ne[0];
} }
LOG_DEBUG("minimax_h3: layers=%" PRId64 ", hidden=%" PRId64 ", heads=%" PRId64 LOG_VERBOSE("minimax_h3: layers=%" PRId64 ", hidden=%" PRId64 ", heads=%" PRId64
", head_dim=%" PRId64 ", ffn=%" PRId64 ", adaln_curve=%" PRId64, ", head_dim=%" PRId64 ", ffn=%" PRId64 ", adaln_curve=%" PRId64,
config.num_layers, config.num_layers,
config.hidden_size, config.hidden_size,
config.num_attention_heads, config.num_attention_heads,
config.attention_head_dim, config.attention_head_dim,
config.ffn_hidden_size, config.ffn_hidden_size,
config.adaln_curve_grid); config.adaln_curve_grid);
return config; return config;
} }
}; };

View File

@ -108,15 +108,15 @@ namespace MiniT2I {
config.head_dim = config.hidden_size == 1248 ? 52 : 64; config.head_dim = config.hidden_size == 1248 ? 52 : 64;
config.num_heads = config.hidden_size / config.head_dim; 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, 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.hidden_size,
config.txt_hidden_size, config.txt_hidden_size,
config.num_heads, config.num_heads,
config.head_dim, config.head_dim,
config.depth_double, config.depth_double,
config.txt_preamble_depth, config.txt_preamble_depth,
config.patch_size, config.patch_size,
config.in_channels); config.in_channels);
return config; return config;
} }
}; };

View File

@ -120,16 +120,16 @@ struct MMDiTConfig {
} }
if (has_weight_config) { 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", 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.depth,
config.d_self + 1, config.d_self + 1,
config.hidden_size, config.hidden_size,
config.patch_size, config.patch_size,
config.in_channels, config.in_channels,
config.out_channels, config.out_channels,
config.context_size, config.context_size,
config.adm_in_channels, config.adm_in_channels,
config.qk_norm.empty() ? "none" : config.qk_norm.c_str()); config.qk_norm.empty() ? "none" : config.qk_norm.c_str());
} }
return config; return config;
} }
@ -1045,7 +1045,7 @@ struct MMDiTRunner : public DiffusionModelRunner {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("mmdit test done in %lldms", t1 - t0); LOG_VERBOSE("mmdit test done in %lldms", t1 - t0);
} }
} }

View File

@ -109,16 +109,16 @@ namespace Pid {
config.lq_latent_channels = latent_proj_in_channels; config.lq_latent_channels = latent_proj_in_channels;
config.lq_latent_down_factor = latent_proj_in_channels >= 64 ? 16 : 8; 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, 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.pit_lq_inject ? "1.5" : "1",
config.patch_depth, config.patch_depth,
config.pixel_depth, config.pixel_depth,
config.patch_mlp_hidden_dim, config.patch_mlp_hidden_dim,
config.lq_latent_channels, config.lq_latent_channels,
config.lq_hidden_dim, config.lq_hidden_dim,
config.lq_latent_down_factor, config.lq_latent_down_factor,
config.lq_latent_unpatchify_factor, config.lq_latent_unpatchify_factor,
config.lq_interval); config.lq_interval);
return config; return config;
} }
}; };

View File

@ -49,9 +49,9 @@ namespace Qwen {
} }
} }
} }
LOG_DEBUG("qwen_image: num_layers = %d, zero_cond_t = %s", LOG_VERBOSE("qwen_image: num_layers = %d, zero_cond_t = %s",
config.num_layers, config.num_layers,
config.zero_cond_t ? "true" : "false"); config.zero_cond_t ? "true" : "false");
return config; return config;
} }
}; };
@ -646,7 +646,7 @@ namespace Qwen {
circular_x_enabled, circular_x_enabled,
config.axes_dim); config.axes_dim);
int pos_len = static_cast<int>(pe_vec.size() / config.axes_dim_sum / 2); int pos_len = static_cast<int>(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); 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(); // pe->data = pe_vec.data();
// print_ggml_tensor(pe, true, "pe"); // print_ggml_tensor(pe, true, "pe");
@ -760,7 +760,7 @@ namespace Qwen {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("qwen_image test done in %lldms", t1 - t0); LOG_VERBOSE("qwen_image test done in %lldms", t1 - t0);
} }
} }

View File

@ -34,10 +34,10 @@ namespace SefiImage {
config.hidden_size = tensor_storage.ne[1] * 2; config.hidden_size = tensor_storage.ne[1] * 2;
} }
} }
LOG_DEBUG("sefi_image: semantic_channels = %" PRId64 ", texture_latent_channels = %" PRId64 ", hidden_size = %" PRId64, LOG_VERBOSE("sefi_image: semantic_channels = %" PRId64 ", texture_latent_channels = %" PRId64 ", hidden_size = %" PRId64,
config.semantic_channels, config.semantic_channels,
config.texture_latent_channels, config.texture_latent_channels,
config.hidden_size); config.hidden_size);
return config; return config;
} }
}; };

View File

@ -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", 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.in_channels,
config.out_channels, config.out_channels,
config.model_channels, config.model_channels,
config.time_embed_dim, config.time_embed_dim,
config.context_dim, config.context_dim,
config.adm_in_channels, config.adm_in_channels,
config.num_res_blocks, config.num_res_blocks,
config.tiny_unet ? "true" : "false"); config.tiny_unet ? "true" : "false");
return config; return config;
} }
}; };
@ -904,7 +904,7 @@ struct UNetModelRunner : public DiffusionModelRunner {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("unet test done in %lldms", t1 - t0); LOG_VERBOSE("unet test done in %lldms", t1 - t0);
} }
} }
}; };

View File

@ -75,13 +75,13 @@ namespace WAN {
config.flf_pos_embed_token_number = 514; 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, 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.model_type.c_str(),
config.num_layers, config.num_layers,
config.vace_layers, config.vace_layers,
config.dim, config.dim,
config.ffn_dim, config.ffn_dim,
config.num_heads); config.num_heads);
return config; return config;
} }
}; };
@ -909,7 +909,7 @@ namespace WAN {
config.theta, config.theta,
config.axes_dim); config.axes_dim);
int pos_len = static_cast<int>(pe_vec.size() / config.axes_dim_sum / 2); int pos_len = static_cast<int>(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); 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(); // pe->data = pe_vec.data();
// print_ggml_tensor(pe); // print_ggml_tensor(pe);
@ -1007,7 +1007,7 @@ namespace WAN {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("wan test done in %lldms", t1 - t0); LOG_VERBOSE("wan test done in %lldms", t1 - t0);
} }
} }

View File

@ -107,14 +107,14 @@ namespace ZImage {
config.num_kv_heads = std::max<int64_t>(1, (qkv_heads - config.num_heads) / 2); config.num_kv_heads = std::max<int64_t>(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, 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_layers,
config.num_refiner_layers, config.num_refiner_layers,
config.hidden_size, config.hidden_size,
config.num_heads, config.num_heads,
config.num_kv_heads, config.num_kv_heads,
config.in_channels, config.in_channels,
config.out_channels); config.out_channels);
return config; return config;
} }
}; };
@ -603,7 +603,7 @@ namespace ZImage {
circular_x_enabled, circular_x_enabled,
config.axes_dim); config.axes_dim);
int pos_len = static_cast<int>(pe_vec.size() / config.axes_dim_sum / 2); int pos_len = static_cast<int>(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); 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(); // pe->data = pe_vec.data();
// print_ggml_tensor(pe, true, "pe"); // print_ggml_tensor(pe, true, "pe");
@ -689,7 +689,7 @@ namespace ZImage {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("z_image test done in %lldms", t1 - t0); LOG_VERBOSE("z_image test done in %lldms", t1 - t0);
} }
} }

View File

@ -100,13 +100,13 @@ public:
const std::string& graph_cut_prefix = "") { const std::string& graph_cut_prefix = "") {
// x: [N, n_token, d_model] // x: [N, n_token, d_model]
int layer_idx = n_layer - 1; int layer_idx = n_layer - 1;
// LOG_DEBUG("clip_skip %d", clip_skip); // LOG_VERBOSE("clip_skip %d", clip_skip);
if (clip_skip > 0) { if (clip_skip > 0) {
layer_idx = n_layer - clip_skip; layer_idx = n_layer - clip_skip;
} }
for (int i = 0; i < n_layer; i++) { for (int i = 0; i < n_layer; i++) {
// LOG_DEBUG("layer %d", i); // LOG_VERBOSE("layer %d", i);
if (i == layer_idx + 1) { if (i == layer_idx + 1) {
break; break;
} }
@ -116,7 +116,7 @@ public:
if (!graph_cut_prefix.empty()) { if (!graph_cut_prefix.empty()) {
sd::ggml_graph_cut::mark_graph_cut(x, graph_cut_prefix + ".layers." + std::to_string(i), "x"); 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; return x;
} }
@ -320,7 +320,7 @@ public:
if (text_projection != nullptr) { if (text_projection != nullptr) {
pooled = ggml_ext_linear(ctx->ggml_ctx, pooled, text_projection, nullptr); pooled = ggml_ext_linear(ctx->ggml_ctx, pooled, text_projection, nullptr);
} else { } else {
LOG_DEBUG("identity projection"); LOG_VERBOSE("identity projection");
} }
return pooled; // [hidden_size, 1, 1] return pooled; // [hidden_size, 1, 1]
} }

View File

@ -319,11 +319,11 @@ namespace LLM {
config.vision.deepstack_visual_indexes = {8, 16, 24}; config.vision.deepstack_visual_indexes = {8, 16, 24};
} }
} }
LOG_DEBUG("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64, LOG_VERBOSE("llm: num_layers = %" PRId64 ", vocab_size = %" PRId64 ", hidden_size = %" PRId64 ", intermediate_size = %" PRId64,
config.num_layers, config.num_layers,
config.vocab_size, config.vocab_size,
config.hidden_size, config.hidden_size,
config.intermediate_size); config.intermediate_size);
return config; return config;
} }
}; };
@ -1887,9 +1887,9 @@ namespace LLM {
enable_vision = false; enable_vision = false;
} }
if (enable_vision) { if (enable_vision) {
LOG_DEBUG("enable llm vision"); LOG_VERBOSE("enable llm vision");
if (config.llama_cpp_style) { 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); model = LLM(config, enable_vision, config.llama_cpp_style);
@ -2375,7 +2375,7 @@ namespace LLM {
ss << "['" << item.first << "', " << item.second << "], "; ss << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int> tokens; std::vector<int> tokens;
@ -2426,7 +2426,7 @@ namespace LLM {
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out, false, "image_embed"); print_sd_tensor(out, false, "image_embed");
image_embed = out; 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|>"; std::string placeholder = "<|image_pad|>";
@ -2466,7 +2466,7 @@ namespace LLM {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); 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) { } else if (test_vit) {
// auto image = ggml_new_tensor_3d(ctx, GGML_TYPE_F32, 280, 280, 3); // auto image = ggml_new_tensor_3d(ctx, GGML_TYPE_F32, 280, 280, 3);
// ggml_set_f32(image, 0.f); // ggml_set_f32(image, 0.f);
@ -2485,7 +2485,7 @@ namespace LLM {
// auto ref_out = load_tensor_from_file(ctx, "qwen2vl.bin"); // auto ref_out = load_tensor_from_file(ctx, "qwen2vl.bin");
// ggml_ext_tensor_diff(ref_out, out, 0.01f); // 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) { } else if (test_mistral) {
std::pair<int, int> prompt_attn_range; std::pair<int, int> 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]"; 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()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); 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) { } else if (test_qwen3) {
std::pair<int, int> prompt_attn_range; std::pair<int, int> prompt_attn_range;
std::string text = "<|im_start|>user\n"; std::string text = "<|im_start|>user\n";
@ -2535,7 +2535,7 @@ namespace LLM {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("llm test done in %lldms", t1 - t0); LOG_VERBOSE("llm test done in %lldms", t1 - t0);
} else { } else {
std::pair<int, int> prompt_attn_range; std::pair<int, int> 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"; 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()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("llm test done in %lldms", t1 - t0); LOG_VERBOSE("llm test done in %lldms", t1 - t0);
} }
} }

View File

@ -554,7 +554,7 @@ struct T5Embedder {
ss << "['" << item.first << "', " << item.second << "], "; ss << "['" << item.first << "', " << item.second << "], ";
} }
ss << "]"; 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<int> tokens; std::vector<int> tokens;
@ -612,7 +612,7 @@ struct T5Embedder {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("t5 test done in %lldms", t1 - t0); LOG_VERBOSE("t5 test done in %lldms", t1 - t0);
} }
} }

View File

@ -74,13 +74,13 @@ struct ESRGANConfig {
} }
if (has_model_tensor || has_conv_up1 || has_conv_up2) { 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", 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.scale,
config.num_block, config.num_block,
config.num_in_ch, config.num_in_ch,
config.num_out_ch, config.num_out_ch,
config.num_feat, config.num_feat,
config.num_grow_ch); config.num_grow_ch);
} }
return config; return config;
} }

View File

@ -115,13 +115,13 @@ namespace LTXVUpsampler {
} }
if (inferred) { 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", 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.in_channels,
config.mid_channels, config.mid_channels,
config.num_blocks_per_stage, config.num_blocks_per_stage,
config.spatial_scale, config.spatial_scale,
config.temporal_up_factor, config.temporal_up_factor,
config.rational_resampler); config.rational_resampler);
} }
return config; return config;
} }

View File

@ -864,7 +864,7 @@ struct AutoEncoderKL : public VAE {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("encode test done in %lldms", t1 - t0); LOG_VERBOSE("encode test done in %lldms", t1 - t0);
} }
if (false) { if (false) {
@ -884,7 +884,7 @@ struct AutoEncoderKL : public VAE {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("decode test done in %lldms", t1 - t0); LOG_VERBOSE("decode test done in %lldms", t1 - t0);
} }
}; };
}; };

View File

@ -172,12 +172,12 @@ namespace LTXV {
if (config.audio_channels != 2 || config.latent_channels != 8 || config.mel_bins != 64) { if (config.audio_channels != 2 || config.latent_channels != 8 || config.mel_bins != 64) {
return config; return config;
} }
LOG_DEBUG("ltx_audio_vae: sample_rate = %d, mel_bins = %d, latent_channels = %d, latent_frequency_bins = %d, has_bwe = %s", 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.sample_rate,
config.mel_bins, config.mel_bins,
config.latent_channels, config.latent_channels,
config.latent_frequency_bins, config.latent_frequency_bins,
config.has_bwe ? "true" : "false"); config.has_bwe ? "true" : "false");
return config; return config;
} }
}; };
@ -1063,7 +1063,7 @@ namespace LTXV {
GGML_ASSERT(!out.empty()); GGML_ASSERT(!out.empty());
print_sd_tensor(out, false, "ltx_audio_vae_out"); 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, static void load_from_file_and_test(const std::string& model_path,

View File

@ -1126,11 +1126,11 @@ namespace LTXVAE {
overlap, window); overlap, window);
overlap = window - 1; overlap = window - 1;
} }
LOG_DEBUG("Using temporal tiling: temporal_tile_frames = %d, temporal_tile_overlap = %d, total frames = %d, resulting in %d tiles", LOG_VERBOSE("Using temporal tiling: temporal_tile_frames = %d, temporal_tile_overlap = %d, total frames = %d, resulting in %d tiles",
window, window,
overlap, overlap,
(int)T, (int)T,
(T + window - overlap - 1) / (window - overlap)); (T + window - overlap - 1) / (window - overlap));
ggml_tensor* out = nullptr; ggml_tensor* out = nullptr;
for (int i = 0; i < (int)T - overlap; i += (window - overlap)) { for (int i = 0; i < (int)T - overlap; i += (window - overlap)) {
int feat_idx = 0; int feat_idx = 0;
@ -1327,21 +1327,21 @@ struct LTXVideoVAE : public VAE {
const int64_t total_frames = input.shape()[2]; const int64_t total_frames = input.shape()[2];
auto plan = make_vae_temporal_tile_plan(total_frames, config); 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", 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.tile_frames,
plan.overlap, plan.overlap,
(long long)total_frames, (long long)total_frames,
(int)plan.tiles.size()); (int)plan.tiles.size());
free_cache_ctx_and_buffer(); free_cache_ctx_and_buffer();
auto output = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor<float>& z_chunk, const VAETemporalTile& tile) { auto output = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor<float>& z_chunk, const VAETemporalTile& tile) {
LOG_DEBUG("LTX VAE temporal tile %lld/%d: latent frames [%lld, %lld), overlap=%d", LOG_VERBOSE("LTX VAE temporal tile %lld/%d: latent frames [%lld, %lld), overlap=%d",
(long long)tile.index + 1, (long long)tile.index + 1,
(int)plan.tiles.size(), (int)plan.tiles.size(),
(long long)tile.start, (long long)tile.start,
(long long)tile.end, (long long)tile.end,
tile.overlap); tile.overlap);
auto get_graph = [&]() -> ggml_cgraph* { auto get_graph = [&]() -> ggml_cgraph* {
return build_temporal_tile_graph(z_chunk, return build_temporal_tile_graph(z_chunk,
@ -1465,7 +1465,7 @@ struct LTXVideoVAE : public VAE {
GGML_ASSERT(!out.empty()); GGML_ASSERT(!out.empty());
print_sd_tensor(out, false, "ltx_vae_out"); 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, static void load_from_file_and_test(const std::string& model_path,

View File

@ -65,7 +65,7 @@ public:
if (n_in != n_out) { if (n_in != n_out) {
auto skip = std::dynamic_pointer_cast<Conv2d>(blocks["skip"]); auto skip = std::dynamic_pointer_cast<Conv2d>(blocks["skip"]);
LOG_DEBUG("skip"); LOG_VERBOSE("skip");
x = skip->forward(ctx, x); x = skip->forward(ctx, x);
} }

View File

@ -54,23 +54,23 @@ protected:
} }
auto plan = make_vae_temporal_tile_plan(input.shape()[2], resolved_config); 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", LOG_VERBOSE("%s temporal tiling: tile_frames=%d, overlap=%d, total_frames=%lld, tiles=%d",
get_desc().c_str(), get_desc().c_str(),
plan.tile_frames, plan.tile_frames,
plan.overlap, plan.overlap,
(long long)input.shape()[2], (long long)input.shape()[2],
(int)plan.tiles.size()); (int)plan.tiles.size());
return process_vae_temporal_tiles_blended( return process_vae_temporal_tiles_blended(
input, input,
plan, plan,
output_scale, output_scale,
[&](const sd::Tensor<float>& input_tile, const VAETemporalTile& tile) { [&](const sd::Tensor<float>& input_tile, const VAETemporalTile& tile) {
LOG_DEBUG("%s temporal tile %d/%d: input frames [%lld, %lld)", LOG_VERBOSE("%s temporal tile %d/%d: input frames [%lld, %lld)",
get_desc().c_str(), get_desc().c_str(),
tile.index + 1, tile.index + 1,
(int)plan.tiles.size(), (int)plan.tiles.size(),
(long long)tile.start, (long long)tile.start,
(long long)tile.end); (long long)tile.end);
return _compute(n_threads, input_tile, true); return _compute(n_threads, input_tile, true);
}); });
} }
@ -230,7 +230,7 @@ public:
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 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; : 2.0f;
get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, tiling_params, W, H, encode_tile_factor); 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, output = tiled_compute(input,
n_threads, n_threads,
static_cast<int>(W), static_cast<int>(W),
@ -258,7 +258,7 @@ public:
return {}; return {};
} }
int64_t t1 = ggml_time_ms(); 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); return std::move(output);
} }
@ -281,7 +281,7 @@ public:
int tile_size_x, tile_size_y; 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]); get_tile_sizes(tile_size_x, tile_size_y, tile_overlap, tiling_params, input.shape()[0], input.shape()[1]);
if (!silent) { 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( output = tiled_compute(
input, input,
@ -315,7 +315,7 @@ public:
scale_tensor_to_0_1(&output); scale_tensor_to_0_1(&output);
} }
int64_t t1 = ggml_time_ms(); 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); return std::move(output);
} }

View File

@ -1278,7 +1278,7 @@ namespace WAN {
} }
} }
if (is_2D) { if (is_2D) {
LOG_DEBUG("USING 2D VAE"); LOG_VERBOSE("USING 2D VAE");
} }
ae = WanVAE(decode_only, version, is_2D); ae = WanVAE(decode_only, version, is_2D);
ae.init(params_ctx, tensor_storage_map, prefix); ae.init(params_ctx, tensor_storage_map, prefix);
@ -1409,20 +1409,20 @@ namespace WAN {
stateful_config.overlap = 0; stateful_config.overlap = 0;
auto plan = make_vae_temporal_tile_plan(input.shape()[2], stateful_config); 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", LOG_VERBOSE("Wan VAE stateful temporal tiling: tile_frames=%d, total latent frames=%lld, tiles=%d",
plan.tile_frames, plan.tile_frames,
(long long)input.shape()[2], (long long)input.shape()[2],
(int)plan.tiles.size()); (int)plan.tiles.size());
free_cache_ctx_and_buffer(); free_cache_ctx_and_buffer();
ae.clear_cache(); ae.clear_cache();
auto output = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor<float>& input_tile, const VAETemporalTile& tile) { auto output = process_vae_temporal_tiles(input, plan, [&](const sd::Tensor<float>& input_tile, const VAETemporalTile& tile) {
LOG_DEBUG("Wan VAE temporal tile %d/%d: latent frames [%lld, %lld)", LOG_VERBOSE("Wan VAE temporal tile %d/%d: latent frames [%lld, %lld)",
tile.index + 1, tile.index + 1,
(int)plan.tiles.size(), (int)plan.tiles.size(),
(long long)tile.start, (long long)tile.start,
(long long)tile.end); (long long)tile.end);
auto get_graph = [&]() -> ggml_cgraph* { auto get_graph = [&]() -> ggml_cgraph* {
return build_temporal_tile_graph(input_tile, static_cast<int>(tile.start)); return build_temporal_tile_graph(input_tile, static_cast<int>(tile.start));
}; };
@ -1479,7 +1479,7 @@ namespace WAN {
GGML_ASSERT(!out_opt.empty()); GGML_ASSERT(!out_opt.empty());
out = std::move(out_opt); out = std::move(out_opt);
print_sd_tensor(out); print_sd_tensor(out);
LOG_DEBUG("decode test done in %ldms", t1 - t0); LOG_VERBOSE("decode test done in %ldms", t1 - t0);
} }
}; };

View File

@ -77,7 +77,7 @@ private:
if (align_val != 0 && (align_val & (align_val - 1)) == 0) { if (align_val != 0 && (align_val & (align_val - 1)) == 0) {
alignment_ = align_val; alignment_ = align_val;
LOG_DEBUG("Found alignment: %zu", alignment_); LOG_VERBOSE("Found alignment: %zu", alignment_);
} else { } else {
LOG_ERROR("Invalid alignment value %u, fallback to default %zu", align_val, alignment_); LOG_ERROR("Invalid alignment value %u, fallback to default %zu", align_val, alignment_);
} }
@ -197,8 +197,8 @@ public:
if (!safe_read(fin, metadata_kv_count)) if (!safe_read(fin, metadata_kv_count))
return false; return false;
LOG_DEBUG("GGUF v%u, tensor_count=%llu, metadata_kv_count=%llu", LOG_VERBOSE("GGUF v%u, tensor_count=%llu, metadata_kv_count=%llu",
version, (unsigned long long)tensor_count, (unsigned long long)metadata_kv_count); version, (unsigned long long)tensor_count, (unsigned long long)metadata_kv_count);
// --- Read Metadata --- // --- Read Metadata ---
for (uint64_t i = 0; i < metadata_kv_count; i++) { for (uint64_t i = 0; i < metadata_kv_count; i++) {

View File

@ -237,7 +237,7 @@ bool read_safetensors_file(const std::string& file_path,
for (auto& item : header_.items()) { for (auto& item : header_.items()) {
std::string name = item.key(); std::string name = item.key();
nlohmann::json tensor_info = item.value(); 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__") { if (name == "__metadata__") {
continue; continue;
@ -350,7 +350,7 @@ bool read_safetensors_file(const std::string& file_path,
tensor_storages.push_back(tensor_storage); 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; return true;

View File

@ -165,7 +165,7 @@ void ModelLoader::add_tensor_storage(const TensorStorage& tensor_storage) {
void ModelLoader::set_n_threads(int n_threads) { void ModelLoader::set_n_threads(int n_threads) {
n_threads_ = n_threads > 0 ? n_threads : sd_get_num_physical_cores(); 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) { 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) { for (auto& [_, tensor_storage] : tensor_storage_map) {
auto new_name = convert_tensor_name(tensor_storage.name, version); 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; tensor_storage.name = new_name;
new_map[new_name] = std::move(tensor_storage); 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 ==================================================*/ /*================================================= GGUFModelLoader ==================================================*/
bool ModelLoader::init_from_gguf_file(const std::string& file_path, const std::string& prefix) { 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<TensorStorage> tensor_storages; std::vector<TensorStorage> tensor_storages;
std::string error; 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); size_t file_index = add_file_path(file_path);
for (auto& tensor_storage : tensor_storages) { 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)) { if (!starts_with(tensor_storage.name, prefix)) {
tensor_storage.name = prefix + tensor_storage.name; 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 ==================================================*/ /*================================================= SafeTensorsModelLoader ==================================================*/
bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const std::string& prefix) { 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<TensorStorage> tensor_storages; std::vector<TensorStorage> tensor_storages;
std::string error; std::string error;
@ -276,14 +276,14 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const
add_tensor_storage(tensor_storage); 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; return true;
} }
bool ModelLoader::init_from_safetensors_index_file(const std::string& file_path, const std::string& prefix) { 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<std::string> shard_paths; std::vector<std::string> shard_paths;
std::string error; std::string error;
@ -304,7 +304,7 @@ bool ModelLoader::init_from_safetensors_index_file(const std::string& file_path,
/*================================================= TorchLegacyModelLoader ==================================================*/ /*================================================= TorchLegacyModelLoader ==================================================*/
bool ModelLoader::init_from_torch_legacy_file(const std::string& file_path, const std::string& prefix) { 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<TensorStorage> tensor_storages; std::vector<TensorStorage> tensor_storages;
std::string error; std::string error;
@ -336,7 +336,7 @@ bool ModelLoader::init_from_torch_legacy_file(const std::string& file_path, cons
/*================================================= TorchZipModelLoader ==================================================*/ /*================================================= TorchZipModelLoader ==================================================*/
bool ModelLoader::init_from_torch_zip_file(const std::string& file_path, const std::string& prefix) { 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<TensorStorage> tensor_storages; std::vector<TensorStorage> tensor_storages;
std::string error; 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); 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; return true;
@ -382,7 +382,7 @@ bool ModelLoader::init_from_diffusers_file(const std::string& file_path, const s
// return false; // return false;
} }
if (!init_from_safetensors_file(clip_g_path, "te.1.")) { 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; return true;
} }
@ -546,7 +546,7 @@ SDVersion ModelLoader::get_sd_version() {
} }
} }
if (is_wan) { 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) { if (patch_embedding_channels == 184320 && !has_img_emb) {
return VERSION_WAN2_2_I2V; 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); fdata.tensors = std::move(file_tensors);
if (enable_mmap && !is_zip) { if (enable_mmap && !is_zip) {
LOG_DEBUG("using mmap for I/O"); LOG_VERBOSE("using mmap for I/O");
std::unique_ptr<MmapWrapper> mmapped = MmapWrapper::create(file_path, writable_mmap); std::unique_ptr<MmapWrapper> mmapped = MmapWrapper::create(file_path, writable_mmap);
if (mmapped) { if (mmapped) {
uint8_t* mmap_data = static_cast<uint8_t*>(mmapped->writable_data()); uint8_t* mmap_data = static_cast<uint8_t*>(mmapped->writable_data());
@ -835,7 +835,7 @@ std::vector<MmapTensorStore> ModelLoader::mmap_tensors(std::map<std::string, ggm
uint64_t mapped_bytes = 0; uint64_t mapped_bytes = 0;
size_t mapped_tensors = 0; size_t mapped_tensors = 0;
LOG_DEBUG("memory-mapping tensors..."); LOG_VERBOSE("memory-mapping tensors...");
int64_t t_start = ggml_time_ms(); int64_t t_start = ggml_time_ms();
@ -977,10 +977,10 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb,
if (tensors_to_process.empty()) { if (tensors_to_process.empty()) {
continue; continue;
} }
LOG_DEBUG("loading %zu/%zu tensors from %s", LOG_VERBOSE("loading %zu/%zu tensors from %s",
tensors_to_process.size(), tensors_to_process.size(),
file_tensors.size(), file_tensors.size(),
file_path.c_str()); file_path.c_str());
bool is_zip = fdata.is_zip; bool is_zip = fdata.is_zip;
@ -1373,7 +1373,7 @@ bool ModelLoader::load_tensors(std::map<std::string, ggml_tensor*>& tensors,
std::mutex tensor_names_mutex; std::mutex tensor_names_mutex;
auto on_new_tensor_cb = [&](const TensorStorage& tensor_storage, ggml_tensor** dst_tensor) -> bool { auto on_new_tensor_cb = [&](const TensorStorage& tensor_storage, ggml_tensor** dst_tensor) -> bool {
const std::string& name = tensor_storage.name; 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<std::mutex> lock(tensor_names_mutex); std::lock_guard<std::mutex> lock(tensor_names_mutex);
tensor_names_in_file.insert(name); tensor_names_in_file.insert(name);

View File

@ -421,11 +421,11 @@ bool ModelManager::load_tensors_to_params_backend(const std::vector<TensorState*
} }
} }
for (const auto& entry : prepared) { for (const auto& entry : prepared) {
LOG_DEBUG("model manager prepared params backend buffers (%6.2f MB, %zu tensors, %zu blocks, %s) on %s", LOG_VERBOSE("model manager prepared params backend buffers (%6.2f MB, %zu tensors, %zu blocks, %s) on %s",
entry.second.bytes / (1024.f * 1024.f), entry.second.bytes / (1024.f * 1024.f),
entry.second.tensors, entry.second.blocks, entry.second.tensors, entry.second.blocks,
ggml_backend_buft_is_host(entry.first) ? "RAM" : "VRAM", ggml_backend_buft_is_host(entry.first) ? "RAM" : "VRAM",
ggml_backend_buft_name(entry.first)); ggml_backend_buft_name(entry.first));
} }
return true; return true;
@ -547,12 +547,12 @@ bool ModelManager::stage_tensors_to_compute_backend(const std::vector<TensorStat
if (!stage_chunk(chunk)) { if (!stage_chunk(chunk)) {
return false; return false;
} }
LOG_DEBUG("model manager staged compute params (%6.2f MB, %zu tensors, %zu blocks) to %s, taking %.2fs", LOG_VERBOSE("model manager staged compute params (%6.2f MB, %zu tensors, %zu blocks) to %s, taking %.2fs",
staged_bytes / (1024.f * 1024.f), staged_bytes / (1024.f * 1024.f),
target_states.size(), target_states.size(),
staged_blocks, staged_blocks,
ggml_backend_name(compute_backend), ggml_backend_name(compute_backend),
(ggml_time_ms() - t0) / 1000.f); (ggml_time_ms() - t0) / 1000.f);
} }
return true; return true;
@ -809,10 +809,10 @@ bool ModelManager::alloc_params_buffers(const std::vector<TensorState*>& states,
initialized->data = nullptr; initialized->data = nullptr;
initialized->extra = nullptr; initialized->extra = nullptr;
} }
LOG_DEBUG("model manager releasing params backend buffer (%6.2f MB, %zu tensors, %s)", LOG_VERBOSE("model manager releasing params backend buffer (%6.2f MB, %zu tensors, %s)",
ggml_backend_buffer_get_size(buffer) / (1024.f * 1024.f), ggml_backend_buffer_get_size(buffer) / (1024.f * 1024.f),
initialized_tensors.size(), initialized_tensors.size(),
ggml_backend_buffer_is_host(buffer) ? "RAM" : "VRAM"); ggml_backend_buffer_is_host(buffer) ? "RAM" : "VRAM");
ggml_backend_buffer_free(buffer); ggml_backend_buffer_free(buffer);
return false; return false;
} }
@ -1107,11 +1107,11 @@ void ModelManager::release_params_storage_blocks(bool force,
} }
} }
for (const auto& entry : released) { for (const auto& entry : released) {
LOG_DEBUG("model manager released params backend buffers (%6.2f MB, %zu tensors, %zu blocks, %s) from %s", 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.bytes / (1024.f * 1024.f),
entry.second.tensors, entry.second.blocks, entry.second.tensors, entry.second.blocks,
ggml_backend_buft_is_host(entry.first) ? "RAM" : "VRAM", ggml_backend_buft_is_host(entry.first) ? "RAM" : "VRAM",
ggml_backend_buft_name(entry.first)); ggml_backend_buft_name(entry.first));
} }
} }

View File

@ -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) { if (sd_version_is_unet(version) || is_underline || is_lycoris_underline) {
name = convert_sep_to_dot(name); name = convert_sep_to_dot(name);

View File

@ -311,7 +311,7 @@ struct BetaScheduler : SigmaScheduler {
explicit BetaScheduler(const char* extra_sample_args = nullptr) { explicit BetaScheduler(const char* extra_sample_args = nullptr) {
parse_extra_sample_args(extra_sample_args); 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) { 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 exp_shift = std::exp(sigma_shift);
float target_terminal = std::clamp(terminal, 0.0f, 0.99f); 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); sigmas.reserve(n + 1);
for (uint32_t i = 0; i <= n; ++i) { for (uint32_t i = 0; i <= n; ++i) {
@ -760,7 +760,7 @@ struct FluxScheduler : SigmaScheduler {
sigmas.reserve(n + 1); sigmas.reserve(n + 1);
float mu = compute_mu(); 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) { if (n == 0) {
sigmas.push_back(1.0f); sigmas.push_back(1.0f);
@ -811,7 +811,7 @@ struct Flux2Scheduler : SigmaScheduler {
sigmas.reserve(n + 1); sigmas.reserve(n + 1);
float mu = compute_empirical_mu(image_seq_len, n); 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) { if (n == 0) {
sigmas.push_back(1.0f); sigmas.push_back(1.0f);
@ -1413,8 +1413,8 @@ struct SefiFlowDenoiser : public FluxFlowDenoiser {
sem_sigmas.push_back(sigma_sem); sem_sigmas.push_back(sigma_sem);
tex_sigmas.push_back(sigma_tex); tex_sigmas.push_back(sigma_tex);
} }
LOG_DEBUG("SefiFlowDenoiser: built %u-step dual schedule (alpha=%.2f delta_t=%.2f)", LOG_VERBOSE("SefiFlowDenoiser: built %u-step dual schedule (alpha=%.2f delta_t=%.2f)",
n, timestep_shift_alpha, delta_t); n, timestep_shift_alpha, delta_t);
return tex_sigmas; return tex_sigmas;
} }
}; };
@ -2690,7 +2690,7 @@ static sd::Tensor<float> sample_lms(denoise_cb_t model,
int steps = static_cast<int>(sigmas.size()) - 1; int steps = static_cast<int>(sigmas.size()) - 1;
max_order = std::min(max_order, steps); // history can not be larger than steps 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<float> lms_coeff(max_order); std::vector<float> lms_coeff(max_order);
std::vector<sd::Tensor<float>> hist = {}; std::vector<sd::Tensor<float>> hist = {};
@ -2793,7 +2793,7 @@ static sd::Tensor<float> sample_gradient_estimation(denoise_cb_t model,
LOG_WARN("ignoring invalid euler_ge extra sample arg '%s=%s'", key.c_str(), value.c_str()); LOG_WARN("ignoring invalid euler_ge extra sample arg '%s=%s'", key.c_str(), value.c_str());
continue; continue;
} }
LOG_DEBUG("setting euler_ge gamma to %.2f", parsed); LOG_VERBOSE("setting euler_ge gamma to %.2f", parsed);
ge_gamma = parsed; ge_gamma = parsed;
} }
} }

View File

@ -709,7 +709,7 @@ public:
} }
file_alphas_cumprod = std::move(loaded_alphas); 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, bool init_model_loader(ModelLoader& model_loader,
@ -968,7 +968,7 @@ public:
LOG_INFO("Diffusion model weight type stat: %s", wtype_stat_to_str(diffusion_model_wtype_stat).c_str()); 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_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; bool have_int8_tensorwise = false;
for (const auto& [_, tensor_storage] : model_loader.get_tensor_storage_map()) { for (const auto& [_, tensor_storage] : model_loader.get_tensor_storage_map()) {
@ -1650,7 +1650,7 @@ public:
} }
} }
LOG_DEBUG("validating model metadata"); LOG_VERBOSE("validating model metadata");
std::set<std::string> ignore_tensors; std::set<std::string> ignore_tensors;
if (use_tae && !tae_preview_only) { if (use_tae && !tae_preview_only) {
@ -1707,9 +1707,9 @@ public:
LOG_ERROR("model params eager load failed"); LOG_ERROR("model params eager load failed");
return false; 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 { } 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 @@ public:
double result = static_cast<double>((out - x_t).mean()); double result = static_cast<double>((out - x_t).mean());
int64_t t1 = ggml_time_ms(); 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; return result < -1;
} }
@ -1954,7 +1954,7 @@ public:
return nullptr; return nullptr;
} }
if (lora_spec.is_high_noise) { 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<LoraModel>(lora_log_id(lora_spec), auto lora = std::make_shared<LoraModel>(lora_log_id(lora_spec),
backend_for(module), backend_for(module),
@ -2128,7 +2128,7 @@ public:
if (loras[i].is_high_noise) { if (loras[i].is_high_noise) {
lora_id = "|high_noise|" + lora_id; 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) { for (auto& extension : generation_extensions) {
@ -2424,7 +2424,7 @@ public:
float shifted_t_float = t * (float(shifted_timestep) / float(TIMESTEPS)); float shifted_t_float = t * (float(shifted_timestep) / float(TIMESTEPS));
int64_t shifted_t = static_cast<int64_t>(roundf(shifted_t_float)); int64_t shifted_t = static_cast<int64_t>(roundf(shifted_t_float));
shifted_t = std::max((int64_t)0, std::min((int64_t)(TIMESTEPS - 1), shifted_t)); 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>{(float)shifted_t}; return std::vector<float>{(float)shifted_t};
} }
if (sd_version_is_anima(version)) { if (sd_version_is_anima(version)) {
@ -2585,7 +2585,7 @@ public:
} }
} }
schedule_str += "]"; 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, sd_sample::SampleCacheRuntime cache_runtime = sd_sample::init_sample_cache_runtime(version,
@ -2642,7 +2642,7 @@ public:
auto denoise = [&](const sd::Tensor<float>& x, float sigma, int step) -> sd::guidance::GuiderOutput { auto denoise = [&](const sd::Tensor<float>& x, float sigma, int step) -> sd::guidance::GuiderOutput {
if (get_cancel_flag() == SD_CANCEL_ALL) { if (get_cancel_flag() == SD_CANCEL_ALL) {
LOG_DEBUG("cancelling generation"); LOG_VERBOSE("cancelling generation");
return {}; return {};
} }
@ -2848,7 +2848,7 @@ public:
} }
const std::vector<int>* uncond_skip_layers = nullptr; const std::vector<int>* uncond_skip_layers = nullptr;
if (is_skiplayer_step && slg_uncond) { 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_skip_layers = &skip_layer_guidance.layers();
} }
uncond_out = run_condition(uncond, uncond_out = run_condition(uncond,
@ -2883,7 +2883,7 @@ public:
} }
if (is_skiplayer_step && slg_scale != 0.0f) { 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()) { if (!step_cache.is_step_skipped()) {
guidance_input.predict_skip_layer = [&]() -> sd::Tensor<float> { guidance_input.predict_skip_layer = [&]() -> sd::Tensor<float> {
return run_condition(cond, return run_condition(cond,
@ -4392,7 +4392,7 @@ struct SamplePlan {
break; 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]); LOG_INFO("sampling using %s method", sampling_methods_str[sample_method]);
@ -4969,7 +4969,7 @@ static std::optional<ImageGenerationLatents> prepare_image_generation_latents(sd
t_enc--; t_enc--;
} }
} else { } 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) // 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, noise_level = sigma for flow models
// K = 1+sigma, noise_level=sigma/(1+sigma) for diffusion models // K = 1+sigma, noise_level=sigma/(1+sigma) for diffusion models
@ -4993,7 +4993,7 @@ static std::optional<ImageGenerationLatents> prepare_image_generation_latents(sd
sigma_sched.assign(plan->sigmas.begin() + plan->sample_steps - t_enc - 1, plan->sigmas.end()); 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) { 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; sigma_sched[0] = target_sigma;
} }
@ -5095,7 +5095,7 @@ static std::optional<ImageGenerationLatents> prepare_image_generation_latents(sd
} }
sd::Tensor<float> ref_latent; sd::Tensor<float> ref_latent;
if (ref_image_params.resize_before_vae && !sd_version_is_pid(sd_ctx->sd->version)) { 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_width;
double vae_height; double vae_height;
if (ref_image_params.resize_vae_to_target) { if (ref_image_params.resize_vae_to_target) {
@ -5118,12 +5118,12 @@ static std::optional<ImageGenerationLatents> prepare_image_generation_latents(sd
ref_images[i].shape()[2], ref_images[i].shape()[2],
ref_images[i].shape()[3]}); ref_images[i].shape()[3]});
LOG_DEBUG("resize vae ref image %d from %" PRId64 "x%" PRId64 " to %" PRId64 "x%" PRId64, LOG_VERBOSE("resize vae ref image %d from %" PRId64 "x%" PRId64 " to %" PRId64 "x%" PRId64,
static_cast<int>(i), static_cast<int>(i),
ref_images[i].shape()[1], ref_images[i].shape()[1],
ref_images[i].shape()[0], ref_images[i].shape()[0],
resized_ref_img.shape()[1], resized_ref_img.shape()[1],
resized_ref_img.shape()[0]); resized_ref_img.shape()[0]);
ref_latent = sd_ctx->sd->encode_first_stage(resized_ref_img); ref_latent = sd_ctx->sd->encode_first_stage(resized_ref_img);
} else { } 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.shape()[3] > sd_ctx->sd->get_latent_channel()) {
video_latent = sd::ops::slice(video_latent, 3, 0, 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", LOG_VERBOSE("decode_video_outputs latent %dx%dx%dx%d",
(int)video_latent.shape()[0], (int)video_latent.shape()[0],
(int)video_latent.shape()[1], (int)video_latent.shape()[1],
(int)video_latent.shape()[2], (int)video_latent.shape()[2],
(int)video_latent.shape()[3]); (int)video_latent.shape()[3]);
// auto z = sd::load_tensor_from_file_as_tensor<float>("ltx_vae_z.bin"); // auto z = sd::load_tensor_from_file_as_tensor<float>("ltx_vae_z.bin");
int64_t t4 = ggml_time_ms(); int64_t t4 = ggml_time_ms();
sd::Tensor<float> vid = sd_ctx->sd->decode_first_stage(video_latent, true); sd::Tensor<float> 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"); LOG_ERROR("decode_first_stage failed for video");
return nullptr; return nullptr;
} }
LOG_DEBUG("decode_video_outputs decoded %dx%dx%dx%d", LOG_VERBOSE("decode_video_outputs decoded %dx%dx%dx%d",
(int)vid.shape()[0], (int)vid.shape()[0],
(int)vid.shape()[1], (int)vid.shape()[1],
(int)vid.shape()[2], (int)vid.shape()[2],
(int)vid.shape()[3]); (int)vid.shape()[3]);
if (request.frames > 0 && if (request.frames > 0 &&
vid.shape()[2] > request.frames) { vid.shape()[2] > request.frames) {
vid = sd::ops::slice(vid, 2, 0, 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"); LOG_ERROR("cancelling generation before high-noise sampling");
return false; 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(); int64_t sampling_start = ggml_time_ms();
std::vector<float> high_noise_sigmas(plan.sigmas.begin(), plan.sigmas.begin() + plan.high_noise_sample_steps + 1); std::vector<float> 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"); LOG_ERROR("cancelling generation before sampling");
return false; 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(); int64_t sampling_start = ggml_time_ms();
sd::Tensor<float> final_latent = sd_ctx->sd->sample(sd_ctx->sd->diffusion_model, sd::Tensor<float> final_latent = sd_ctx->sd->sample(sd_ctx->sd->diffusion_model,
true, true,
@ -7133,7 +7133,7 @@ SD_API bool generate_video(sd_ctx_t* sd_ctx,
sd_vid_gen_params->sample_params.eta, sd_vid_gen_params->sample_params.eta,
hires_sample_method); 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", LOG_INFO("LTX latent spatial upscale refine: scheduler_steps=%d, denoising_strength=%.2f, sampler=%s, sigma_sched_size=%zu%s",
hires_scheduler_steps, hires_scheduler_steps,
request.hires.denoising_strength, request.hires.denoising_strength,
@ -7199,11 +7199,11 @@ SD_API bool generate_video(sd_ctx_t* sd_ctx,
latents.audio_length, latents.audio_length,
sd_ctx->sd->get_latent_channel()); sd_ctx->sd->get_latent_channel());
if (!audio_latent.empty()) { if (!audio_latent.empty()) {
LOG_DEBUG("decode audio latent %dx%dx%dx%d", LOG_VERBOSE("decode audio latent %dx%dx%dx%d",
(int)audio_latent.shape()[0], (int)audio_latent.shape()[0],
(int)audio_latent.shape()[1], (int)audio_latent.shape()[1],
(int)audio_latent.shape()[2], (int)audio_latent.shape()[2],
(int)audio_latent.shape()[3]); (int)audio_latent.shape()[3]);
auto waveform = sd_ctx->sd->decode_ltx_audio_latent(audio_latent); auto waveform = sd_ctx->sd->decode_ltx_audio_latent(audio_latent);
if (!waveform.empty()) { if (!waveform.empty()) {
generated_audio = waveform_to_sd_audio(sd_ctx->sd, waveform); generated_audio = waveform_to_sd_audio(sd_ctx->sd, waveform);

View File

@ -205,7 +205,7 @@ std::vector<int> BPETokenizer::encode(const std::string& text, on_new_token_cb_t
ss << "\"" << token << "\", "; ss << "\"" << token << "\", ";
} }
ss << "]"; 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; return bpe_tokens;
} }

View File

@ -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("<|startoftext|>"));
vocab.push_back(utf8_to_utf32("<|endoftext|>")); vocab.push_back(utf8_to_utf32("<|endoftext|>"));
LOG_DEBUG("vocab size: %zu", vocab.size()); LOG_VERBOSE("vocab size: %zu", vocab.size());
int i = 0; int i = 0;
for (const auto& token : vocab) { for (const auto& token : vocab) {
encoder[token] = i; encoder[token] = i;

View File

@ -29,7 +29,7 @@ void GemmaTokenizer::load_from_merges(const std::string& merges_utf8_str, const
decoder[i] = token; decoder[i] = token;
} }
encoder_len = static_cast<int>(vocab.size()); encoder_len = static_cast<int>(vocab.size());
LOG_DEBUG("vocab size: %d", encoder_len); LOG_VERBOSE("vocab size: %d", encoder_len);
std::vector<std::u32string> merges = split_utf32(merges_utf8_str); std::vector<std::u32string> merges = split_utf32(merges_utf8_str);
std::vector<std::pair<std::u32string, std::u32string>> merge_pairs; std::vector<std::pair<std::u32string, std::u32string>> merge_pairs;
@ -37,7 +37,7 @@ void GemmaTokenizer::load_from_merges(const std::string& merges_utf8_str, const
size_t space_pos = merge.find(' '); size_t space_pos = merge.find(' ');
merge_pairs.emplace_back(merge.substr(0, space_pos), merge.substr(space_pos + 1)); 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; int rank = 0;
for (const auto& merge : merge_pairs) { 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; decoder[i] = token;
} }
encoder_len = static_cast<int>(vocab.size()); encoder_len = static_cast<int>(vocab.size());
LOG_DEBUG("vocab size: %d", encoder_len); LOG_VERBOSE("vocab size: %d", encoder_len);
std::vector<std::u32string> merges = split_utf32(merges_utf8_str); std::vector<std::u32string> merges = split_utf32(merges_utf8_str);
std::vector<std::pair<std::u32string, std::u32string>> merge_pairs; std::vector<std::pair<std::u32string, std::u32string>> merge_pairs;
@ -222,7 +222,7 @@ void Gemma2Tokenizer::load_from_merges(const std::string& merges_utf8_str, const
size_t space_pos = merge.find(' '); size_t space_pos = merge.find(' ');
merge_pairs.emplace_back(merge.substr(0, space_pos), merge.substr(space_pos + 1)); 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; int rank = 0;
for (const auto& merge : merge_pairs) { for (const auto& merge : merge_pairs) {

View File

@ -31,7 +31,7 @@ void GPTOSSTokenizer::load_from_merges(const std::string& merges_utf8_str, const
encoder_len++; encoder_len++;
} }
encoder_len = static_cast<int>(encoder.size()); encoder_len = static_cast<int>(encoder.size());
LOG_DEBUG("vocab size: %d", encoder_len); LOG_VERBOSE("vocab size: %d", encoder_len);
std::vector<std::u32string> merges = split_utf32(merges_utf8_str); std::vector<std::u32string> merges = split_utf32(merges_utf8_str);
std::vector<std::pair<std::u32string, std::u32string>> merge_pairs; std::vector<std::pair<std::u32string, std::u32string>> merge_pairs;
@ -39,7 +39,7 @@ void GPTOSSTokenizer::load_from_merges(const std::string& merges_utf8_str, const
size_t space_pos = merge.find(' '); size_t space_pos = merge.find(' ');
merge_pairs.emplace_back(merge.substr(0, space_pos), merge.substr(space_pos + 1)); 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; int rank = 0;
for (const auto& merge : merge_pairs) { for (const auto& merge : merge_pairs) {

View File

@ -20,7 +20,7 @@ void MistralTokenizer::load_from_merges(const std::string& merges_utf8_str, cons
decoder[i] = token; decoder[i] = token;
} }
encoder_len = static_cast<int>(vocab.size()); encoder_len = static_cast<int>(vocab.size());
LOG_DEBUG("vocab size: %d", encoder_len); LOG_VERBOSE("vocab size: %d", encoder_len);
auto byte_unicode_pairs = bytes_to_unicode(); auto byte_unicode_pairs = bytes_to_unicode();
byte_encoder = std::map<int, std::u32string>(byte_unicode_pairs.begin(), byte_unicode_pairs.end()); byte_encoder = std::map<int, std::u32string>(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; byte_decoder[pair.second] = pair.first;
} }
std::vector<std::u32string> merges = split_utf32(merges_utf8_str); std::vector<std::u32string> merges = split_utf32(merges_utf8_str);
LOG_DEBUG("merges size %zu", merges.size()); LOG_VERBOSE("merges size %zu", merges.size());
std::vector<std::pair<std::u32string, std::u32string>> merge_pairs; std::vector<std::pair<std::u32string, std::u32string>> merge_pairs;
for (const auto& merge : merges) { for (const auto& merge : merges) {
size_t space_pos = merge.find(' '); size_t space_pos = merge.find(' ');

View File

@ -11,7 +11,7 @@ void Qwen2Tokenizer::load_from_merges(const std::string& merges_utf8_str) {
} }
std::vector<std::u32string> merges = split_utf32(merges_utf8_str); std::vector<std::u32string> merges = split_utf32(merges_utf8_str);
LOG_DEBUG("merges size %zu", merges.size()); LOG_VERBOSE("merges size %zu", merges.size());
std::vector<std::pair<std::u32string, std::u32string>> merge_pairs; std::vector<std::pair<std::u32string, std::u32string>> merge_pairs;
for (const auto& merge : merges) { for (const auto& merge : merges) {
size_t space_pos = merge.find(' '); size_t space_pos = merge.find(' ');
@ -36,7 +36,7 @@ void Qwen2Tokenizer::load_from_merges(const std::string& merges_utf8_str) {
i++; i++;
} }
encoder_len = i; encoder_len = i;
LOG_DEBUG("vocab size: %d", encoder_len); LOG_VERBOSE("vocab size: %d", encoder_len);
int rank = 0; int rank = 0;
for (const auto& merge : merge_pairs) { for (const auto& merge : merge_pairs) {

View File

@ -333,7 +333,7 @@ std::vector<int> T5UniGramTokenizer::encode(const std::string& input, on_new_tok
ss << "\"" << token_str << "\", "; ss << "\"" << token_str << "\", ";
} }
ss << "]"; 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; return tokens;
} }