Compare commits

...

4 Commits

9 changed files with 62 additions and 22 deletions

View File

@ -24,13 +24,13 @@ jobs:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
run: dotnet restore StableDiffusion.NET
- name: Build
run: dotnet build --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }}
run: dotnet build StableDiffusion.NET --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }}
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
run: dotnet test StableDiffusion.NET --no-build --verbosity normal --configuration Release
- name: Upload Nuget Build Artifact
uses: actions/upload-artifact@v4.3.1

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>StableDifffusion.NET.Backend.Cpu</id>
<id>StableDiffusion.NET.Backend.Cpu</id>
<version>$version$</version>
<title>StableDifffusion.NET.Backend.Cpu</title>
<title>StableDiffusion.NET.Backend.Cpu</title>
<authors>Darth Affe &amp; stable-diffusion.cpp Authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>StableDifffusion.NET.Backend.Cuda</id>
<id>StableDiffusion.NET.Backend.Cuda</id>
<version>$version$</version>
<title>StableDifffusion.NET.Backend.Cuda</title>
<title>StableDiffusion.NET.Backend.Cuda</title>
<authors>Darth Affe &amp; stable-diffusion.cpp Authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
@ -20,7 +20,7 @@
<file src="windows-cuda11/stable-diffusion.dll" target="runtimes\win-x64\native\cuda11\stable-diffusion.dll" />
<file src="windows-cuda12/stable-diffusion.dll" target="runtimes\win-x64\native\cuda12\stable-diffusion.dll" />
<file src="linux-cuda11/libstable-diffusion.so" target="runtimes\linux-x64\native\cuda11\libstable-diffusion.so" />
<file src="linux-cuda12/libstable-diffusion.so" target="runtimes\linux-x64\native\cuda12\libstable-diffusion.so" />

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>StableDifffusion.NET.Backend.Rocm</id>
<id>StableDiffusion.NET.Backend.Rocm</id>
<version>$version$</version>
<title>StableDifffusion.NET.Backend.Rocm</title>
<title>StableDiffusion.NET.Backend.Rocm</title>
<authors>Darth Affe &amp; stable-diffusion.cpp Authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
@ -19,7 +19,7 @@
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Rocm.props" />
<file src="windows-rocm5/stable-diffusion.dll" target="runtimes\win-x64\native\rocm5\stable-diffusion.dll" />
<file src="linux-rocm6/libstable-diffusion.so" target="runtimes\linux-x64\native\rocm6\libstable-diffusion.so" />
<file src="sd_net_rocm.png" target="sd_net_rocm.png" />

View File

@ -10,11 +10,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="StableDifffusion.NET.Backend.Cpu" Version="1.0.0" />
<PackageReference Include="StableDifffusion.NET.Backend.Cuda" Version="1.0.0" />
<PackageReference Include="StableDifffusion.NET.Backend.Rocm" Version="1.0.0" />
<PackageReference Include="StableDiffusion.NET" Version="1.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
<PackageReference Include="StableDiffusion.NET.Backend.Cpu" Version="1.2.0" />
<PackageReference Include="StableDiffusion.NET.Backend.Cuda" Version="1.2.0" />
<PackageReference Include="StableDiffusion.NET.Backend.Rocm" Version="1.2.0" />
<PackageReference Include="StableDiffusion.NET" Version="1.2.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.4" />
</ItemGroup>
</Project>

View File

@ -5,14 +5,32 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ImageCreationUI"
xmlns:converter="clr-namespace:ImageCreationUI.Converter"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
xmlns:sd="clr-namespace:StableDiffusion.NET;assembly=StableDiffusion.NET"
mc:Ignorable="d"
Title="StableDiffusion.NET" Width="1280" Height="720">
Title="StableDiffusion.NET" Width="1280" Height="800">
<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>
<Window.Resources>
<converter:ImageToImageSourceConverter x:Key="ImageToImageSourceConverter" />
<ObjectDataProvider x:Key="ScheduleDataSource"
ObjectType="{x:Type sys:Enum}"
MethodName="GetValues">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="sd:Schedule" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="SamplerDataSource"
ObjectType="{x:Type sys:Enum}"
MethodName="GetValues">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="sd:Sampler" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
<Grid>
@ -29,18 +47,21 @@
<Separator />
<Label Content="Model-Path"/>
<Label Content="Model-Path" />
<DockPanel>
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectModelCommand}" IsEnabled="{Binding IsReady}" />
<TextBox Text="{Binding ModelPath}" />
</DockPanel>
<Label Content="Vae-Path (Optional)"/>
<Label Content="Vae-Path (Optional)" />
<DockPanel>
<Button DockPanel.Dock="Right" Width="24" Margin="2,0,0,0" Content="..." Command="{Binding SelectVaeCommand}" IsEnabled="{Binding IsReady}" />
<TextBox Text="{Binding VaePath}" />
</DockPanel>
<Label Content="Schedule" />
<ComboBox ItemsSource="{Binding Source={StaticResource ScheduleDataSource}}" SelectedItem="{Binding Schedule}" />
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
<Separator />
@ -76,6 +97,9 @@
<TextBox HorizontalAlignment="Left" Width="60" Text="{Binding Seed}" />
</StackPanel>
<Label Content="Sample-Method" />
<ComboBox ItemsSource="{Binding Source={StaticResource SamplerDataSource}}" SelectedItem="{Binding SampleMethod}" />
<Button Margin="0,16,0,0" Content="Create Image" Command="{Binding CreateImageCommand}" IsEnabled="{Binding IsReady}" />
<Button Margin="0,16,0,0" Content="Save Image" Command="{Binding SaveImageCommand}" IsEnabled="{Binding IsReady}" />
</StackPanel>

View File

@ -27,6 +27,13 @@ public class MainWindowViewModel : INotifyPropertyChanged
set => SetProperty(ref _vaePath, value);
}
private Schedule _schedule = Schedule.Default;
public Schedule Schedule
{
get => _schedule;
set => SetProperty(ref _schedule, value);
}
private string _prompt = string.Empty;
public string Prompt
{
@ -76,6 +83,13 @@ public class MainWindowViewModel : INotifyPropertyChanged
set => SetProperty(ref _seed, value);
}
private Sampler _sampleMethod = Sampler.Euler_A;
public Sampler SampleMethod
{
get => _sampleMethod;
set => SetProperty(ref _sampleMethod, value);
}
private IImage? _image;
public IImage? Image
{
@ -146,7 +160,7 @@ public class MainWindowViewModel : INotifyPropertyChanged
_model?.Dispose();
LogLine($"Loading model '{ModelPath}'");
_model = await Task.Run(() => new StableDiffusionModel(ModelPath, new ModelParameter { VaePath = VaePath }));
_model = await Task.Run(() => new StableDiffusionModel(ModelPath, new ModelParameter { VaePath = VaePath, Schedule = Schedule }));
}
catch (Exception ex)
{
@ -172,7 +186,8 @@ public class MainWindowViewModel : INotifyPropertyChanged
Height = Height,
CfgScale = Cfg,
SampleSteps = Steps,
Seed = Seed
Seed = Seed,
SampleMethod = SampleMethod
}));
Image = image?.ToImage();

View File

@ -5,5 +5,6 @@ public enum Schedule
Default,
Discrete,
Karras,
AYS,
N_Schedules
}

View File

@ -4,7 +4,7 @@ if not exist stable-diffusion.cpp (
cd stable-diffusion.cpp
git fetch
git checkout ec82d5279ab7d3b20d95bf1e803c78306030e6b1
git checkout ce1bcc74a6bf1f2c187d4d8ea14ee247cf562af2
git submodule init
git submodule update