mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-09-25 04:32:29 +00:00
chore: format code
This commit is contained in:
parent
16304cc3fd
commit
97d2990807
@ -1556,14 +1556,12 @@ ArgOptions SDGenerationParams::get_options() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::string sample_methods = sample_method_to_str[0];
|
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]);
|
sample_methods += ", " + std::string(sample_method_to_str[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string schedulers = scheduler_to_str[0];
|
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]);
|
schedulers += ", " + std::string(scheduler_to_str[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1575,17 +1573,17 @@ ArgOptions SDGenerationParams::get_options() {
|
|||||||
{"",
|
{"",
|
||||||
"--sampling-method",
|
"--sampling-method",
|
||||||
"sampling method, one of [" + sample_methods + "], "
|
"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},
|
on_sample_method_arg},
|
||||||
{"",
|
{"",
|
||||||
"--high-noise-sampling-method",
|
"--high-noise-sampling-method",
|
||||||
"(high noise) sampling method, one of [" + sample_methods + "], "
|
"(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},
|
on_high_noise_sample_method_arg},
|
||||||
{"",
|
{"",
|
||||||
"--scheduler",
|
"--scheduler",
|
||||||
"denoiser sigma scheduler, one of [" + schedulers + "], "
|
"denoiser sigma scheduler, one of [" + schedulers + "], "
|
||||||
"alias: normal=discrete, default: model-specific",
|
"alias: normal=discrete, default: model-specific",
|
||||||
on_scheduler_arg},
|
on_scheduler_arg},
|
||||||
{"",
|
{"",
|
||||||
"--sigmas",
|
"--sigmas",
|
||||||
|
|||||||
@ -23,16 +23,16 @@ from typing import BinaryIO
|
|||||||
# Configuration
|
# 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 = [
|
SOURCE_RULES = [
|
||||||
{
|
{
|
||||||
"path": Path(r"..\models\diffusion_models\minimax_h3_ref2va_bf16.safetensors"),
|
"path": Path(r".minimax_h3_fl2va_bf16.safetensors"),
|
||||||
"include": [r".*"],
|
"include": [r".*"],
|
||||||
"exclude": [r".*adaln_proj\.linear.*", r"time_embedder.*"],
|
"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"],
|
"include": [r"^.*adaln_proj\.linear.*", "adaln_t_table"],
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -454,7 +454,7 @@ namespace sd::ggml_graph_cut {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return starts_with(tensor->name, GGML_RUNNER_CUT_PREFIX) &&
|
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) {
|
std::string make_graph_cut_name(const std::string& group, const std::string& output) {
|
||||||
|
|||||||
@ -429,7 +429,7 @@ class TinyVideoDecoder : public UnaryBlock {
|
|||||||
bool is_wide = false;
|
bool is_wide = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int t_upscale = 1;
|
int t_upscale = 1;
|
||||||
TinyVideoDecoder(int z_channels = 4, int patch_size = 1, std::vector<bool> time_upscale = {false, true, true}, bool is_wide = false)
|
TinyVideoDecoder(int z_channels = 4, int patch_size = 1, std::vector<bool> time_upscale = {false, true, true}, bool is_wide = false)
|
||||||
: z_channels(z_channels), patch_size(patch_size), is_wide(is_wide) {
|
: z_channels(z_channels), patch_size(patch_size), is_wide(is_wide) {
|
||||||
t_upscale = 1;
|
t_upscale = 1;
|
||||||
|
|||||||
@ -2586,7 +2586,7 @@ static sd::Tensor<float> sample_lms(denoise_cb_t model,
|
|||||||
// modified with "history shift" value, which seemingly needs less steps
|
// modified with "history shift" value, which seemingly needs less steps
|
||||||
int divisions = 1000;
|
int divisions = 1000;
|
||||||
int max_order = 4;
|
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) {
|
for (const auto& [key, value] : extra_sample_args) {
|
||||||
int parsed = 0;
|
int parsed = 0;
|
||||||
if (key == "lms_max_order") {
|
if (key == "lms_max_order") {
|
||||||
@ -2624,7 +2624,7 @@ static sd::Tensor<float> sample_lms(denoise_cb_t model,
|
|||||||
auto linear_multistep_coeff = [=](const int order, const int m, const int j) -> float {
|
auto linear_multistep_coeff = [=](const int order, const int m, const int j) -> float {
|
||||||
if (!divisions)
|
if (!divisions)
|
||||||
return sigmas[m + 1] - sigmas[m]; // delta / 0 * 0
|
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 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
|
const LMS_PRECISION b0 = a + 0.5f * dx; // using Riemann middle integral
|
||||||
LMS_PRECISION sum = 0.0f;
|
LMS_PRECISION sum = 0.0f;
|
||||||
@ -2672,8 +2672,8 @@ static sd::Tensor<float> sample_lms(denoise_cb_t model,
|
|||||||
int hist_max = hist.size() - 1;
|
int hist_max = hist.size() - 1;
|
||||||
for (int c = 2; c <= order; c++)
|
for (int c = 2; c <= order; c++)
|
||||||
x += hist[std::min(hist_max, hist_size_p1 - c + shift)] * lms_coeff[c - 1];
|
x += hist[std::min(hist_max, hist_size_p1 - c + shift)] * lms_coeff[c - 1];
|
||||||
// max_order == 4 => hist[] index = 2, 1, 0
|
// max_order == 4 => hist[] index = 2, 1, 0
|
||||||
// shift == 1 => hist[] index = 2, 2, 1
|
// shift == 1 => hist[] index = 2, 2, 1
|
||||||
}
|
}
|
||||||
if (hist_size_p1 == max_order) {
|
if (hist_size_p1 == max_order) {
|
||||||
hist.erase(hist.begin());
|
hist.erase(hist.begin());
|
||||||
|
|||||||
@ -2315,7 +2315,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (channels == 24) {
|
} 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_proj = minimax_latent_rgb_proj;
|
||||||
latent_rgb_bias = minimax_latent_rgb_bias;
|
latent_rgb_bias = minimax_latent_rgb_bias;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user