From b7bd543c5c88fc48419255a64b1e51f8cf42b42c Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Mon, 3 Jun 2024 20:14:24 -0700 Subject: [PATCH] preemptive code in workflow gen for SD3 --- .../ComfyUIBackend/WorkflowGenerator.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs b/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs index c2c5d8be..867169f8 100644 --- a/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs +++ b/src/BuiltinExtensions/ComfyUIBackend/WorkflowGenerator.cs @@ -1268,6 +1268,13 @@ public bool IsCascade() return clazz is not null && clazz == "stable-cascade-v1"; } + /// Returns true if the current model is Stable Diffusion 3. + public bool IsSD3() + { + string clazz = CurrentCompatClass(); + return clazz is not null && clazz == "stable-diffusion-v3-medium"; + } + /// Gets a dynamic ID within a semi-stable registration set. public string GetStableDynamicID(int index, int offset) { @@ -1806,6 +1813,15 @@ public string CreateEmptyImage(int width, int height, int batchSize, string id = ["width"] = width }, id); } + else if (IsSD3()) + { + return CreateNode("EmptySD3LatentImage", new JObject() + { + ["batch_size"] = batchSize, + ["height"] = height, + ["width"] = width + }, id); + } else if (UserInput.Get(ComfyUIBackendExtension.ShiftedLatentAverageInit, false)) { double offA = 0, offB = 0, offC = 0, offD = 0;