Skip to content

Commit 5a6c050

Browse files
committed
Device picker, CUDA build
1 parent 278eff9 commit 5a6c050

File tree

12 files changed

+203
-49
lines changed

12 files changed

+203
-49
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ publish/
171171
*.azurePubxml
172172
# Note: Comment the next line if you want to checkin your web deploy settings,
173173
# but database connection strings (with potential passwords) will be unencrypted
174-
*.pubxml
175174
*.publishproj
176175

177176
# Microsoft Azure Web App publish settings. Comment the next line if you want to

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<ImplicitUsings>disable</ImplicitUsings>
1212
<Nullable>disable</Nullable>
1313
<PackageOutputPath>..\..\Nuget</PackageOutputPath>
14+
<Configurations>Debug;Release;</Configurations>
1415
</PropertyGroup>
1516
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>Release_CUDA</Configuration>
6+
<Platform>Any CPU</Platform>
7+
<PublishDir>bin\Build\UpscaleDemo_CUDA\</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
11+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>true</PublishSingleFile>
14+
<PublishReadyToRun>false</PublishReadyToRun>
15+
<PublishTrimmed>false</PublishTrimmed>
16+
</PropertyGroup>
17+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>Release</Configuration>
6+
<Platform>Any CPU</Platform>
7+
<PublishDir>bin\Build\UpscaleDemo_DML\</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
11+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>true</PublishSingleFile>
14+
<PublishReadyToRun>false</PublishReadyToRun>
15+
<PublishTrimmed>false</PublishTrimmed>
16+
</PropertyGroup>
17+
</Project>

Examples/TensorStack.Example.Upscaler/TensorStack.Example.Upscaler.csproj

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,51 @@
66
<PlatformTarget>x64</PlatformTarget>
77
<UseWPF>true</UseWPF>
88
<ApplicationIcon>..\..\Assets\Icon.ico</ApplicationIcon>
9+
<Configurations>Debug;Release;Debug_CUDA;Release_CUDA</Configurations>
910
</PropertyGroup>
1011

11-
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
12+
<!--Projects-->
13+
<ItemGroup Condition=" '$(Configuration)' == 'Debug' OR '$(Configuration)'=='Debug_CUDA'">
1214
<ProjectReference Include="..\..\TensorStack.Audio.Windows\TensorStack.Audio.Windows.csproj" />
1315
<ProjectReference Include="..\..\TensorStack.Common\TensorStack.Common.csproj" />
1416
<ProjectReference Include="..\..\TensorStack.Image.BitmapImage\TensorStack.Image.BitmapImage.csproj" />
1517
<ProjectReference Include="..\..\TensorStack.Upscaler\TensorStack.Upscaler.csproj" />
1618
<ProjectReference Include="..\..\TensorStack.Video.Windows\TensorStack.Video.Windows.csproj" />
1719
<ProjectReference Include="..\..\TensorStack.WPF\TensorStack.WPF.csproj" />
20+
</ItemGroup>
21+
22+
<!--Projects DirectML-->
23+
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
1824
<ProjectReference Include="..\..\TensorStack.Providers.DML\TensorStack.Providers.DML.csproj" />
1925
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.23.0" />
2026
</ItemGroup>
2127

22-
<ItemGroup Condition=" '$(Configuration)' == 'Release'">
28+
<!--Projects CUDA-->
29+
<ItemGroup Condition="'$(Configuration)'=='Debug_CUDA'">
30+
<ProjectReference Include="..\..\TensorStack.Providers.CUDA\TensorStack.Providers.CUDA.csproj" />
31+
<PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu.Windows" Version="1.23.0" />
32+
</ItemGroup>
33+
34+
<!--Packages-->
35+
<ItemGroup Condition="'$(Configuration)' == 'Release' OR '$(Configuration)' == 'Release_CUDA'">
2336
<PackageReference Include="TensorStack.Audio.Windows" Version="$(Version)" />
2437
<PackageReference Include="TensorStack.Video.Windows" Version="$(Version)" />
2538
<PackageReference Include="TensorStack.Image.BitmapImage" Version="$(Version)" />
2639
<PackageReference Include="TensorStack.Upscaler" Version="$(Version)" />
2740
<PackageReference Include="TensorStack.WPF" Version="$(Version)" />
41+
</ItemGroup>
42+
43+
<!--Packages DirectML-->
44+
<ItemGroup Condition="'$(Configuration)' == 'Release'">
2845
<PackageReference Include="TensorStack.Providers.DML" Version="$(Version)" />
2946
</ItemGroup>
3047

