66using System ;
77using System . Collections . ObjectModel ;
88using System . ComponentModel ;
9- using System . Linq ;
109using System . Runtime . CompilerServices ;
1110using System . Windows ;
1211using System . Windows . Controls ;
@@ -19,6 +18,7 @@ namespace OnnxStack.UI.UserControls
1918 /// </summary>
2019 public partial class SchedulerControl : UserControl , INotifyPropertyChanged
2120 {
21+ private SchedulerOptionsConfig _optionsConfig = new ( ) ;
2222
2323 /// <summary>Initializes a new instance of the <see cref="SchedulerControl" /> class.</summary>
2424 public SchedulerControl ( )
@@ -29,19 +29,18 @@ public SchedulerControl()
2929 InitializeComponent ( ) ;
3030 }
3131
32- /// <summary>Gets the reset parameters command.</summary>
33- /// <value>The reset parameters command.</value>
3432 public ICommand ResetParametersCommand { get ; }
3533 public ICommand RandomSeedCommand { get ; }
3634 public ObservableCollection < int > ValidSizes { get ; }
3735
38-
36+ /// <summary>
37+ /// Gets or sets the selected model.
38+ /// </summary>
3939 public ModelOptionsModel SelectedModel
4040 {
4141 get { return ( ModelOptionsModel ) GetValue ( SelectedModelProperty ) ; }
4242 set { SetValue ( SelectedModelProperty , value ) ; }
4343 }
44-
4544 public static readonly DependencyProperty SelectedModelProperty =
4645 DependencyProperty . Register ( "SelectedModel" , typeof ( ModelOptionsModel ) , typeof ( SchedulerControl ) , new PropertyMetadata ( ( d , e ) =>
4746 {
@@ -50,17 +49,18 @@ public ModelOptionsModel SelectedModel
5049 } ) ) ;
5150
5251
52+ /// <summary>
53+ /// Gets or sets the type of the diffuser.
54+ /// </summary>
5355 public DiffuserType DiffuserType
5456 {
5557 get { return ( DiffuserType ) GetValue ( DiffuserTypeProperty ) ; }
5658 set { SetValue ( DiffuserTypeProperty , value ) ; }
5759 }
58-
5960 public static readonly DependencyProperty DiffuserTypeProperty =
6061 DependencyProperty . Register ( "DiffuserType" , typeof ( DiffuserType ) , typeof ( SchedulerControl ) ) ;
6162
6263
63-
6464 /// <summary>
6565 /// Gets or sets the SchedulerOptions.
6666 /// </summary>
@@ -69,14 +69,18 @@ public SchedulerOptionsModel SchedulerOptions
6969 get { return ( SchedulerOptionsModel ) GetValue ( SchedulerOptionsProperty ) ; }
7070 set { SetValue ( SchedulerOptionsProperty , value ) ; }
7171 }
72+ public static readonly DependencyProperty SchedulerOptionsProperty =
73+ DependencyProperty . Register ( "SchedulerOptions" , typeof ( SchedulerOptionsModel ) , typeof ( SchedulerControl ) ) ;
7274
7375
7476 /// <summary>
75- /// The SchedulerOptions property
77+ /// Gets or sets the options configuration.
7678 /// </summary>
77- public static readonly DependencyProperty SchedulerOptionsProperty =
78- DependencyProperty . Register ( "SchedulerOptions" , typeof ( SchedulerOptionsModel ) , typeof ( SchedulerControl ) ) ;
79-
79+ public SchedulerOptionsConfig OptionsConfig
80+ {
81+ get { return _optionsConfig ; }
82+ set { _optionsConfig = value ; NotifyPropertyChanged ( ) ; }
83+ }
8084
8185
8286 /// <summary>
@@ -85,7 +89,21 @@ public SchedulerOptionsModel SchedulerOptions
8589 /// <param name="modelOptionsModel">The model options model.</param>
8690 private void OnModelChanged ( ModelOptionsModel model )
8791 {
88-
92+ if ( model is null )
93+ return ;
94+
95+ if ( model . ModelOptions . PipelineType == DiffuserPipelineType . StableDiffusion )
96+ {
97+ OptionsConfig . StepsMin = 4 ;
98+ OptionsConfig . StepsMax = 100 ;
99+ SchedulerOptions . InferenceSteps = 30 ;
100+ }
101+ else if ( model . ModelOptions . PipelineType == DiffuserPipelineType . LatentConsistency )
102+ {
103+ OptionsConfig . StepsMin = 1 ;
104+ OptionsConfig . StepsMax = 50 ;
105+ SchedulerOptions . InferenceSteps = 6 ;
106+ }
89107 }
90108
91109
0 commit comments