From 97d2990807fe6d558e395f8764198d7c7e7b411c Mon Sep 17 00:00:00 2001 From: leejet Date: Wed, 19 Aug 2026 23:06:07 +0800 Subject: [PATCH] chore: format code --- examples/common/common.cpp | 12 +++++------- scripts/merge_safetensors.py | 6 +++--- src/core/ggml_graph_cut.cpp | 2 +- src/model/vae/tae.hpp | 6 +++--- src/runtime/denoiser.hpp | 8 ++++---- src/stable-diffusion.cpp | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/examples/common/common.cpp b/examples/common/common.cpp index 91459bc3..35812157 100644 --- a/examples/common/common.cpp +++ b/examples/common/common.cpp @@ -1556,14 +1556,12 @@ ArgOptions SDGenerationParams::get_options() { }; std::string sample_methods = sample_method_to_str[0]; - for (int i = 1; i < SAMPLE_METHOD_COUNT; i++) - { + for (int i = 1; i < SAMPLE_METHOD_COUNT; i++) { sample_methods += ", " + std::string(sample_method_to_str[i]); } std::string schedulers = scheduler_to_str[0]; - for (int i = 1; i < SCHEDULER_COUNT; i++) - { + for (int i = 1; i < SCHEDULER_COUNT; i++) { schedulers += ", " + std::string(scheduler_to_str[i]); } @@ -1575,17 +1573,17 @@ ArgOptions SDGenerationParams::get_options() { {"", "--sampling-method", "sampling method, one of [" + sample_methods + "], " - "default: euler for Flux/SD3/Wan, euler_a otherwise", + "default: euler for Flux/SD3/Wan, euler_a otherwise", on_sample_method_arg}, {"", "--high-noise-sampling-method", "(high noise) sampling method, one of [" + sample_methods + "], " - "default: euler for Flux/SD3/Wan, euler_a otherwise", + "default: euler for Flux/SD3/Wan, euler_a otherwise", on_high_noise_sample_method_arg}, {"", "--scheduler", "denoiser sigma scheduler, one of [" + schedulers + "], " - "alias: normal=discrete, default: model-specific", + "alias: normal=discrete, default: model-specific", on_scheduler_arg}, {"", "--sigmas", diff --git a/scripts/merge_safetensors.py b/scripts/merge_safetensors.py index aebae306..7f269364 100644 --- a/scripts/merge_safetensors.py +++ b/scripts/merge_safetensors.py @@ -23,16 +23,16 @@ from typing import BinaryIO # Configuration # ----------------------------------------------------------------------------- -OUTPUT_PATH = Path(r"..\models\diffusion_models\minimax_h3_ref2va_pruned_bf16.safetensors") +OUTPUT_PATH = Path(r".minimax_h3_fl2va_pruned_bf16.safetensors") SOURCE_RULES = [ { - "path": Path(r"..\models\diffusion_models\minimax_h3_ref2va_bf16.safetensors"), + "path": Path(r".minimax_h3_fl2va_bf16.safetensors"), "include": [r".*"], "exclude": [r".*adaln_proj\.linear.*", r"time_embedder.*"], }, { - "path": Path(r"..\models\diffusion_models\minimax_h3_ref2va_pruned_int8_convrot.safetensors"), + "path": Path(r".minimax_h3_fl2va_pruned_int8_convrot.safetensors"), "include": [r"^.*adaln_proj\.linear.*", "adaln_t_table"], "exclude": [], }, diff --git a/src/core/ggml_graph_cut.cpp b/src/core/ggml_graph_cut.cpp index eec43bbd..542b7fe1 100644 --- a/src/core/ggml_graph_cut.cpp +++ b/src/core/ggml_graph_cut.cpp @@ -454,7 +454,7 @@ namespace sd::ggml_graph_cut { return false; } return starts_with(tensor->name, GGML_RUNNER_CUT_PREFIX) && - ends_with(tensor->name, GGML_RUNNER_CUT_SUFFIX); + ends_with(tensor->name, GGML_RUNNER_CUT_SUFFIX); } std::string make_graph_cut_name(const std::string& group, const std::string& output) { diff --git a/src/model/vae/tae.hpp b/src/model/vae/tae.hpp index 015a6283..a03e5d21 100644 --- a/src/model/vae/tae.hpp +++ b/src/model/vae/tae.hpp @@ -427,9 +427,9 @@ class TinyVideoDecoder : public UnaryBlock { int channels[num_layers + 1] = {256, 128, 64, 64}; int patch_size = 1; bool is_wide = false; - + public: - int t_upscale = 1; + int t_upscale = 1; TinyVideoDecoder(int z_channels = 4, int patch_size = 1, std::vector time_upscale = {false, true, true}, bool is_wide = false) : z_channels(z_channels), patch_size(patch_size), is_wide(is_wide) { t_upscale = 1; @@ -663,7 +663,7 @@ public: if (sd_version_is_minimax_h3(version)) { return encode_h3(ctx, x); } - + auto encoder = std::dynamic_pointer_cast(blocks["encoder"]); int64_t num_frames = x->ne[3]; diff --git a/src/runtime/denoiser.hpp b/src/runtime/denoiser.hpp index 38517d03..e4d9af02 100644 --- a/src/runtime/denoiser.hpp +++ b/src/runtime/denoiser.hpp @@ -2586,7 +2586,7 @@ static sd::Tensor sample_lms(denoise_cb_t model, // modified with "history shift" value, which seemingly needs less steps int divisions = 1000; int max_order = 4; - int shift = 1; // 4, 0 - original; 4, 1 - PR #1843; 3, 1 - smoother image + int shift = 1; // 4, 0 - original; 4, 1 - PR #1843; 3, 1 - smoother image for (const auto& [key, value] : extra_sample_args) { int parsed = 0; if (key == "lms_max_order") { @@ -2624,7 +2624,7 @@ static sd::Tensor sample_lms(denoise_cb_t model, auto linear_multistep_coeff = [=](const int order, const int m, const int j) -> float { if (!divisions) return sigmas[m + 1] - sigmas[m]; // delta / 0 * 0 -#define LMS_PRECISION float // when divisions > 30 millions, the double precision fixes noise +#define LMS_PRECISION float // when divisions > 30 millions, the double precision fixes noise const LMS_PRECISION a = sigmas[m], dx = (sigmas[m + 1] - a) / divisions, s = sigmas[m - j]; const LMS_PRECISION b0 = a + 0.5f * dx; // using Riemann middle integral LMS_PRECISION sum = 0.0f; @@ -2672,8 +2672,8 @@ static sd::Tensor sample_lms(denoise_cb_t model, int hist_max = hist.size() - 1; for (int c = 2; c <= order; c++) x += hist[std::min(hist_max, hist_size_p1 - c + shift)] * lms_coeff[c - 1]; - // max_order == 4 => hist[] index = 2, 1, 0 - // shift == 1 => hist[] index = 2, 2, 1 + // max_order == 4 => hist[] index = 2, 1, 0 + // shift == 1 => hist[] index = 2, 2, 1 } if (hist_size_p1 == max_order) { hist.erase(hist.begin()); diff --git a/src/stable-diffusion.cpp b/src/stable-diffusion.cpp index 26c21dbb..109a2a48 100644 --- a/src/stable-diffusion.cpp +++ b/src/stable-diffusion.cpp @@ -2315,7 +2315,7 @@ public: return; } } else if (channels == 24) { - if(sd_version_is_minimax_h3(version)){ + if (sd_version_is_minimax_h3(version)) { latent_rgb_proj = minimax_latent_rgb_proj; latent_rgb_bias = minimax_latent_rgb_bias; } else {