Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 2e998ca

Browse files
committed
ControlNet ConditioningScale batch automation
1 parent b829f58 commit 2e998ca

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

OnnxStack.StableDiffusion/Enums/BatchOptionType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public enum BatchOptionType
66
Step = 1,
77
Guidance = 2,
88
Strength = 3,
9-
Scheduler = 4
9+
Scheduler = 4,
10+
ConditioningScale = 5
1011
}
1112
}

OnnxStack.StableDiffusion/Helpers/BatchGenerator.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public static List<SchedulerOptions> GenerateBatch(IPipeline pipeline, BatchOpti
5151
.Select(x => schedulerOptions with { SchedulerType = x })
5252
.ToList();
5353
}
54+
else if (batchOptions.BatchType == BatchOptionType.ConditioningScale)
55+
{
56+
var totalIncrements = (int)Math.Max(1, (batchOptions.ValueTo - batchOptions.ValueFrom) / batchOptions.Increment);
57+
return Enumerable.Range(0, totalIncrements)
58+
.Select(x => schedulerOptions with { ConditioningScale = batchOptions.ValueFrom + (batchOptions.Increment * x) })
59+
.ToList();
60+
}
5461
return new List<SchedulerOptions>();
5562
}
5663
}

0 commit comments

Comments
 (0)