Skip to content

Commit 99a1a6a

Browse files
committed
Add Forge-Classic & add disclaimer to reForge & add undo/redo to editor context menus
1 parent 13d559d commit 99a1a6a

8 files changed

Lines changed: 227 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html).
77

88
## v2.14.0-pre.2
9+
### Added
10+
- Added new package - [Stable Diffusion WebUI Forge - Classic](https://github.com/Haoming02/sd-webui-forge-classic)
11+
- Added Undo/Redo commands to text editor context menus
912
### Changed
1013
- Updated install for kohya_ss to support RTX 5000-series GPUs
1114
### Fixed

StabilityMatrix.Avalonia/Controls/EditorCommands.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@ public static class EditorCommands
1313

1414
public static RelayCommand<TextEditor> PasteCommand { get; } =
1515
new(editor => editor?.Paste(), editor => editor?.CanPaste ?? false);
16+
17+
public static RelayCommand<TextEditor> UndoCommand { get; } =
18+
new(editor => editor?.Undo(), editor => editor?.CanUndo ?? false);
19+
20+
public static RelayCommand<TextEditor> RedoCommand { get; } =
21+
new(editor => editor?.Redo(), editor => editor?.CanRedo ?? false);
1622
}
Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
1-
<ResourceDictionary xmlns="https://github.com/avaloniaui"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
4-
xmlns:avaloniaEdit="https://github.com/avaloniaui/avaloniaedit"
5-
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls">
6-
<!-- Context menu for editors -->
1+
<ResourceDictionary
2+
xmlns="https://github.com/avaloniaui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:avaloniaEdit="https://github.com/avaloniaui/avaloniaedit"
5+
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
6+
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia">
7+
<!-- Context menu for editors -->
78
<ui:FAMenuFlyout x:Key="EditorContextFlyout">
89
<ui:MenuFlyoutItem
9-
Text="Paste"
10-
IconSource="Paste"
11-
HotKey="Ctrl+V"
1210
Command="{x:Static controls:EditorCommands.PasteCommand}"
13-
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"/>
11+
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"
12+
HotKey="Ctrl+V"
13+
IconSource="Paste"
14+
Text="Paste" />
1415
<ui:MenuFlyoutItem
15-
Text="Copy"
16-
IconSource="Copy"
17-
HotKey="Ctrl+C"
1816
Command="{x:Static controls:EditorCommands.CopyCommand}"
19-
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"/>
17+
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"
18+
HotKey="Ctrl+C"
19+
IconSource="Copy"
20+
Text="Copy" />
2021
<ui:MenuFlyoutItem
21-
Text="Cut"
22-
IconSource="Cut"
23-
HotKey="Ctrl+X"
2422
Command="{x:Static controls:EditorCommands.CutCommand}"
25-
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"/>
23+
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"
24+
HotKey="Ctrl+X"
25+
IconSource="Cut"
26+
Text="Cut" />
27+
<ui:MenuFlyoutItem
28+
Command="{x:Static controls:EditorCommands.UndoCommand}"
29+
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"
30+
HotKey="Ctrl+Z"
31+
IconSource="Undo"
32+
Text="Undo" />
33+
<ui:MenuFlyoutItem
34+
Command="{x:Static controls:EditorCommands.RedoCommand}"
35+
CommandParameter="{Binding $parent[avaloniaEdit:TextEditor]}"
36+
HotKey="Ctrl+Y"
37+
IconSource="Redo"
38+
Text="Redo" />
2639
</ui:FAMenuFlyout>
2740
</ResourceDictionary>

StabilityMatrix.Core/Helper/Factory/PackageFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ public BasePackage GetNewBasePackage(InstalledPackage installedPackage)
9898
=> new ComfyZluda(githubApiCache, settingsManager, downloadService, prerequisiteHelper),
9999
"stable-diffusion-webui-amdgpu-forge"
100100
=> new ForgeAmdGpu(githubApiCache, settingsManager, downloadService, prerequisiteHelper),
101+
"forge-classic"
102+
=> new ForgeClassic(githubApiCache, settingsManager, downloadService, prerequisiteHelper),
101103
_ => throw new ArgumentOutOfRangeException(nameof(installedPackage))
102104
};
103105
}

StabilityMatrix.Core/Helper/HardwareInfo/GpuInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public bool IsBlackwellGpu()
3737
&& !Name.Contains("RTX 5000", StringComparison.OrdinalIgnoreCase);
3838
}
3939

