Skip to content

Commit 2c8d634

Browse files
committed
v0.5.3 - LTX-2, FLUX.2 Klein, Z-Image ControlNet, Checkpoint downloading
1 parent 67e74d3 commit 2c8d634

33 files changed

+1496
-238
lines changed

DiffuseApp/DiffuseApp/App.xaml

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -399,18 +399,43 @@
399399

400400
<DataTemplate x:Key="ComboBoxDataTemplateModel">
401401
<DockPanel>
402-
<CommonControls:FontAwesome DockPanel.Dock="Right" Icon="f019" Size="10" IconStyle="Solid" Opacity=".6" >
403-
<CommonControls:FontAwesome.Style>
404-
<Style TargetType="{x:Type CommonControls:FontAwesome}" BasedOn="{StaticResource {x:Type CommonControls:FontAwesome}}">
405-
<Setter Property="Color" Value="#10FFFFFF"/>
406-
<Style.Triggers>
407-
<DataTrigger Binding="{Binding IsValid}" Value="True">
408-
<Setter Property="Color" Value="{StaticResource AccentColour2}"/>
409-
</DataTrigger>
410-
</Style.Triggers>
411-
</Style>
412-
</CommonControls:FontAwesome.Style>
413-
</CommonControls:FontAwesome>
402+
403+
<UniformGrid DockPanel.Dock="Right" Columns="2">
404+
405+
<!--IsGated-->
406+
<CommonControls:FontAwesome Icon="f084" Size="10" IconStyle="Solid" Opacity=".6" Width="15" ToolTipService.InitialShowDelay="200">
407+
<CommonControls:FontAwesome.Style>
408+
<Style TargetType="{x:Type CommonControls:FontAwesome}" BasedOn="{StaticResource {x:Type CommonControls:FontAwesome}}">
409+
<Setter Property="ToolTip" Value="{x:Null}"/>
410+
<Setter Property="Color" Value="#10FFFFFF"/>
411+
<Style.Triggers>
412+
<DataTrigger Binding="{Binding IsGated}" Value="True">
413+
<Setter Property="Color" Value="{StaticResource AccentColour2}"/>
414+
<Setter Property="ToolTip" Value="Gated Model - HuggingFace Authentication Required."/>
415+
</DataTrigger>
416+
</Style.Triggers>
417+
</Style>
418+
</CommonControls:FontAwesome.Style>
419+
</CommonControls:FontAwesome>
420+
421+
<!--IsValid-->
422+
<CommonControls:FontAwesome Icon="f00c" Size="10" IconStyle="Solid" Opacity=".6" ToolTipService.InitialShowDelay="200">
423+
<CommonControls:FontAwesome.Style>
424+
<Style TargetType="{x:Type CommonControls:FontAwesome}" BasedOn="{StaticResource {x:Type CommonControls:FontAwesome}}">
425+
<Setter Property="Color" Value="#10FFFFFF"/>
426+
<Setter Property="ToolTip" Value="Model Not Downloaded"/>
427+
<Style.Triggers>
428+
<DataTrigger Binding="{Binding IsValid}" Value="True">
429+
<Setter Property="Color" Value="{StaticResource SuccessColour}"/>
430+
<Setter Property="ToolTip" Value="Model Downloaded"/>
431+
</DataTrigger>
432+
</Style.Triggers>
433+
</Style>
434+
</CommonControls:FontAwesome.Style>
435+
</CommonControls:FontAwesome>
436+
</UniformGrid>
437+
438+
414439
<TextBlock Text="{Binding Name}" />
415440
</DockPanel>
416441
</DataTemplate>

DiffuseApp/DiffuseApp/Common/AudioModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class AudioModel : BaseModel
1717
public BackendType Backend { get; set; }
1818
public string Name { get; set; }
1919
public bool IsDefault { get; set; }
20+
public bool IsGated { get; set; }
21+
public string Link { get; set; }
2022
public AudioModelType Type { get; set; }
2123
public string Version { get; set; }
2224
public int MinLength { get; set; }

DiffuseApp/DiffuseApp/Common/ControlNetModel.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class ControlNetModel : BaseModel
1717
public ModelSourceType Source { get; set; }
1818
public string Pipeline { get; set; }
1919
public bool IsDefault { get; set; }
20-
20+
public bool IsGated { get; set; }
21+
public string Link { get; set; }
2122

