11using Microsoft . Extensions . Logging ;
22using OnnxStack . StableDiffusion . Config ;
3- using OnnxStack . StableDiffusion . Enums ;
43using OnnxStack . UI . Commands ;
54using OnnxStack . UI . Models ;
65using OnnxStack . UI . Services ;
@@ -37,7 +36,7 @@ public AddModelDialog(OnnxStackUIConfig settings, IModelFactory modelFactory, IL
3736 _modelFactory = modelFactory ;
3837 SaveCommand = new AsyncRelayCommand ( Save , CanExecuteSave ) ;
3938 CancelCommand = new AsyncRelayCommand ( Cancel ) ;
40- ModelTemplates = new List < StableDiffusionModelTemplate > ( _modelFactory . GetStableDiffusionModelTemplates ( ) ) ;
39+ ModelTemplates = new List < StableDiffusionModelTemplate > ( _modelFactory . GetStableDiffusionModelTemplates ( ) ) ;
4140 InvalidOptions = _settings . GetModelNames ( ) ;
4241 InitializeComponent ( ) ;
4342 }
@@ -86,9 +85,6 @@ public StableDiffusionModelSet ModelSetResult
8685 get { return _modelSetResult ; }
8786 }
8887
89-
90-
91-
9288 public new bool ShowDialog ( )
9389 {
9490 return base . ShowDialog ( ) ?? false ;
@@ -106,12 +102,17 @@ private void CreateModelSet()
106102
107103 _modelSetResult = _modelFactory . CreateStableDiffusionModelSet ( ModelName . Trim ( ) , ModelFolder , _modelTemplate ) ;
108104
109- // Validate
105+ //// Validate
110106 ValidationResults . Add ( new ValidationResult ( "Name" , ! InvalidOptions . Contains ( _modelName . ToLower ( ) ) && _modelName . Length > 2 && _modelName . Length < 50 ) ) ;
111- foreach ( var validationResult in _modelSetResult . ModelConfigurations . Select ( x => new ValidationResult ( x . Type . ToString ( ) , File . Exists ( x . OnnxModelPath ) ) ) )
112- {
113- ValidationResults . Add ( validationResult ) ;
114- }
107+ ValidationResults . Add ( new ValidationResult ( "Unet Model" , File . Exists ( _modelSetResult . UnetConfig . OnnxModelPath ) ) ) ;
108+ ValidationResults . Add ( new ValidationResult ( "Tokenizer Model" , File . Exists ( _modelSetResult . TokenizerConfig . OnnxModelPath ) ) ) ;
109+ if ( _modelSetResult . Tokenizer2Config is not null )
110+ ValidationResults . Add ( new ValidationResult ( "Tokenizer2 Model" , File . Exists ( _modelSetResult . Tokenizer2Config . OnnxModelPath ) ) ) ;
111+ ValidationResults . Add ( new ValidationResult ( "TextEncoder Model" , File . Exists ( _modelSetResult . TextEncoderConfig . OnnxModelPath ) ) ) ;
112+ if ( _modelSetResult . TextEncoder2Config is not null )
113+ ValidationResults . Add ( new ValidationResult ( "TextEncoder2 Model" , File . Exists ( _modelSetResult . TextEncoder2Config . OnnxModelPath ) ) ) ;
114+ ValidationResults . Add ( new ValidationResult ( "VaeDecoder Model" , File . Exists ( _modelSetResult . VaeDecoderConfig . OnnxModelPath ) ) ) ;
115+ ValidationResults . Add ( new ValidationResult ( "VaeEncoder Model" , File . Exists ( _modelSetResult . VaeEncoderConfig . OnnxModelPath ) ) ) ;
115116 }
116117
117118
0 commit comments