48+
<!--Packages CUDA-->
49+
<ItemGroup Condition="'$(Configuration)' == 'Release_CUDA'">
50+
<PackageReference Include="TensorStack.Providers.CUDA" Version="$(Version)" />
51+
</ItemGroup>
52+
53+
<!--Common Packages-->
3154
<ItemGroup>
3255
<PackageReference Include="System.Linq.Async" Version="6.0.3" />
3356
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.9" />

Examples/TensorStack.Example.Upscaler/Views/ImageUpscaleView.xaml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,31 @@
2424
<Border Margin="4">
2525
<DockPanel x:Name="LeftPanelContainer" Margin="4">
2626

27+
<StackPanel DockPanel.Dock="Top" IsEnabled="{Binding UpscaleService.IsLoading, Converter={StaticResource InverseBoolConverter}}">
2728

28-
<!--Model Selector-->
29-
<Grid DockPanel.Dock="Top" IsEnabled="{Binding UpscaleService.IsLoading, Converter={StaticResource InverseBoolConverter}}">
30-
<Grid.ColumnDefinitions>
31-
<ColumnDefinition Width="3*" />
32-
<ColumnDefinition Width="1*" />
33-
</Grid.ColumnDefinitions>
34-
<StackPanel Grid.Column="0" IsEnabled="{Binding UpscaleService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
35-
<TextBlock Text="Models" Style="{StaticResource FieldTextBlockStyle}" />
36-
<ComboBox SelectedItem="{Binding SelectedModel, Mode=TwoWay}" ItemsSource="{Binding Settings.UpscaleModels}" DisplayMemberPath="Name" />
29+
<!--Device Selector-->
30+
<StackPanel IsEnabled="{Binding UpscaleService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
31+
<TextBlock Text="Device" Style="{StaticResource FieldTextBlockStyle}" />
32+
<ComboBox ItemsSource="{Binding Settings.Devices}" SelectedItem="{Binding SelectedDevice}" DisplayMemberPath="Name"/>
3733
</StackPanel>
38-
<Grid Grid.Column="1" Height="22" Margin="0,18,0,0" >
39-
<Button x:Name="ButtonLoad" Content="Load" Command="{Binding LoadCommand}" />
40-
<Button x:Name="ButtonUnload" Content="Unload" Command="{Binding UnloadCommand}" Visibility="{Binding UpscaleService.IsLoaded, Converter={StaticResource BooleanToHiddenConverter}}" />
34+
35+
<!--Model Selector-->
36+
<Grid>
37+
<Grid.ColumnDefinitions>
38+
<ColumnDefinition Width="3*" />
39+
<ColumnDefinition Width="1*" />
40+
</Grid.ColumnDefinitions>
41+
<StackPanel Grid.Column="0" IsEnabled="{Binding UpscaleService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
42+
<TextBlock Text="Models" Style="{StaticResource FieldTextBlockStyle}" />
43+
<ComboBox SelectedItem="{Binding SelectedModel, Mode=TwoWay}" ItemsSource="{Binding Settings.UpscaleModels}" DisplayMemberPath="Name" />
44+
</StackPanel>
45+
<Grid Grid.Column="1" Height="22" Margin="0,18,0,0" >
46+
<Button x:Name="ButtonLoad" Content="Load" Command="{Binding LoadCommand}" />
47+
<Button x:Name="ButtonUnload" Content="Unload" Command="{Binding UnloadCommand}" Visibility="{Binding UpscaleService.IsLoaded, Converter={StaticResource BooleanToHiddenConverter}}" />
48+
</Grid>
4149
</Grid>
42-
</Grid>
4350

51+
</StackPanel>
4452

4553
<!--Execute/Cancel-->
4654
<UniformGrid DockPanel.Dock="Bottom" Columns="2" Height="30">

