mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 03:24:30 +00:00
fix: disable batch_cfg for Metal when building with upstream ggml (#2311)
This commit is contained in:
1 parent
fc350be2ce
commit
f977addf06
1 file changed
+10
@@ -2440,6 +2440,15 @@ sd::Tensor<float> StableDiffusionGGML::sample(const std::shared_ptr<DiffusionMod
|
||||
: sampling_init_latent;
|
||||
sd::Tensor<float> denoised = x_t;
|
||||
|
||||
#ifdef SD_USE_UPSTREAM_GGML
|
||||
// workaround for sd.cpp #2149
|
||||
const auto diffusion_backends = backend_manager.runtime_backends(SDBackendModule::DIFFUSION);
|
||||
const bool batch_cfg_backend_ok = std::none_of(diffusion_backends.begin(), diffusion_backends.end(),
|
||||
[](ggml_backend_t backend) { return sd_backend_is(backend, "MTL"); });
|
||||
#else
|
||||
const bool batch_cfg_backend_ok = true;
|
||||
#endif
|
||||
|
||||
auto denoise = [&](const sd::Tensor<float>& x, float sigma, int step) -> sd::guidance::GuiderOutput {
|
||||
if (get_cancel_flag() == SD_CANCEL_ALL) {
|
||||
LOG_VERBOSE("cancelling generation");
|
||||
@@ -2762,6 +2771,7 @@ sd::Tensor<float> StableDiffusionGGML::sample(const std::shared_ptr<DiffusionMod
|
||||
}
|
||||
|
||||
const bool batch_cfg_ok = config_->params.batched_cfg &&
|
||||
batch_cfg_backend_ok &&
|
||||
sd_version_is_unet(version) &&
|
||||
!uncond.empty() &&
|
||||
img_uncond.empty() &&
|
||||
|
||||
Reference in new issue
Block a user