Skip to content

Commit 1b24871

Browse files
authored
Merge branch 'dev' into prompt-amplify-n-stuff
2 parents db617db + 944774a commit 1b24871

8 files changed

Lines changed: 249 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: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
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 Dictionary<SharedFolderType, IReadOnlyList<string>> SharedFolders =>
113+
new()
114+
{
115+
[SharedFolderType.StableDiffusion] = ["models/Stable-diffusion/sd"],
116+
[SharedFolderType.ESRGAN] = ["models/ESRGAN"],
117+
[SharedFolderType.Lora] = ["models/Lora"],
118+
[SharedFolderType.LyCORIS] = ["models/LyCORIS"],
119+
[SharedFolderType.ApproxVAE] = ["models/VAE-approx"],
120+
[SharedFolderType.VAE] = ["models/VAE"],
121+
[SharedFolderType.DeepDanbooru] = ["models/deepbooru"],
122+
[SharedFolderType.Embeddings] = ["models/embeddings"],
123+
[SharedFolderType.Hypernetwork] = ["models/hypernetworks"],
124+
[SharedFolderType.ControlNet] = ["models/controlnet/ControlNet"],
125+
[SharedFolderType.AfterDetailer] = ["models/adetailer"],
126+
[SharedFolderType.T2IAdapter] = ["models/controlnet/T2IAdapter"],
127+
[SharedFolderType.IpAdapter] = ["models/controlnet/IpAdapter"],
128+
[SharedFolderType.IpAdapters15] = ["models/controlnet/DiffusersIpAdapters"],
129+
[SharedFolderType.IpAdaptersXl] = ["models/controlnet/DiffusersIpAdaptersXL"],
130+
[SharedFolderType.TextEncoders] = ["models/text_encoder"],
131+
[SharedFolderType.DiffusionModels] = ["models/Stable-diffusion/unet"],
132+
};
133+
134+
public override async Task InstallPackage(
135+
string installLocation,
136+
InstalledPackage installedPackage,
137+
InstallPackageOptions options,
138+
IProgress<ProgressReport>? progress = null,
139+
Action<ProcessOutput>? onConsoleOutput = null,
140+
CancellationToken cancellationToken = default
141+
)
142+
{
143+
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
144+
145+
await using var venvRunner = await SetupVenvPure(installLocation).ConfigureAwait(false);
146+
147+
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);
148+
149+
progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true));
150+
151+
var requirements = new FilePath(installLocation, "requirements.txt");
152+
var requirementsContent = await requirements
153+
.ReadAllTextAsync(cancellationToken)
154+
.ConfigureAwait(false);
155+
156+
var pipArgs = new PipInstallArgs();
157+
158+
var isBlackwell =
159+
SettingsManager.Settings.PreferredGpu?.IsBlackwellGpu() ?? HardwareHelper.HasBlackwellGpu();
160+
var torchVersion = options.PythonOptions.TorchIndex ?? GetRecommendedTorchVersion();
161+
162+
if (isBlackwell && torchVersion is TorchIndex.Cuda)
163+
{
164+
pipArgs = pipArgs
165+
.AddArg("--pre")
166+
.WithTorch()
167+
.WithTorchVision()
168+
.WithTorchAudio()
169+
.WithTorchExtraIndex("nightly/cu128")
170+
.AddArg("--upgrade");
171+
172+
if (installedPackage.PipOverrides != null)
173+
{
174+
pipArgs = pipArgs.WithUserOverrides(installedPackage.PipOverrides);
175+
}
176+
progress?.Report(
177+
new ProgressReport(-1f, "Installing Torch for your shiny new GPU...", isIndeterminate: true)
178+
);
179+
await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);
180+
}
181+
else
182+
{
183+
pipArgs = pipArgs.WithTorch().WithTorchVision().WithTorchExtraIndex("cu126");
184+
}
185+
186+
if (isBlackwell && torchVersion is TorchIndex.Cuda)
187+
{
188+
pipArgs = new PipInstallArgs();
189+
}
190+
191+
pipArgs = pipArgs.WithParsedFromRequirementsTxt(requirementsContent, excludePattern: "torch");
192+
193+
if (installedPackage.PipOverrides != null)
194+
{
195+
pipArgs = pipArgs.WithUserOverrides(installedPackage.PipOverrides);
196+
}
197+
198+
await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);
199+
progress?.Report(new ProgressReport(1f, "Install complete", isIndeterminate: false));
200+
}
201+
}

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)