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

Commit bcece62

Browse files
committed
Fix incorrect video result width/height
1 parent 04d64fc commit bcece62

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

OnnxStack.StableDiffusion/Pipelines/StableDiffusionPipeline.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System.Collections.Generic;
1717
using System.Linq;
1818
using System.Runtime.CompilerServices;
19+
using System.Runtime.Intrinsics.X86;
1920
using System.Threading;
2021
using System.Threading.Tasks;
2122

@@ -243,7 +244,13 @@ public override async IAsyncEnumerable<BatchImageResult> GenerateImageBatchAsync
243244
public override async Task<OnnxVideo> GenerateVideoAsync(PromptOptions promptOptions, SchedulerOptions schedulerOptions = default, ControlNetModel controlNet = default, Action<DiffusionProgress> progressCallback = null, CancellationToken cancellationToken = default)
244245
{
245246
var tensors = await RunInternalAsync(promptOptions, schedulerOptions, controlNet, progressCallback, cancellationToken);
246-
return new OnnxVideo(promptOptions.InputVideo.Info, tensors);
247+
var videoInfo = promptOptions.InputVideo.Info with
248+
{
249+
Width = schedulerOptions.Width,
250+
Height = schedulerOptions.Height
251+
};
252+
progressCallback?.Invoke(new DiffusionProgress("Generating Video Result..."));
253+
return new OnnxVideo(videoInfo, tensors);
247254
}
248255

249256

@@ -261,7 +268,13 @@ public override async IAsyncEnumerable<BatchVideoResult> GenerateVideoBatchAsync
261268
{
262269
await foreach (var batchResult in RunBatchInternalAsync(batchOptions, promptOptions, schedulerOptions, controlNet, progressCallback, cancellationToken))
263270
{
264-
yield return new BatchVideoResult(batchResult.SchedulerOptions, new OnnxVideo(promptOptions.InputVideo.Info, batchResult.Result));
271+
var videoInfo = promptOptions.InputVideo.Info with
272+
{
273+
Width = batchResult.SchedulerOptions.Width,
274+
Height = batchResult.SchedulerOptions.Height
275+
};
276+
progressCallback?.Invoke(new DiffusionProgress("Generating Video Result..."));
277+
yield return new BatchVideoResult(batchResult.SchedulerOptions, new OnnxVideo(videoInfo, batchResult.Result));
265278
}
266279
}
267280

0 commit comments

Comments
 (0)