Skip to content

Commit 849845b

Browse files
authored
Merge pull request #58 from DarthAffe/Chroma
Added chroma model parameters
2 parents bbf5743 + 89cf310 commit 849845b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

StableDiffusion.NET/Models/DiffusionModel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ private void Initialize()
6161
ModelParameter.KeepClipOnCPU,
6262
ModelParameter.KeepControlNetOnCPU,
6363
ModelParameter.KeepVaeOnCPU,
64-
ModelParameter.FlashAttention);
64+
ModelParameter.FlashAttention,
65+
ModelParameter.ChromaUseDitMap,
66+
ModelParameter.ChromaEnableT5Map,
67+
ModelParameter.ChromaT5MaskPad);
6568

6669
if (_ctx == null) throw new NullReferenceException("Failed to initialize diffusion-model.");
6770
}

StableDiffusion.NET/Models/Parameter/DiffusionModelParameter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public sealed class DiffusionModelParameter : IDiffusionModelParameter, IQuantiz
109109
/// </summary>
110110
public string T5xxlPath { get; set; } = string.Empty;
111111

112+
// Flux Chroma specific
113+
public bool ChromaUseDitMap { get; set; } = true;
114+
public bool ChromaEnableT5Map { get; set; } = false;
115+
public int ChromaT5MaskPad { get; set; } = 1;
116+
112117
// SD3.5 only
113118
/// <summary>
114119
/// path to the clip-g text encoder

StableDiffusion.NET/Native/Native.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ internal struct sd_image_t
7070
[MarshalAs(UnmanagedType.I1)] bool keep_clip_on_cpu,
7171
[MarshalAs(UnmanagedType.I1)] bool keep_control_net_cpu,
7272
[MarshalAs(UnmanagedType.I1)] bool keep_vae_on_cpu,
73-
[MarshalAs(UnmanagedType.I1)] bool diffusion_flash_attn);
73+
[MarshalAs(UnmanagedType.I1)] bool diffusion_flash_attn,
74+
[MarshalAs(UnmanagedType.I1)] bool chroma_use_dit_mask,
75+
[MarshalAs(UnmanagedType.I1)] bool chroma_use_t5_mask,
76+
int chroma_t5_mask_pad);
7477

7578
[LibraryImport(LIB_NAME, EntryPoint = "free_sd_ctx")]
7679
internal static partial void free_sd_ctx(sd_ctx_t* sd_ctx);

0 commit comments

Comments
 (0)