Examples/TensorStack.Example.Upscaler/Views/ImageUpscaleView.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ public partial class ImageUpscaleView : ViewBase
2626
private int _tileSize = 512;
2727
private int _tileOverlap = 16;
2828

29-
public ImageUpscaleView(Settings settings, NavigationService navigationService,IUpscaleService upscaleService)
29+
public ImageUpscaleView(Settings settings, NavigationService navigationService, IUpscaleService upscaleService)
3030
: base(settings, navigationService)
3131
{
3232
UpscaleService = upscaleService;
3333
LoadCommand = new AsyncRelayCommand(LoadAsync, CanLoad);
3434
UnloadCommand = new AsyncRelayCommand(UnloadAsync, CanUnload);
3535
ExecuteCommand = new AsyncRelayCommand(ExecuteAsync, CanExecute);
3636
CancelCommand = new AsyncRelayCommand(CancelAsync, CanCancel);
37-
38-
Progress = new ProgressInfo();
3937
SelectedModel = settings.UpscaleModels.First(x => x.IsDefault);
38+
SelectedDevice = settings.DefaultDevice;
39+
Progress = new ProgressInfo();
4040
InitializeComponent();
4141
}
4242

Examples/TensorStack.Example.Upscaler/Views/InterpolationView.xaml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,31 @@
2727
<Border Margin="4">
2828
<DockPanel x:Name="LeftPanelContainer" Margin="4">
2929

30+
<StackPanel DockPanel.Dock="Top" IsEnabled="{Binding InterpolationService.IsLoading, Converter={StaticResource InverseBoolConverter}}">
3031

31-
<!--Model Selector-->
32-
<Grid DockPanel.Dock="Top" IsEnabled="{Binding InterpolationService.IsLoading, Converter={StaticResource InverseBoolConverter}}">
33-
<Grid.ColumnDefinitions>
34-
<ColumnDefinition Width="3*" />
35-
<ColumnDefinition Width="1*" />
36-
</Grid.ColumnDefinitions>
37-
<StackPanel Grid.Column="0" IsEnabled="{Binding InterpolationService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
38-
<TextBlock Text="Models" Style="{StaticResource FieldTextBlockStyle}" />
39-
<TextBox Text="RIFE Model" IsReadOnly="True" />
32+
<!--Device Selector-->
33+
<StackPanel IsEnabled="{Binding InterpolationService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
34+
<TextBlock Text="Device" Style="{StaticResource FieldTextBlockStyle}" />
35+
<ComboBox ItemsSource="{Binding Settings.Devices}" SelectedItem="{Binding SelectedDevice}" DisplayMemberPath="Name"/>
4036
</StackPanel>
41-
<Grid Grid.Column="1" Height="22" Margin="0,18,0,0" >
42-
<Button x:Name="ButtonLoad" Content="Load" Command="{Binding LoadCommand}" />
43-
<Button x:Name="ButtonUnload" Content="Unload" Command="{Binding UnloadCommand}" Visibility="{Binding InterpolationService.IsLoaded, Converter={StaticResource BooleanToHiddenConverter}}" />
37+
38+
<!--Model Selector-->
39+
<Grid >
40+
<Grid.ColumnDefinitions>
41+
<ColumnDefinition Width="3*" />
42+
<ColumnDefinition Width="1*" />
43+
</Grid.ColumnDefinitions>
44+
<StackPanel Grid.Column="0" IsEnabled="{Binding InterpolationService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
45+
<TextBlock Text="Models" Style="{StaticResource FieldTextBlockStyle}" />
46+
<TextBox Text="RIFE Model" IsReadOnly="True" />
47+
</StackPanel>
48+
<Grid Grid.Column="1" Height="22" Margin="0,18,0,0" >
49+
<Button x:Name="ButtonLoad" Content="Load" Command="{Binding LoadCommand}" />
50+
<Button x:Name="ButtonUnload" Content="Unload" Command="{Binding UnloadCommand}" Visibility="{Binding InterpolationService.IsLoaded, Converter={StaticResource BooleanToHiddenConverter}}" />
51+
</Grid>
4452
</Grid>
45-
</Grid>
4653

54+
</StackPanel>
4755

