diff --git a/OnnxStack.StableDiffusion/Config/ControlNetModelSet.cs b/OnnxStack.StableDiffusion/Config/ControlNetModelSet.cs index 98f5d14c..4defd68a 100644 --- a/OnnxStack.StableDiffusion/Config/ControlNetModelSet.cs +++ b/OnnxStack.StableDiffusion/Config/ControlNetModelSet.cs @@ -8,6 +8,7 @@ namespace OnnxStack.StableDiffusion.Config public record ControlNetModelSet : IOnnxModelSetConfig { public ControlNetType Type { get; set; } + public DiffuserPipelineType PipelineType { get; set; } public string Name { get; set; } public bool IsEnabled { get; set; } public int DeviceId { get; set; } diff --git a/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml b/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml index c8c7f612..5e63eb26 100644 --- a/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml +++ b/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml @@ -18,11 +18,17 @@ - - - - + + + + + + + + + + @@ -40,7 +46,7 @@ - + @@ -65,7 +71,7 @@ - + diff --git a/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml.cs b/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml.cs index 31afff0c..1997b577 100644 --- a/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml.cs +++ b/OnnxStack.UI/Dialogs/AddControlNetModelDialog.xaml.cs @@ -83,6 +83,15 @@ public ControlNetType SelectedControlNetType } + private DiffuserPipelineType _selectedPipelineType; + + public DiffuserPipelineType SelectedPipelineType + { + get { return _selectedPipelineType; } + set { _selectedPipelineType = value; NotifyPropertyChanged(); CreateModelSet(); } + } + + public ControlNetModelSet ModelSetResult { get { return _modelSetResult; } @@ -102,7 +111,7 @@ private void CreateModelSet() if (string.IsNullOrEmpty(_modelFile)) return; - _modelSetResult = _modelFactory.CreateControlNetModelSet(ModelName.Trim(), _selectedControlNetType, _modelFile, _annotationModelFile); + _modelSetResult = _modelFactory.CreateControlNetModelSet(ModelName.Trim(), _selectedControlNetType, _selectedPipelineType, _modelFile, _annotationModelFile); // Validate ValidationResults.Add(new ValidationResult("Name", !_invalidOptions.Contains(_modelName, StringComparer.OrdinalIgnoreCase) && _modelName.Length > 2 && _modelName.Length < 50)); diff --git a/OnnxStack.UI/Models/UpdateControlNetModelSetViewModel.cs b/OnnxStack.UI/Models/UpdateControlNetModelSetViewModel.cs index cb38c744..30e3b527 100644 --- a/OnnxStack.UI/Models/UpdateControlNetModelSetViewModel.cs +++ b/OnnxStack.UI/Models/UpdateControlNetModelSetViewModel.cs @@ -21,6 +21,8 @@ public class UpdateControlNetModelSetViewModel : INotifyPropertyChanged private ExecutionProvider _executionProvider; private ObservableCollection _modelFiles; private ControlNetType _controlNetType; + private DiffuserPipelineType _pipelineType; + public string Name { @@ -33,6 +35,13 @@ public ControlNetType ControlNetType get { return _controlNetType; } set { _controlNetType = value; NotifyPropertyChanged(); } } + + public DiffuserPipelineType PipelineType + { + get { return _pipelineType; } + set { _pipelineType = value; NotifyPropertyChanged(); } + } + public int DeviceId { get { return _deviceId; } @@ -76,6 +85,7 @@ public static UpdateControlNetModelSetViewModel FromModelSet(ControlNetModelSet { Name = modelset.Name, ControlNetType = modelset.Type, + PipelineType = modelset.PipelineType, DeviceId = modelset.DeviceId, ExecutionMode = modelset.ExecutionMode, ExecutionProvider = modelset.ExecutionProvider, @@ -107,6 +117,7 @@ public static ControlNetModelSet ToModelSet(UpdateControlNetModelSetViewModel mo IsEnabled = true, Name = modelset.Name, Type = modelset.ControlNetType, + PipelineType = modelset.PipelineType, DeviceId = modelset.DeviceId, ExecutionMode = modelset.ExecutionMode, ExecutionProvider = modelset.ExecutionProvider, diff --git a/OnnxStack.UI/Services/IModelFactory.cs b/OnnxStack.UI/Services/IModelFactory.cs index 08b0b240..b818a2fc 100644 --- a/OnnxStack.UI/Services/IModelFactory.cs +++ b/OnnxStack.UI/Services/IModelFactory.cs @@ -12,6 +12,6 @@ public interface IModelFactory UpscaleModelSet CreateUpscaleModelSet(string name, string filename, UpscaleModelTemplate modelTemplate); StableDiffusionModelSet CreateStableDiffusionModelSet(string name, string folder, StableDiffusionModelTemplate modelTemplate); - ControlNetModelSet CreateControlNetModelSet(string name, ControlNetType controlNetType, string modelFilename, string annotationFilename); + ControlNetModelSet CreateControlNetModelSet(string name, ControlNetType controlNetType, DiffuserPipelineType pipelineType, string modelFilename, string annotationFilename); } } \ No newline at end of file diff --git a/OnnxStack.UI/Services/ModelFactory.cs b/OnnxStack.UI/Services/ModelFactory.cs index cf103323..e4436a55 100644 --- a/OnnxStack.UI/Services/ModelFactory.cs +++ b/OnnxStack.UI/Services/ModelFactory.cs @@ -152,7 +152,7 @@ public UpscaleModelSet CreateUpscaleModelSet(string name, string filename, Upsca } - public ControlNetModelSet CreateControlNetModelSet(string name, ControlNetType controlNetType, string modelFilename, string annotationFilename) + public ControlNetModelSet CreateControlNetModelSet(string name, ControlNetType controlNetType, DiffuserPipelineType pipelineType, string modelFilename, string annotationFilename) { var models = new List { new OnnxModelConfig { Type = OnnxModelType.ControlNet, OnnxModelPath = modelFilename } }; if (!string.IsNullOrEmpty(annotationFilename)) @@ -162,6 +162,7 @@ public ControlNetModelSet CreateControlNetModelSet(string name, ControlNetType c { Name = name, Type = controlNetType, + PipelineType = pipelineType, ModelConfigurations = models, IsEnabled = true,