From e6297d485f1c0fc18fa3a6b17e71a141c1985bc7 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Mon, 27 Oct 2025 19:46:46 +0100 Subject: [PATCH] Mapped FreeParamsImmediately-Parameter --- .../Models/Parameter/DiffusionModelParameter.cs | 4 +++- .../Native/Marshaller/DiffusionModelParameterMarshaller.cs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/StableDiffusion.NET/Models/Parameter/DiffusionModelParameter.cs b/StableDiffusion.NET/Models/Parameter/DiffusionModelParameter.cs index 89391cd..64d375c 100644 --- a/StableDiffusion.NET/Models/Parameter/DiffusionModelParameter.cs +++ b/StableDiffusion.NET/Models/Parameter/DiffusionModelParameter.cs @@ -41,6 +41,8 @@ public sealed class DiffusionModelParameter /// public bool VaeDecodeOnly { get; set; } = false; + public bool FreeParamsImmediately { get; set; } = false; + /// /// process vae in tiles to reduce memory usage /// @@ -103,7 +105,7 @@ public sealed class DiffusionModelParameter /// path to PHOTOMAKER stacked id embeddings /// public string StackedIdEmbeddingsDirectory { get; set; } = string.Empty; - + /// /// path to full model /// diff --git a/StableDiffusion.NET/Native/Marshaller/DiffusionModelParameterMarshaller.cs b/StableDiffusion.NET/Native/Marshaller/DiffusionModelParameterMarshaller.cs index 8f14ec8..b975543 100644 --- a/StableDiffusion.NET/Native/Marshaller/DiffusionModelParameterMarshaller.cs +++ b/StableDiffusion.NET/Native/Marshaller/DiffusionModelParameterMarshaller.cs @@ -25,7 +25,7 @@ internal static unsafe class DiffusionModelParameterMarshaller embedding_dir = AnsiStringMarshaller.ConvertToUnmanaged(managed.EmbeddingsDirectory), photo_maker_path = AnsiStringMarshaller.ConvertToUnmanaged(managed.StackedIdEmbeddingsDirectory), vae_decode_only = (sbyte)(managed.VaeDecodeOnly ? 1 : 0), - free_params_immediately = 0, // DarthAffe 06.08.2025: Static value + free_params_immediately = (sbyte)(managed.FreeParamsImmediately ? 1 : 0), n_threads = managed.ThreadCount, wtype = managed.Quantization, rng_type = managed.RngType, @@ -63,6 +63,7 @@ internal static unsafe class DiffusionModelParameterMarshaller EmbeddingsDirectory = AnsiStringMarshaller.ConvertToManaged(unmanaged.embedding_dir) ?? string.Empty, StackedIdEmbeddingsDirectory = AnsiStringMarshaller.ConvertToManaged(unmanaged.photo_maker_path) ?? string.Empty, VaeDecodeOnly = unmanaged.vae_decode_only == 1, + FreeParamsImmediately = unmanaged.free_params_immediately == 1, ThreadCount = unmanaged.n_threads, Quantization = unmanaged.wtype, RngType = unmanaged.rng_type,