40-
public bool IsTritonCompatibleGpu()
40+
public bool IsAmpereOrNewerGpu()
4141
{
4242
if (Name is null)
4343
return false;

StabilityMatrix.Core/Models/Packages/ComfyUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ IPrerequisiteHelper prerequisiteHelper
308308
[TorchIndex.Cpu, TorchIndex.Cuda, TorchIndex.DirectMl, TorchIndex.Rocm, TorchIndex.Mps];
309309

310310
public override List<ExtraPackageCommand> GetExtraCommands() =>
311-
Compat.IsWindows && SettingsManager.Settings.PreferredGpu?.IsTritonCompatibleGpu() is true
311+
Compat.IsWindows && SettingsManager.Settings.PreferredGpu?.IsAmpereOrNewerGpu() is true
312312
?
313313
[
314314
new ExtraPackageCommand
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
using Injectio.Attributes;
2+
using StabilityMatrix.Core.Helper;
3+
using StabilityMatrix.Core.Helper.Cache;
4+
using StabilityMatrix.Core.Helper.HardwareInfo;
5+
using StabilityMatrix.Core.Models.FileInterfaces;
6+
using StabilityMatrix.Core.Models.Progress;
7+
using StabilityMatrix.Core.Processes;
8+
using StabilityMatrix.Core.Python;
9+
using StabilityMatrix.Core.Services;
10+
11+
namespace StabilityMatrix.Core.Models.Packages;
12+
13+
[RegisterSingleton<BasePackage, ForgeClassic>(Duplicate = DuplicateStrategy.Append)]
14+
public class ForgeClassic(
15+
IGithubApiCache githubApi,
16+
ISettingsManager settingsManager,
17+
IDownloadService downloadService,
18+
IPrerequisiteHelper prerequisiteHelper
19+
) : SDWebForge(githubApi, settingsManager, downloadService, prerequisiteHelper)
20+
{
21+
public override string Name => "forge-classic";
22+
public override string Author => "Haoming02";
23+
public override string RepositoryName => "sd-webui-forge-classic";
24+
public override string DisplayName { get; set; } = "Stable Diffusion WebUI Forge - Classic";
25+
public override string MainBranch => "classic";
26+
27+
public override string Blurb =>
28+
"This fork is focused exclusively on SD1 and SDXL checkpoints, having various optimizations implemented, with the main goal of being the lightest WebUI without any bloatwares.";
29+
public override string LicenseUrl =>
30+
"https://github.com/Haoming02/sd-webui-forge-classic/blob/classic/LICENSE";
31+
public override Uri PreviewImageUri =>
32+
new("https://github.com/Haoming02/sd-webui-forge-classic/raw/classic/html/ui.webp");
33+
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Recommended;
34+
public override IEnumerable<TorchIndex> AvailableTorchIndices => [TorchIndex.Cuda];
35+
public override bool IsCompatible => HardwareHelper.HasNvidiaGpu();
36+
public override List<LaunchOptionDefinition> LaunchOptions =>
37+
[
38+
new()
39+
{
40+
Name = "Host",
41+
Type = LaunchOptionType.String,
42+
DefaultValue = "localhost",
43+
Options = ["--server-name"]
44+
},
45+
new()
46+
{
47+
Name = "Port",
48+
Type = LaunchOptionType.String,
49+
DefaultValue = "7860",
50+
Options = ["--port"]
51+
},
52+
new()
53+
{
54+
Name = "Share",
55+
Type = LaunchOptionType.Bool,
56+
Description = "Set whether to share on Gradio",
57+
Options = { "--share" }
58+
},
59+
new()
60+
{
61+
Name = "Xformers",
62+
Type = LaunchOptionType.Bool,
63+
Description = "Set whether to use xformers",
64+
Options = { "--xformers" }
65+
},
66+
new()
67+
{
68+
Name = "Use SageAttention",
69+
Type = LaunchOptionType.Bool,
70+
Description = "Set whether to use sage attention",
71+
Options = { "--sage" }
72+
},
73+
new()
74+
{
75+
Name = "Pin Shared Memory",
76+
Type = LaunchOptionType.Bool,
77+
Options = { "--pin-shared-memory" },
78+
InitialValue = SettingsManager.Settings.PreferredGpu?.IsAmpereOrNewerGpu() ?? false
79+
},
80+
new()
81+
{
82+
Name = "CUDA Malloc",
83+
Type = LaunchOptionType.Bool,
84+
Options = { "--cuda-malloc" },
85+
InitialValue = SettingsManager.Settings.PreferredGpu?.IsAmpereOrNewerGpu() ?? false
86+
},
87+
new()
88+
{
89+
Name = "CUDA Stream",
90+
Type = LaunchOptionType.Bool,
91+
Options = { "--cuda-stream" },
92+
InitialValue = SettingsManager.Settings.PreferredGpu?.IsAmpereOrNewerGpu() ?? false
93+
},
94+
new()
95+
{
96+
Name = "Auto Launch",
97+
Type = LaunchOptionType.Bool,
98+
Description = "Set whether to auto launch the webui",
99+
Options = { "--auto-launch" }
100+
},
101+
new()
102+
{
103+
Name = "Skip Python Version Check",
104+
Type = LaunchOptionType.Bool,
105+
Description = "Set whether to skip python version check",
106+
Options = { "--skip-python-version-check" },
107+
InitialValue = true
108+
},
109+
LaunchOptionDefinition.Extras,
110+
];
111+
112+
public override async Task InstallPackage(
113+
string installLocation,
114+
InstalledPackage installedPackage,
115+
InstallPackageOptions options,
116+
IProgress<ProgressReport>? progress = null,
117+
Action<ProcessOutput>? onConsoleOutput = null,
118+
CancellationToken cancellationToken = default
119+
)
120+
{
121+
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
122+
123+
await using var venvRunner = await SetupVenvPure(installLocation).ConfigureAwait(false);
124+
125+
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);
126+
127+
progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true));
128+
129+
var requirements = new FilePath(installLocation, "requirements.txt");
130+
var requirementsContent = await requirements
131+
.ReadAllTextAsync(cancellationToken)
132+
.ConfigureAwait(false);
133+
134+
var pipArgs = new PipInstallArgs();
135+
136+
var isBlackwell =
137+
SettingsManager.Settings.PreferredGpu?.IsBlackwellGpu() ?? HardwareHelper.HasBlackwellGpu();
138+
var torchVersion = options.PythonOptions.TorchIndex ?? GetRecommendedTorchVersion();
139+
140+
if (isBlackwell && torchVersion is TorchIndex.Cuda)
141+
{
142+
pipArgs = pipArgs
143+
.AddArg("--pre")
144+
.WithTorch()
145+
.WithTorchVision()
146+
.WithTorchAudio()
147+
.WithTorchExtraIndex("nightly/cu128")
148+
.AddArg("--upgrade");
149+
150+
if (installedPackage.PipOverrides != null)
151+
{
152+
pipArgs = pipArgs.WithUserOverrides(installedPackage.PipOverrides);
153+
}
154+
progress?.Report(
155+
new ProgressReport(-1f, "Installing Torch for your shiny new GPU...", isIndeterminate: true)
156+
);
157+
await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);
158+
}
159+
else
160+
{
161+
pipArgs = pipArgs.WithTorch().WithTorchVision().WithTorchExtraIndex("cu126");
162+
}
163+
164+
if (isBlackwell && torchVersion is TorchIndex.Cuda)
165+
{
166+
pipArgs = new PipInstallArgs();
167+
}
168+
169+
pipArgs = pipArgs.WithParsedFromRequirementsTxt(requirementsContent, excludePattern: "torch");
170+
171+
if (installedPackage.PipOverrides != null)
172+
{
173+
pipArgs = pipArgs.WithUserOverrides(installedPackage.PipOverrides);
174+
}
175+
176+
await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);
177+
progress?.Report(new ProgressReport(1f, "Install complete", isIndeterminate: false));
178+
}
179+
}

StabilityMatrix.Core/Models/Packages/Reforge.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ IPrerequisiteHelper prerequisiteHelper
2222
public override string LicenseUrl =>
2323
"https://github.com/Panchovix/stable-diffusion-webui-reForge/blob/main/LICENSE.txt";
2424
public override Uri PreviewImageUri => new("https://cdn.lykos.ai/sm/packages/reforge/preview.webp");
25+
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Impossible;
26+
public override bool OfferInOneClickInstaller => false;
2527

26-
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.ReallyRecommended;
28+
public override string Disclaimer =>
29+
"Development of this package has stopped. It may be removed from Stability Matrix in the future.";
2730
}

0 commit comments

Comments
 (0)