mirror of
https://github.com/DarthAffe/StableDiffusion.NET.git
synced 2025-12-12 13:28:35 +00:00
Added flash attention parameter to example
This commit is contained in:
parent
b174c2aeb6
commit
b7e5ee7232
@ -91,6 +91,11 @@
|
|||||||
<Label Content="Schedule" />
|
<Label Content="Schedule" />
|
||||||
<ComboBox ItemsSource="{Binding Source={StaticResource ScheduleDataSource}}" SelectedItem="{Binding Schedule}" />
|
<ComboBox ItemsSource="{Binding Source={StaticResource ScheduleDataSource}}" SelectedItem="{Binding Schedule}" />
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,4,0,0">
|
||||||
|
<Label Content="Flash Attention" />
|
||||||
|
<CheckBox VerticalAlignment="Center" IsChecked="{Binding FlashAttention}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
|
<Button Margin="0,8" Content="Load Model" Command="{Binding LoadModelCommand}" IsEnabled="{Binding IsReady}" />
|
||||||
|
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|||||||
@ -71,6 +71,13 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
set => SetProperty(ref _schedule, value);
|
set => SetProperty(ref _schedule, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _flashAttention = true;
|
||||||
|
public bool FlashAttention
|
||||||
|
{
|
||||||
|
get => _flashAttention;
|
||||||
|
set => SetProperty(ref _flashAttention, value);
|
||||||
|
}
|
||||||
|
|
||||||
private string _prompt = string.Empty;
|
private string _prompt = string.Empty;
|
||||||
public string Prompt
|
public string Prompt
|
||||||
{
|
{
|
||||||
@ -242,14 +249,14 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||||||
restoreDefaultParameters = _model?.ModelParameter.DiffusionModelType != DiffusionModelType.StableDiffusion;
|
restoreDefaultParameters = _model?.ModelParameter.DiffusionModelType != DiffusionModelType.StableDiffusion;
|
||||||
|
|
||||||
LogLine($"Loading stable diffusion-model '{ModelPath}'");
|
LogLine($"Loading stable diffusion-model '{ModelPath}'");
|
||||||
_model = await Task.Run(() => ModelBuilder.StableDiffusion(ModelPath).WithMultithreading().WithVae(VaePath).WithSchedule(Schedule).Build());
|
_model = await Task.Run(() => ModelBuilder.StableDiffusion(ModelPath).WithMultithreading().WithVae(VaePath).WithSchedule(Schedule).WithFlashAttention(FlashAttention).Build());
|
||||||
}
|
}
|
||||||
else if (IsFluxSelected)
|
else if (IsFluxSelected)
|
||||||
{
|
{
|
||||||
restoreDefaultParameters = _model?.ModelParameter.DiffusionModelType != DiffusionModelType.Flux;
|
restoreDefaultParameters = _model?.ModelParameter.DiffusionModelType != DiffusionModelType.Flux;
|
||||||
|
|
||||||
LogLine($"Loading flux-model '{DiffusionModelPath}'");
|
LogLine($"Loading flux-model '{DiffusionModelPath}'");
|
||||||
_model = await Task.Run(() => ModelBuilder.Flux(DiffusionModelPath, ClipLPath, T5xxlPath, VaePath).WithMultithreading().WithSchedule(Schedule).Build());
|
_model = await Task.Run(() => ModelBuilder.Flux(DiffusionModelPath, ClipLPath, T5xxlPath, VaePath).WithMultithreading().WithSchedule(Schedule).WithFlashAttention(FlashAttention).Build());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user