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

Commit 450e8bc

Browse files
authored
Merge pull request #106 from kimi0230/develop
chore: Examples add schedulerOptions.Width and Height ; Fix Batchinde…
2 parents 4aad8a7 + 5dcd5be commit 450e8bc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

OnnxStack.Console/Examples/StableDiffusionBatch.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ public async Task RunAsync()
6363
OutputHelpers.WriteConsole($"Loading Model `{model.Name}`...", ConsoleColor.Green);
6464
await _stableDiffusionService.LoadModelAsync(model);
6565

66+
schedulerOptions.Width = model.SampleSize;
67+
schedulerOptions.Height = model.SampleSize;
68+
6669
var batchIndex = 0;
6770
var callback = (DiffusionProgress progress) =>
6871
{
6972
batchIndex = progress.BatchValue;
7073
OutputHelpers.WriteConsole($"Image: {progress.BatchValue}/{progress.BatchMax} - Step: {progress.StepValue}/{progress.StepMax}", ConsoleColor.Cyan);
7174
};
7275

73-
await foreach (var result in _stableDiffusionService.GenerateBatchAsync(new ModelOptions(model), promptOptions, schedulerOptions, batchOptions, default))
76+
await foreach (var result in _stableDiffusionService.GenerateBatchAsync(new ModelOptions(model), promptOptions, schedulerOptions, batchOptions, callback))
7477
{
7578
var outputFilename = Path.Combine(_outputDirectory, $"{batchIndex}_{result.SchedulerOptions.Seed}.png");
7679
var image = result.ImageResult.ToImage();

OnnxStack.Console/Examples/StableDiffusionExample.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public async Task RunAsync()
5454
OutputHelpers.WriteConsole($"Loading Model `{model.Name}`...", ConsoleColor.Green);
5555
await _stableDiffusionService.LoadModelAsync(model);
5656

57+
schedulerOptions.Width = model.SampleSize;
58+
schedulerOptions.Height = model.SampleSize;
59+
5760
foreach (var schedulerType in model.PipelineType.GetSchedulerTypes())
5861
{
5962
schedulerOptions.SchedulerType = schedulerType;

0 commit comments

Comments
 (0)