4856
<!--Execute/Cancel-->
4957
<UniformGrid DockPanel.Dock="Bottom" Columns="2" Height="30">

Examples/TensorStack.Example.Upscaler/Views/InterpolationView.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public InterpolationView(Settings settings, NavigationService navigationService,
3131
UnloadCommand = new AsyncRelayCommand(UnloadAsync, CanUnload);
3232
ExecuteCommand = new AsyncRelayCommand(ExecuteAsync, CanExecute);
3333
CancelCommand = new AsyncRelayCommand(CancelAsync, CanCancel);
34-
34+
SelectedDevice = settings.DefaultDevice;
3535
Progress = new ProgressInfo();
3636
_progressCallback = new Progress<RunProgress>(OnProgress);
3737
InitializeComponent();

Examples/TensorStack.Example.Upscaler/Views/VideoUpscaleView.xaml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,31 @@
2727
<Border Margin="4">
2828
<DockPanel x:Name="LeftPanelContainer" Margin="4">
2929

30+
<StackPanel DockPanel.Dock="Top" IsEnabled="{Binding UpscaleService.IsLoading, Converter={StaticResource InverseBoolConverter}}">
3031

31-
<!--Model Selector-->
32-
<Grid DockPanel.Dock="Top" IsEnabled="{Binding UpscaleService.IsLoading, Converter={StaticResource InverseBoolConverter}}">
33-
<Grid.ColumnDefinitions>
34-
<ColumnDefinition Width="3*" />
35-
<ColumnDefinition Width="1*" />
36-
</Grid.ColumnDefinitions>
37-
<StackPanel Grid.Column="0" IsEnabled="{Binding UpscaleService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
38-
<TextBlock Text="Models" Style="{StaticResource FieldTextBlockStyle}" />
39-
<ComboBox SelectedItem="{Binding SelectedModel, Mode=TwoWay}" ItemsSource="{Binding Settings.UpscaleModels}" DisplayMemberPath="Name" />
32+
<!--Device Selector-->
33+
<StackPanel IsEnabled="{Binding UpscaleService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
34+
<TextBlock Text="Device" Style="{StaticResource FieldTextBlockStyle}" />
35+
<ComboBox ItemsSource="{Binding Settings.Devices}" SelectedItem="{Binding SelectedDevice}" DisplayMemberPath="Name"/>
4036
</StackPanel>
41-
<Grid Grid.Column="1" Height="22" Margin="0,18,0,0" >
42-
<Button x:Name="ButtonLoad" Content="Load" Command="{Binding LoadCommand}" />
43-
<Button x:Name="ButtonUnload" Content="Unload" Command="{Binding UnloadCommand}" Visibility="{Binding UpscaleService.IsLoaded, Converter={StaticResource BooleanToHiddenConverter}}" />
37+
38+
<!--Model Selector-->
39+
<Grid >
40+
<Grid.ColumnDefinitions>
41+
<ColumnDefinition Width="3*" />
42+
<ColumnDefinition Width="1*" />
43+
</Grid.ColumnDefinitions>
44+
<StackPanel Grid.Column="0" IsEnabled="{Binding UpscaleService.IsLoaded, Converter={StaticResource InverseBoolConverter}}">
45+
<TextBlock Text="Models" Style="{StaticResource FieldTextBlockStyle}" />
46+
<ComboBox SelectedItem="{Binding SelectedModel, Mode=TwoWay}" ItemsSource="{Binding Settings.UpscaleModels}" DisplayMemberPath="Name" />
47+
</StackPanel>
48+
<Grid Grid.Column="1" Height="22" Margin="0,18,0,0" >
49+
<Button x:Name="ButtonLoad" Content="Load" Command="{Binding LoadCommand}" />
50+
<Button x:Name="ButtonUnload" Content="Unload" Command="{Binding UnloadCommand}" Visibility="{Binding UpscaleService.IsLoaded, Converter={StaticResource BooleanToHiddenConverter}}" />
51+
</Grid>
4452
</Grid>
45-
</Grid>
4653

54+
</StackPanel>
4755

4856
<!--Execute/Cancel-->
4957
<UniformGrid DockPanel.Dock="Bottom" Columns="2" Height="30">

0 commit comments

Comments
 (0)