2223
[JsonIgnore]
2324
public bool IsValid
@@ -32,9 +33,13 @@ public void Initialize(string modelDirectory)
3233
if (Source == ModelSourceType.Folder)
3334
IsValid = Directory.Exists(Path);
3435
else if (Source == ModelSourceType.SingleFile)
35-
IsValid = File.Exists(Path);
36+
{
37+
IsValid = Utils.IsControlNetInstalled(modelDirectory, Path);
38+
}
3639
else if (Source == ModelSourceType.HuggingFace)
37-
IsValid = Directory.Exists(System.IO.Path.Combine(modelDirectory, Utils.GetHuggingFaceCacheId(Path)));
40+
{
41+
IsValid = Utils.IsControlNetInstalled(modelDirectory, Path);
42+
}
3843
}
3944
}
4045
}

DiffuseApp/DiffuseApp/Common/DiffusionDefaultOptions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public record DiffusionDefaultOptions
3030
public int BaseImageSeqLen { get; set; } = 256;
3131
public int MaxImageSeqLen { get; set; } = 4096;
3232
public bool UseDynamicShifting { get; set; }
33-
33+
public int SampleRate { get; set; } = 24000;
34+
public int FramesMin { get; set; }
35+
public int FramesMax { get; set; }
36+
public bool IsStochasticSampling { get; set; }
3437

3538
public virtual bool Equals(DiffusionDefaultOptions other) => ReferenceEquals(this, other);
3639
public override int GetHashCode() => RuntimeHelpers.GetHashCode(this);

DiffuseApp/DiffuseApp/Common/DiffusionInputOptions.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public record DiffusionInputOptions : BaseRecord
2424
private int _inputImageCount = 0;
2525
private SchedulerInputOptions _schedulerOptions = new SchedulerInputOptions();
2626
private List<LoraOptionModel> _loraOptions;
27+
private int _frames;
28+
private float _frameRate;
2729

2830
public int Width
2931
{
@@ -72,7 +74,6 @@ public string NegativePrompt
7274
get { return _negativePrompt; }
7375
set { SetProperty(ref _negativePrompt, value); }
7476
}
75-
7677
public int Steps
7778
{
7879
get { return _steps; }
@@ -115,6 +116,19 @@ public SchedulerInputOptions SchedulerOptions
115116
set { SetProperty(ref _schedulerOptions, value); }
116117
}
117118

119+
public int Frames
120+
{
121+
get { return _frames; }
122+
set { SetProperty(ref _frames, value); }
123+
}
124+
125+
public float FrameRate
126+
{
127+
get { return _frameRate; }
128+
set { SetProperty(ref _frameRate, value); }
129+
}
130+
131+
118132

119133
[JsonIgnore]
120134
public ImageTensor InputImage

DiffuseApp/DiffuseApp/Common/DiffusionModel.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.IO;
3+
using System.Linq;
34
using System.Text.Json.Serialization;
45
using TensorStack.Common.Common;
56
using TensorStack.Python.Common;
@@ -20,6 +21,8 @@ public class DiffusionModel : BaseModel
2021
public string Variant { get; set; }
2122
public ModelSourceType Source { get; set; }
2223
public bool IsDefault { get; set; }
24+
public bool IsGated { get; set; }
25+
public string Link { get; set; }
2326
public MemoryProfile[] MemoryProfile { get; set; }
2427
public DataType BaseType { get; set; }
2528
public ProcessType[] ProcessTypes { get; set; }
@@ -46,17 +49,18 @@ public void Initialize(string modelDirectory)
4649
IsValid = Directory.Exists(System.IO.Path.Combine(modelDirectory, Utils.GetHuggingFaceCacheId(Path)));
4750
else if (Source == ModelSourceType.SingleFile)
4851
{
49-
IsValid = Checkpoint is not null && File.Exists(Checkpoint.Checkpoint);
52+
IsValid = Checkpoint is not null && Utils.IsCheckpointInstalled(modelDirectory, Checkpoint.Checkpoint);
5053
}
5154
else if (Source == ModelSourceType.Checkpoint)
5255
{
5356
IsValid = Checkpoint is not null
54-
&& Utils.TryParseHuggingFaceRepo(Path, out _)
55-
&& (string.IsNullOrEmpty(Checkpoint.VaeCheckpoint) || File.Exists(Checkpoint.VaeCheckpoint))
56-
&& (string.IsNullOrEmpty(Checkpoint.ModelCheckpoint) || File.Exists(Checkpoint.ModelCheckpoint))
57-
&& (string.IsNullOrEmpty(Checkpoint.TextEncoderCheckpoint) || File.Exists(Checkpoint.TextEncoderCheckpoint));
57+
&& Utils.TryParseHuggingFaceRepo(Path, out _)
58+
&& (string.IsNullOrEmpty(Checkpoint.VaeCheckpoint) || Utils.IsCheckpointInstalled(modelDirectory, Checkpoint.VaeCheckpoint))
59+
&& (string.IsNullOrEmpty(Checkpoint.ModelCheckpoint) || Utils.IsCheckpointInstalled(modelDirectory, Checkpoint.ModelCheckpoint))
60+
&& (string.IsNullOrEmpty(Checkpoint.TextEncoderCheckpoint) || Utils.IsCheckpointInstalled(modelDirectory, Checkpoint.TextEncoderCheckpoint));
5861
}
5962
}
63+
6064
}
6165

