mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-09-24 20:20:37 +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];
|
||||
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",
|
||||
|
||||
@ -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": [],
|
||||
},
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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<bool> 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<TinyVideoEncoder>(blocks["encoder"]);
|
||||
|
||||
int64_t num_frames = x->ne[3];
|
||||
|
||||
@ -2586,7 +2586,7 @@ static sd::Tensor<float> 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<float> 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<float> 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());
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user