Skip to content

Commit fdf2ae0

Browse files
authored
Merge pull request #1133 from ionite34/update-detailer
Update facedetailer and finally hook up wildcards thing
2 parents 823ecba + 080a054 commit fdf2ae0

File tree

7 files changed

+65
-11
lines changed

7 files changed

+65
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
1313
- Added Negative Rejection Steering (NRS) by @reithan to Inference
1414
- Added Czech translation thanks to @PEKArt!
1515
- Added Wan 2.2 models to the HuggingFace tab of the model browser
16+
- Added Tiled Encode/Decode options to FaceDetailer in Inference
1617
### Changed
1718
- Brought back the "size remaining after download" tooltip in the new Civitai details page
1819
- Updated ComfyUI installs for AMD users on Linux to use the latest rocm6.4 torch index
@@ -22,13 +23,14 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
2223
- Fixed extension manager failing to install extensions due to incorrect clone directory
2324
- Fixed duplicate Python versions appearing in the Advanced Options when installing a package
2425
- Fixed an error when packages and other processes exit before process tracking on windows can initialize
26+
- Fixed "none" appearing in wildcard field when using Face Detailer in Inference
2527
- Fixed [#1254](https://github.com/LykosAI/StabilityMatrix/issues/1254) - Unable to scroll samplers in Inference
2628
- Fixed [#1294](https://github.com/LykosAI/StabilityMatrix/issues/1294) - Improper sorting of output folders in Output Browser
2729
- Fixed [#1300](https://github.com/LykosAI/StabilityMatrix/issues/1300) - Git errors when installing Extension Packs
2830
- Fixed [#1317](https://github.com/LykosAI/StabilityMatrix/issues/1317) - Inference missing GGUF text encoders
2931
- Fixed [#1324](https://github.com/LykosAI/StabilityMatrix/issues/1324) - Window height slightly increasing every launch
3032
- Fixed [#1360](https://github.com/LykosAI/StabilityMatrix/issues/1360) - A1111 install not using correct torch for 5000-series GPUs
31-
- Fixed [#1361](https://github.com/LykosAI/StabilityMatrix/issues/1361) - numpy and other Forge startup
33+
- Fixed [#1361](https://github.com/LykosAI/StabilityMatrix/issues/1361) - numpy and other Forge startup
3234
### Supporters
3335
#### 🌟 Visionaries
3436
A huge thank-you to our incredible Visionary-tier supporters: **Waterclouds**, **Corey T**, **bluepopsicle**, **Bob S**, **Ibixat**, **whudunit**, and **Akiro_Senkai**! Your continued support lights the way for Stability Matrix and helps us keep building features like these. We couldn’t do it without you.

StabilityMatrix.Avalonia/Controls/Inference/FaceDetailerCard.axaml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,33 @@
133133
DataContext="{Binding SeedCardViewModel}"
134134
IsVisible="{Binding !$parent[StackPanel].((vmInference:FaceDetailerViewModel)DataContext).InheritSeed, TargetNullValue=False, FallbackValue=False}" />
135135

136+
<avalonia:SpacedGrid
137+
Margin="0,8,0,0"
138+
ColumnDefinitions="*, *"
139+
RowDefinitions="Auto, Auto">
140+
<!-- Tiled Encode -->
141+
<TextBlock Margin="4,0,4,0" Text="Tiled Encode" />
142+
<ToggleSwitch
143+
Grid.Row="1"
144+
Grid.Column="0"
145+
Margin="8,-8,4,0"
146+
IsChecked="{Binding UseTiledEncode}" />
147+
148+
<!-- Tiled Decode -->
149+
<TextBlock
150+
Grid.Row="0"
151+
Grid.Column="1"
152+
Margin="4,0,4,0"
153+
VerticalAlignment="Center"
154+
Text="Tiled Decode" />
155+
<ToggleSwitch
156+
Grid.Row="1"
157+
Grid.Column="1"
158+
Margin="8,-8,4,0"
159+
HorizontalAlignment="Stretch"
160+
IsChecked="{Binding UseTiledDecode}" />
161+
</avalonia:SpacedGrid>
162+
136163
<Separator Margin="8,16" Background="#DDDDDD" />
137164

138165
<avalonia:SpacedGrid
@@ -144,7 +171,7 @@
144171
<ToggleSwitch
145172
Grid.Row="1"
146173
Grid.Column="0"
147-
Margin="8,0,4,8"
174+
Margin="8,-8,4,0"
148175
IsChecked="{Binding GuideSizeFor}"
149176
OffContent="Crop Region"
150177
OnContent="BBox" />
@@ -159,7 +186,7 @@
159186
<ToggleSwitch
160187
Grid.Row="1"
161188
Grid.Column="1"
162-
Margin="8,0,4,0"
189+
Margin="8,-8,4,0"
163190
HorizontalAlignment="Stretch"
164191
IsChecked="{Binding ForceInpaint}" />
165192
</avalonia:SpacedGrid>
@@ -440,6 +467,9 @@
440467

441468
<!-- Positive Prompt -->
442469
<controls:PromptCard DataContext="{Binding PromptCardViewModel}" IsVisible="{Binding $parent[StackPanel].((vmInference:FaceDetailerViewModel)DataContext).UseSeparatePrompt, TargetNullValue=False, FallbackValue=False}" />
470+
471+
<TextBlock Margin="4,8,4,4" Text="{x:Static lang:Resources.Label_Wildcards}" />
472+
<controls:PromptCard Margin="0,8,0,0" DataContext="{Binding WildcardViewModel}" />
443473
</StackPanel>
444474
</ControlTemplate>
445475
</Setter>

StabilityMatrix.Avalonia/Controls/Inference/PromptCard.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@
486486
<controls:StackEditableCard
487487
Grid.Row="4"
488488
Margin="2,0,0,0"
489-
DataContext="{Binding ModulesCardViewModel}" />
489+
DataContext="{Binding ModulesCardViewModel}"
490+
IsVisible="{Binding $parent[Grid].((vmInference:PromptCardViewModel)DataContext).IsStackCardEnabled}" />
490491

491492
<!-- Styles and Prompt Expansions -->
492493
<!--<Grid Grid.Row="4" RowDefinitions="Auto,*">

StabilityMatrix.Avalonia/ViewModels/Inference/FaceDetailerViewModel.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ public partial class FaceDetailerViewModel : LoadableViewModelBase
128128
[property: Category("Settings"), DisplayName("Inherit Seed")]
129129
private bool inheritSeed = true;
130130

131+
[ObservableProperty]
132+
public partial bool UseTiledEncode { get; set; }
133+
134+
[ObservableProperty]
135+
public partial bool UseTiledDecode { get; set; }
136+
131137
public IReadOnlyList<ComfyScheduler> AvailableSchedulers => ComfyScheduler.FaceDetailerDefaults;
132138

133139
/// <inheritdoc/>
@@ -141,6 +147,11 @@ IServiceManager<ViewModelBase> vmFactory
141147
SeedCardViewModel = vmFactory.Get<SeedCardViewModel>();
142148
SeedCardViewModel.GenerateNewSeed();
143149
PromptCardViewModel = vmFactory.Get<PromptCardViewModel>();
150+
WildcardViewModel = vmFactory.Get<PromptCardViewModel>(vm =>
151+
{
152+
vm.IsNegativePromptEnabled = false;
153+
vm.IsStackCardEnabled = false;
154+
});
144155
}
145156

146157
[JsonPropertyName("DetailerSeed")]
@@ -149,6 +160,9 @@ IServiceManager<ViewModelBase> vmFactory
149160
[JsonPropertyName("DetailerPrompt")]
150161
public PromptCardViewModel PromptCardViewModel { get; }
151162

163+
[JsonPropertyName("DetailerWildcard")]
164+
public PromptCardViewModel WildcardViewModel { get; }
165+
152166
public ObservableCollection<string> SamDetectionHints { get; set; } =
153167
[
154168
"center-1",
@@ -159,7 +173,7 @@ IServiceManager<ViewModelBase> vmFactory
159173
"mask-area",
160174
"mask-points",
161175
"mask-point-bbox",
162-
"none"
176+
"none",
163177
];
164178

165179
public ObservableCollection<string> SamMaskHintUseNegatives { get; set; } = ["False", "Small", "Outter"];

StabilityMatrix.Avalonia/ViewModels/Inference/Modules/FaceDetailerModule.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ protected override void OnApplyStep(ModuleApplyStepEventArgs e)
131131
Positive = GetPositiveConditioning(faceDetailerCard, e),
132132
Negative = GetNegativeConditioning(faceDetailerCard, e),
133133
BboxDetector = e.Nodes.AddTypedNode(bboxLoader).Output1,
134-
Wildcard = new StringNodeConnection() // TODO put <lora:stuff:here>
134+
Wildcard = faceDetailerCard.WildcardViewModel.GetPrompt().ProcessedText ?? string.Empty,
135+
TiledDecode = faceDetailerCard.UseTiledDecode,
136+
TiledEncode = faceDetailerCard.UseTiledEncode,
135137
};
136138

137139
var segmModelName = GetModelName(faceDetailerCard.SegmModel);
@@ -140,7 +142,7 @@ protected override void OnApplyStep(ModuleApplyStepEventArgs e)
140142
var segmLoader = new ComfyNodeBuilder.UltralyticsDetectorProvider
141143
{
142144
Name = e.Builder.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.UltralyticsDetectorProvider)),
143-
ModelName = segmModelName
145+
ModelName = segmModelName,
144146
};
145147
faceDetailer.SegmDetectorOpt = e.Nodes.AddTypedNode(segmLoader).Output2;
146148
}
@@ -168,7 +170,7 @@ protected override void OnApplyStep(ModuleApplyStepEventArgs e)
168170
{ RemoteName: "@none" } => null,
169171
{ Local: not null } => model.RelativePath.NormalizePathSeparators(),
170172
{ RemoteName: not null } => model.RemoteName,
171-
_ => null
173+
_ => null,
172174
};
173175

174176
private ConditioningNodeConnection GetPositiveConditioning(
@@ -188,7 +190,7 @@ ModuleApplyStepEventArgs e
188190
{
189191
Name = e.Builder.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.CLIPTextEncode)),
190192
Clip = e.Builder.Connections.Base.Clip!,
191-
Text = prompt.ProcessedText
193+
Text = prompt.ProcessedText,
192194
}
193195
);
194196

