This repository was archived by the owner on Nov 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
OnnxStack.Console/Examples Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 88
99namespace OnnxStack . Console . Runner
1010{
11+ using StableDiffusion ;
12+
1113 public sealed class StableDiffusionBatch : IExampleRunner
1214 {
1315 private readonly string _outputDirectory ;
@@ -56,6 +58,8 @@ public async Task RunAsync()
5658
5759 foreach ( var model in _configuration . ModelSets )
5860 {
61+ _setSchedulerTypeForPipeline ( ) ;
62+
5963 OutputHelpers . WriteConsole ( $ "Loading Model `{ model . Name } `...", ConsoleColor . Green ) ;
6064 await _stableDiffusionService . LoadModelAsync ( model ) ;
6165
@@ -76,6 +80,13 @@ public async Task RunAsync()
7680
7781 OutputHelpers . WriteConsole ( $ "Unloading Model `{ model . Name } `...", ConsoleColor . Green ) ;
7882 await _stableDiffusionService . UnloadModelAsync ( model ) ;
83+ continue ;
84+
85+ void _setSchedulerTypeForPipeline ( )
86+ {
87+ SchedulerType [ ] scheduleTypes = model . PipelineType . GetSchedulerTypes ( ) ;
88+ schedulerOptions . SchedulerType = scheduleTypes . Length == 1 ? scheduleTypes [ 0 ] : scheduleTypes [ Random . Shared . Next ( scheduleTypes . Length ) ] ;
89+ }
7990 }
8091 }
8192 }
You can’t perform that action at this time.
0 commit comments