6266
public sealed class MemoryProfile : BaseModel

DiffuseApp/DiffuseApp/Common/ExtractModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public class ExtractModel : BaseModel
1818
public BackendType Backend { get; set; }
1919
public string Name { get; set; }
2020
public bool IsDefault { get; set; }
21+
public bool IsGated { get; set; }
22+
public string Link { get; set; }
2123
public ExtractorType Type { get; set; }
2224
public int Channels { get; set; } = 3;
2325
public int SampleSize { get; set; }

DiffuseApp/DiffuseApp/Common/LoraAdapterModel.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public string Weights
2525
public ModelSourceType Source { get; set; }
2626
public string[] Triggers { get; set; }
2727
public bool IsDefault { get; set; }
28-
28+
public bool IsGated { get; set; }
29+
public string Link { get; set; }
2930

3031
[JsonIgnore]
3132
public bool IsValid
@@ -39,9 +40,13 @@ public void Initialize(string modelDirectory)
3940
if (Source == ModelSourceType.Folder)
4041
IsValid = Directory.Exists(Path);
4142
else if (Source == ModelSourceType.SingleFile)
42-
IsValid = File.Exists(Path);
43+
{
44+
IsValid = Utils.IsLoraAdapterInstalled(modelDirectory, Path, Weights);
45+
}
4346
else if (Source == ModelSourceType.HuggingFace)
44-
IsValid = Directory.Exists(System.IO.Path.Combine(modelDirectory, Utils.GetHuggingFaceCacheId(Path)));
47+
{
48+
IsValid = Utils.IsLoraAdapterInstalled(modelDirectory, Path, Weights);
49+
}
4550
}
4651
}
4752
}

DiffuseApp/DiffuseApp/Common/SchedulerInputOptions.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ namespace Diffuse.Common
66
{
77
public record SchedulerInputOptions : BaseRecord
88
{
9+
private float _shift = 1.0f;
10+
private bool _useDynamicShifting = false;
11+
private bool _stochasticSampling = false;
12+
913
public int NumTrainTimesteps { get; set; } = 1000;
1014

1115
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
@@ -53,8 +57,11 @@ public record SchedulerInputOptions : BaseRecord
5357

5458
// IsStochastic
5559
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
56-
public bool StochasticSampling { get; set; } = false;
57-
60+
public bool StochasticSampling
61+
{
62+
get { return _stochasticSampling; }
63+
set { SetProperty(ref _stochasticSampling, value); }
64+
}
5865
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
5966
public float Eta { get; set; } = 0.0f;
6067
public float SNoise { get; set; } = 1.0f;
@@ -69,10 +76,17 @@ public record SchedulerInputOptions : BaseRecord
6976
public float STmax { get; set; } = 0.0f; // 0 = float.PositiveInfinity;
7077

7178
// IsFlowMatch
72-
public float Shift { get; set; } = 1.0f;
73-
79+
public float Shift
80+
{
81+
get { return _shift; }
82+
set { SetProperty(ref _shift, value); }
83+
}
7484
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
75-
public bool UseDynamicShifting { get; set; } = false;
85+
public bool UseDynamicShifting
86+
{
87+
get { return _useDynamicShifting; }
88+
set { SetProperty(ref _useDynamicShifting, value); }
89+
}
7690
public float BaseShift { get; set; } = 0.5f;
7791
public float MaxShift { get; set; } = 1.15f;
7892

@@ -81,6 +95,6 @@ public record SchedulerInputOptions : BaseRecord
8195

8296
public int BaseImageSeqLen { get; set; }
8397
public int MaxImageSeqLen { get; set; }
84-
98+
8599
}
86100
}

DiffuseApp/DiffuseApp/Common/UpscaleModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class UpscaleModel : BaseModel
1919
public BackendType Backend { get; set; }
2020
public string Name { get; set; }
2121
public bool IsDefault { get; set; }
22+
public bool IsGated { get; set; }
23+
public string Link { get; set; }
2224
public int Channels { get; set; } = 3;
2325
public int SampleSize { get; set; }
2426
public int ScaleFactor { get; set; } = 1;

0 commit comments

Comments
 (0)