@@ -212,7 +214,7 @@ ModuleApplyStepEventArgs e
212214
{
213215
Name = e.Builder.Nodes.GetUniqueName(nameof(ComfyNodeBuilder.CLIPTextEncode)),
214216
Clip = e.Builder.Connections.Base.Clip!,
215-
Text = prompt.ProcessedText
217+
Text = prompt.ProcessedText,
216218
}
217219
);
218220

StabilityMatrix.Avalonia/ViewModels/Inference/PromptCardViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ public partial class PromptCardViewModel
109109
[NotifyPropertyChangedFor(nameof(ShowLowTokenWarning))]
110110
private int lowTokenThreshold = 25;
111111

112+
[ObservableProperty]
113+
public partial bool IsStackCardEnabled { get; set; } = true;
114+
112115
public bool ShowLowTokenWarning => TokensRemaining <= LowTokenThreshold && TokensRemaining >= 0;
113116

114117
public string LowTokenWarningText =>

StabilityMatrix.Core/Models/Api/Comfy/Nodes/ComfyNodeBuilder.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ public record FaceDetailer : ComfyTypedNodeBase<ImageNodeConnection>
765765
/// </summary>
766766
public required string SamMaskHintUseNegative { get; init; } = "False";
767767

768-
public required StringNodeConnection Wildcard { get; init; }
768+
public required string Wildcard { get; init; }
769769

770770
[Range(1, 32768)]
771771
public required int DropSize { get; init; } = 10;
@@ -775,6 +775,8 @@ public record FaceDetailer : ComfyTypedNodeBase<ImageNodeConnection>
775775

776776
public SamModelNodeConnection? SamModelOpt { get; set; }
777777
public SegmDetectorNodeConnection? SegmDetectorOpt { get; set; }
778+
public bool TiledEncode { get; init; }
779+
public bool TiledDecode { get; init; }
778780
}
779781

780782
/// <summary>

0 commit comments

Comments
 (0)