mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-10 19:06:33 +00:00
feat: add automatic direct convolution selection (#2134)
This commit is contained in:
1 parent
d763dae3b8
commit
46362fc4c0
15 files changed
+259
-50
No files matched your search
@@ -636,14 +636,6 @@ ArgOptions SDContextParams::get_options() {
|
||||
"--sage-attn",
|
||||
"use native CUDA SageAttention in the diffusion model, with flash/default attention fallback",
|
||||
true, &sage_attn},
|
||||
{"",
|
||||
"--diffusion-conv-direct",
|
||||
"use ggml_conv2d_direct in the diffusion model",
|
||||
true, &diffusion_conv_direct},
|
||||
{"",
|
||||
"--vae-conv-direct",
|
||||
"use direct 2D and 3D convolutions in the vae model",
|
||||
true, &vae_conv_direct},
|
||||
};
|
||||
|
||||
auto on_type_arg = [&](int argc, const char** argv, int index) {
|
||||
@@ -729,6 +721,33 @@ ArgOptions SDContextParams::get_options() {
|
||||
[this](int argc, const char** argv, int index) {
|
||||
return parse_scale_override(argc, argv, index, attn_scale);
|
||||
}},
|
||||
{"",
|
||||
"--diffusion-conv-direct",
|
||||
"deprecated; use --conv-direct auto,diffusion=on,controlnet=on",
|
||||
[this](int, const char**, int) {
|
||||
LOG_WARN("--diffusion-conv-direct is deprecated; use --conv-direct auto,diffusion=on,controlnet=on instead.");
|
||||
diffusion_conv_direct = true;
|
||||
return 0;
|
||||
}},
|
||||
{"",
|
||||
"--vae-conv-direct",
|
||||
"deprecated; use --conv-direct auto,vae=on",
|
||||
[this](int, const char**, int) {
|
||||
LOG_WARN("--vae-conv-direct is deprecated; use --conv-direct auto,vae=on instead.");
|
||||
vae_conv_direct = true;
|
||||
return 0;
|
||||
}},
|
||||
{"",
|
||||
"--conv-direct",
|
||||
"on|off|auto or diffusion/vae/controlnet assignments (default: auto), e.g. auto,vae=off. Overrides legacy convolution flags",
|
||||
[this](int argc, const char** argv, int index) {
|
||||
if (++index >= argc || argv[index][0] == '\0') {
|
||||
LOG_ERROR("--conv-direct requires on, off, auto, or module assignments");
|
||||
return -1;
|
||||
}
|
||||
conv_direct_mode = argv[index];
|
||||
return 1;
|
||||
}},
|
||||
{"",
|
||||
"--flash-attn",
|
||||
"on|off|auto or module assignments (default: auto), e.g. auto,te=off,vae=on. Last repeated option wins",
|
||||
@@ -984,6 +1003,7 @@ std::string SDContextParams::to_string() const {
|
||||
<< " clip_on_cpu: " << (clip_on_cpu ? "true" : "false") << ",\n"
|
||||
<< " vae_on_cpu: " << (vae_on_cpu ? "true" : "false") << ",\n"
|
||||
<< " flash_attn_mode: " << flash_attn_mode << ",\n"
|
||||
<< " conv_direct_mode: " << (conv_direct_mode.empty() ? "auto (legacy flags honored)" : conv_direct_mode) << ",\n"
|
||||
<< " sage_attn: " << (sage_attn ? "true" : "false") << ",\n"
|
||||
<< " linear_scale: " << linear_scale << ",\n"
|
||||
<< " attn_scale: " << attn_scale << ",\n"
|
||||
@@ -1042,6 +1062,7 @@ sd_ctx_params_t SDContextParams::to_sd_ctx_params_t(bool taesd_preview) {
|
||||
sd_ctx_params.lora_apply_mode = lora_apply_mode;
|
||||
sd_ctx_params.enable_mmap = enable_mmap;
|
||||
sd_ctx_params.flash_attn_mode = flash_attn_mode.c_str();
|
||||
sd_ctx_params.conv_direct_mode = conv_direct_mode.c_str();
|
||||
sd_ctx_params.sage_attn = sage_attn;
|
||||
sd_ctx_params.linear_scale = linear_scale;
|
||||
sd_ctx_params.attn_scale = attn_scale;
|
||||
|
||||
Reference in new issue
Block a user