mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-01-02 18:53:36 +00:00
fix: avoid crash when using taesd for preview only (#1141)
This commit is contained in:
parent
a0adcfb148
commit
860a78e248
@ -591,8 +591,8 @@ public:
|
|||||||
vae_backend = backend;
|
vae_backend = backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!use_tiny_autoencoder || sd_ctx_params->tae_preview_only) {
|
||||||
if (sd_version_is_wan(version) || sd_version_is_qwen_image(version)) {
|
if (sd_version_is_wan(version) || sd_version_is_qwen_image(version)) {
|
||||||
if (!use_tiny_autoencoder) {
|
|
||||||
first_stage_model = std::make_shared<WAN::WanVAERunner>(vae_backend,
|
first_stage_model = std::make_shared<WAN::WanVAERunner>(vae_backend,
|
||||||
offload_params_to_cpu,
|
offload_params_to_cpu,
|
||||||
tensor_storage_map,
|
tensor_storage_map,
|
||||||
@ -601,22 +601,10 @@ public:
|
|||||||
version);
|
version);
|
||||||
first_stage_model->alloc_params_buffer();
|
first_stage_model->alloc_params_buffer();
|
||||||
first_stage_model->get_param_tensors(tensors, "first_stage_model");
|
first_stage_model->get_param_tensors(tensors, "first_stage_model");
|
||||||
} else {
|
|
||||||
tae_first_stage = std::make_shared<TinyVideoAutoEncoder>(vae_backend,
|
|
||||||
offload_params_to_cpu,
|
|
||||||
tensor_storage_map,
|
|
||||||
"decoder",
|
|
||||||
vae_decode_only,
|
|
||||||
version);
|
|
||||||
if (sd_ctx_params->vae_conv_direct) {
|
|
||||||
LOG_INFO("Using Conv2d direct in the tae model");
|
|
||||||
tae_first_stage->set_conv2d_direct_enabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (version == VERSION_CHROMA_RADIANCE) {
|
} else if (version == VERSION_CHROMA_RADIANCE) {
|
||||||
first_stage_model = std::make_shared<FakeVAE>(vae_backend,
|
first_stage_model = std::make_shared<FakeVAE>(vae_backend,
|
||||||
offload_params_to_cpu);
|
offload_params_to_cpu);
|
||||||
} else if (!use_tiny_autoencoder || sd_ctx_params->tae_preview_only) {
|
} else {
|
||||||
first_stage_model = std::make_shared<AutoEncoderKL>(vae_backend,
|
first_stage_model = std::make_shared<AutoEncoderKL>(vae_backend,
|
||||||
offload_params_to_cpu,
|
offload_params_to_cpu,
|
||||||
tensor_storage_map,
|
tensor_storage_map,
|
||||||
@ -639,19 +627,30 @@ public:
|
|||||||
}
|
}
|
||||||
first_stage_model->alloc_params_buffer();
|
first_stage_model->alloc_params_buffer();
|
||||||
first_stage_model->get_param_tensors(tensors, "first_stage_model");
|
first_stage_model->get_param_tensors(tensors, "first_stage_model");
|
||||||
} else if (use_tiny_autoencoder) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (use_tiny_autoencoder) {
|
||||||
|
if (sd_version_is_wan(version) || sd_version_is_qwen_image(version)) {
|
||||||
|
tae_first_stage = std::make_shared<TinyVideoAutoEncoder>(vae_backend,
|
||||||
|
offload_params_to_cpu,
|
||||||
|
tensor_storage_map,
|
||||||
|
"decoder",
|
||||||
|
vae_decode_only,
|
||||||
|
version);
|
||||||
|
} else {
|
||||||
tae_first_stage = std::make_shared<TinyImageAutoEncoder>(vae_backend,
|
tae_first_stage = std::make_shared<TinyImageAutoEncoder>(vae_backend,
|
||||||
offload_params_to_cpu,
|
offload_params_to_cpu,
|
||||||
tensor_storage_map,
|
tensor_storage_map,
|
||||||
"decoder.layers",
|
"decoder.layers",
|
||||||
vae_decode_only,
|
vae_decode_only,
|
||||||
version);
|
version);
|
||||||
|
}
|
||||||
if (sd_ctx_params->vae_conv_direct) {
|
if (sd_ctx_params->vae_conv_direct) {
|
||||||
LOG_INFO("Using Conv2d direct in the tae model");
|
LOG_INFO("Using Conv2d direct in the tae model");
|
||||||
tae_first_stage->set_conv2d_direct_enabled(true);
|
tae_first_stage->set_conv2d_direct_enabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// first_stage_model->get_param_tensors(tensors, "first_stage_model.");
|
|
||||||
|
|
||||||
if (strlen(SAFE_STR(sd_ctx_params->control_net_path)) > 0) {
|
if (strlen(SAFE_STR(sd_ctx_params->control_net_path)) > 0) {
|
||||||
ggml_backend_t controlnet_backend = nullptr;
|
ggml_backend_t controlnet_backend = nullptr;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user