Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion OpenUtau.Core/Util/Onnx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public static List<string> getRunnerOptions() {

public static List<GpuInfo> getGpuInfo() {
if (OS.IsAndroid()) {
return new List<GpuInfo>();
return new List<GpuInfo>{new GpuInfo {
deviceId = 0, // eliminate exception of taking OnnxGpuOptions[0]
}};
}
List<GpuInfo> gpuList = new List<GpuInfo>();
var env = OrtEnv.Instance();
Expand Down
9 changes: 8 additions & 1 deletion OpenUtau/ViewModels/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public int SafeMaxThreadCount {
[Reactive] public string OnnxRunner { get; set; }
public List<GpuInfo> OnnxGpuOptions { get; set; }
[Reactive] public GpuInfo OnnxGpu { get; set; }

[Reactive] public bool ShowOnnxGpu { get; set; }

// Appearance
[Reactive] public int Theme { get; set; }
[Reactive] public string CustomName { get; set; } = Colors.CustomTheme.Default.Name;
Expand Down Expand Up @@ -163,6 +164,7 @@ public PreferencesViewModel() {
OnnxRunnerOptions[0] : Preferences.Default.OnnxRunner;
OnnxGpuOptions = Onnx.getGpuInfo();
OnnxGpu = OnnxGpuOptions.FirstOrDefault(x => x.deviceId == Preferences.Default.OnnxGpu, OnnxGpuOptions[0]);
ShowOnnxGpu = OnnxRunner == "DirectML";
DiffSingerDepth = Preferences.Default.DiffSingerDepth * 100;
DiffSingerSteps = Preferences.Default.DiffSingerSteps;
DiffSingerStepsVariance = Preferences.Default.DiffSingerStepsVariance;
Expand Down Expand Up @@ -321,6 +323,7 @@ public PreferencesViewModel() {
.Subscribe(index => {
Preferences.Default.OnnxRunner = index;
Preferences.Save();
ToggleOnnxGpuDisplay(index == "DirectML");
});
this.WhenAnyValue(vm => vm.OnnxGpu)
.Subscribe(index => {
Expand Down Expand Up @@ -427,5 +430,9 @@ public void SetWinePath(string path) {
ToolsManager.Inst.Initialize();
this.RaisePropertyChanged(nameof(WinePath));
}

public void ToggleOnnxGpuDisplay(bool show) {
ShowOnnxGpu = show;
}
}
}
8 changes: 5 additions & 3 deletions OpenUtau/Views/PreferencesDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,11 @@
</Grid>
<TextBlock Text="{DynamicResource prefs.rendering.onnxrunner}" Margin="0,10,0,0"/>
<ComboBox ItemsSource="{Binding OnnxRunnerOptions}" SelectedItem="{Binding OnnxRunner}"/>
<TextBlock Text="{DynamicResource prefs.rendering.onnxgpu}" Margin="0,10,0,0"/>
<ComboBox ItemsSource="{Binding OnnxGpuOptions}" SelectedItem="{Binding OnnxGpu}"/>
<TextBlock Classes="restart"/>
<StackPanel IsVisible="{Binding ShowOnnxGpu}">
<TextBlock Text="{DynamicResource prefs.rendering.onnxgpu}" Margin="0,10,0,0"/>
<ComboBox ItemsSource="{Binding OnnxGpuOptions}" SelectedItem="{Binding OnnxGpu}"/>
<TextBlock Classes="restart"/>
</StackPanel>
</StackPanel>

<!-- Appearance -->
Expand Down
Loading