mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-12 13:28:35 +00:00
Changed vae to be required for flux models and allow all non null inputs
This commit is contained in:
parent
da9f612c03
commit
ae70f7e5f0
@ -9,7 +9,7 @@ public static class DiffusionModelBuilderExtension
|
||||
public static T WithVae<T>(this T builder, string vaePath)
|
||||
where T : IDiffusionModelBuilder
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(vaePath);
|
||||
ArgumentNullException.ThrowIfNull(vaePath);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(builder.Parameter.TaesdPath)) throw new ArgumentException("TAESD is already enabled. VAE and TAESD are mutually exclusive.", nameof(vaePath));
|
||||
|
||||
@ -21,7 +21,7 @@ public static class DiffusionModelBuilderExtension
|
||||
public static T WithTaesd<T>(this T builder, string taesdPath)
|
||||
where T : IDiffusionModelBuilder
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(taesdPath);
|
||||
ArgumentNullException.ThrowIfNull(taesdPath);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(builder.Parameter.VaePath)) throw new ArgumentException("VAE is already enabled. TAESD and VAE are mutually exclusive.", nameof(taesdPath));
|
||||
|
||||
@ -33,7 +33,7 @@ public static class DiffusionModelBuilderExtension
|
||||
public static T WithLoraSupport<T>(this T builder, string loraModelDirectory)
|
||||
where T : IDiffusionModelBuilder
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(loraModelDirectory);
|
||||
ArgumentNullException.ThrowIfNull(loraModelDirectory);
|
||||
|
||||
builder.Parameter.LoraModelDirectory = loraModelDirectory;
|
||||
|
||||
@ -43,7 +43,7 @@ public static class DiffusionModelBuilderExtension
|
||||
public static T WithEmbeddingSupport<T>(this T builder, string embeddingsDirectory)
|
||||
where T : IDiffusionModelBuilder
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(embeddingsDirectory);
|
||||
ArgumentNullException.ThrowIfNull(embeddingsDirectory);
|
||||
|
||||
builder.Parameter.EmbeddingsDirectory = embeddingsDirectory;
|
||||
|
||||
@ -53,7 +53,7 @@ public static class DiffusionModelBuilderExtension
|
||||
public static T WithControlNet<T>(this T builder, string controlNetPath)
|
||||
where T : IDiffusionModelBuilder
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(controlNetPath);
|
||||
ArgumentNullException.ThrowIfNull(controlNetPath);
|
||||
|
||||
builder.Parameter.ControlNetPath = controlNetPath;
|
||||
|
||||
|
||||
@ -15,9 +15,9 @@ public sealed class FluxModelBuilder : IDiffusionModelBuilder, IQuantizedModelBu
|
||||
|
||||
#region Constructors
|
||||
|
||||
public FluxModelBuilder(string diffusionModelPath, string clipLPath, string t5xxlPath)
|
||||
public FluxModelBuilder(string diffusionModelPath, string clipLPath, string t5xxlPath, string vaePath)
|
||||
{
|
||||
Parameter = new DiffusionModelParameter { DiffusionModelType = DiffusionModelType.Flux, DiffusionModelPath = diffusionModelPath, ClipLPath = clipLPath, T5xxlPath = t5xxlPath };
|
||||
Parameter = new DiffusionModelParameter { DiffusionModelType = DiffusionModelType.Flux, DiffusionModelPath = diffusionModelPath, ClipLPath = clipLPath, T5xxlPath = t5xxlPath, VaePath = vaePath };
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -6,6 +6,6 @@ namespace StableDiffusion.NET;
|
||||
public static class ModelBuilder
|
||||
{
|
||||
public static StableDiffusionModelBuilder StableDiffusion(string modelPath) => new(modelPath);
|
||||
public static FluxModelBuilder Flux(string diffusionModelPath, string clipLPath, string t5xxlPath) => new(diffusionModelPath, clipLPath, t5xxlPath);
|
||||
public static FluxModelBuilder Flux(string diffusionModelPath, string clipLPath, string t5xxlPath, string vaePath) => new(diffusionModelPath, clipLPath, t5xxlPath, vaePath);
|
||||
public static ESRGANModelBuilder ESRGAN(string modelPath) => new(modelPath);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user