From 93a16cbd3e9a903b554af4d0ba940a01518e552d Mon Sep 17 00:00:00 2001 From: Ionite Date: Thu, 9 May 2024 16:51:42 -0400 Subject: [PATCH 1/4] Remove preview torch from mps install Stable supports MPS now, pre flag getting dev builds instead (cherry picked from commit 6e079ae84e0523c360115fba8e9efaa993981544) --- StabilityMatrix.Core/Models/Packages/A3WebUI.cs | 2 +- StabilityMatrix.Core/Models/Packages/ComfyUI.cs | 3 +-- StabilityMatrix.Core/Models/Packages/SDWebForge.cs | 2 +- StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/StabilityMatrix.Core/Models/Packages/A3WebUI.cs b/StabilityMatrix.Core/Models/Packages/A3WebUI.cs index 9e9b5b80..16dbf4f7 100644 --- a/StabilityMatrix.Core/Models/Packages/A3WebUI.cs +++ b/StabilityMatrix.Core/Models/Packages/A3WebUI.cs @@ -223,7 +223,7 @@ public class A3WebUI( TorchVersion.Cpu => "cpu", TorchVersion.Cuda => "cu121", TorchVersion.Rocm => "rocm5.6", - TorchVersion.Mps => "nightly/cpu", + TorchVersion.Mps => "cpu", _ => throw new ArgumentOutOfRangeException(nameof(torchVersion), torchVersion, null) } ) diff --git a/StabilityMatrix.Core/Models/Packages/ComfyUI.cs b/StabilityMatrix.Core/Models/Packages/ComfyUI.cs index 61c10f96..f172b29d 100644 --- a/StabilityMatrix.Core/Models/Packages/ComfyUI.cs +++ b/StabilityMatrix.Core/Models/Packages/ComfyUI.cs @@ -209,8 +209,7 @@ public class ComfyUI( pipArgs = torchVersion switch { TorchVersion.DirectMl => pipArgs.WithTorchDirectML(), - TorchVersion.Mps - => pipArgs.AddArg("--pre").WithTorch().WithTorchVision().WithTorchExtraIndex("nightly/cpu"), + TorchVersion.Mps => pipArgs.WithTorch().WithTorchVision().WithTorchExtraIndex("cpu"), _ => pipArgs .AddArg("--upgrade") diff --git a/StabilityMatrix.Core/Models/Packages/SDWebForge.cs b/StabilityMatrix.Core/Models/Packages/SDWebForge.cs index 43fa5e22..7bda64fc 100644 --- a/StabilityMatrix.Core/Models/Packages/SDWebForge.cs +++ b/StabilityMatrix.Core/Models/Packages/SDWebForge.cs @@ -162,7 +162,7 @@ public class SDWebForge( TorchVersion.Cpu => "cpu", TorchVersion.Cuda => "cu121", TorchVersion.Rocm => "rocm5.6", - TorchVersion.Mps => "nightly/cpu", + TorchVersion.Mps => "cpu", _ => throw new ArgumentOutOfRangeException(nameof(torchVersion), torchVersion, null) } ); diff --git a/StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs b/StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs index 5b5cacfa..b881efe4 100644 --- a/StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs +++ b/StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs @@ -211,7 +211,7 @@ public class StableDiffusionUx( new PipInstallArgs() .WithTorch("==2.1.2") .WithTorchVision() - .WithTorchExtraIndex("nightly/cpu"), + .WithTorchExtraIndex("cpu"), onConsoleOutput ) .ConfigureAwait(false); From 8a202c7aef0ccf80c9264d8245f1929557ccd484 Mon Sep 17 00:00:00 2001 From: Ionite Date: Thu, 9 May 2024 16:54:12 -0400 Subject: [PATCH 2/4] Update CHANGELOG.md (cherry picked from commit dc2027dc5ea57fa4043d40285609d6880071ffbf) # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4b8b291..4a04b206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to Stability Matrix will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). +## v2.10.3 +### Fixed +- Fixed MPS install on macOS for ComfyUI, A1111, SDWebUI Forge, and SDWebUI UX causing torch to be upgraded to dev nightly versions and causing incompatibilities with dependencies. + ## v2.10.2 ### Changed - Updated translations for Spanish and Turkish From 4b86f28bb8e04bde229477f302eaf5b45b90f999 Mon Sep 17 00:00:00 2001 From: JT Date: Thu, 9 May 2024 19:48:08 -0700 Subject: [PATCH 3/4] Some bugfixes from dev --- CHANGELOG.md | 8 +++ .../Dialogs/PythonPackagesItemViewModel.cs | 5 ++ .../PackageInstallProgressItemViewModel.cs | 2 +- .../ViewModels/RunningPackageViewModel.cs | 16 ++++++ .../Views/CivitAiBrowserPage.axaml | 6 +-- .../Views/ConsoleOutputPage.axaml.cs | 2 +- .../Views/OpenArtBrowserPage.axaml | 1 + .../Models/Packages/A3WebUI.cs | 14 ++--- .../Models/Packages/ComfyUI.cs | 1 - .../Models/Packages/SDWebForge.cs | 11 ++++ StabilityMatrix.Core/Python/PipShowResult.cs | 52 +++++++++++++++---- 11 files changed, 94 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a04b206..420397c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ## v2.10.3 +### Changed +- Centered OpenArt browser cards ### Fixed - Fixed MPS install on macOS for ComfyUI, A1111, SDWebUI Forge, and SDWebUI UX causing torch to be upgraded to dev nightly versions and causing incompatibilities with dependencies. +- Fixed crash when failing to parse Python package details +- Fixed "Auto Scroll to End" not working in some scenarios +- Fixed "Auto Scroll to End" toggle button not scrolling to the end when toggled on +- Fixed/reverted output folder name changes for Automatic1111 +- Fixed xformers being uninstalled with every ComfyUI update +- Fixed missing progress text during package installs ## v2.10.2 ### Changed diff --git a/StabilityMatrix.Avalonia/ViewModels/Dialogs/PythonPackagesItemViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/Dialogs/PythonPackagesItemViewModel.cs index a31e7cf2..81fcbc90 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Dialogs/PythonPackagesItemViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Dialogs/PythonPackagesItemViewModel.cs @@ -6,6 +6,7 @@ using Avalonia.Controls; using CommunityToolkit.Mvvm.ComponentModel; using Semver; using StabilityMatrix.Avalonia.ViewModels.Base; +using StabilityMatrix.Core.Exceptions; using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Models.FileInterfaces; using StabilityMatrix.Core.Python; @@ -114,6 +115,10 @@ public partial class PythonPackagesItemViewModel : ViewModelBase } } } + catch (ProcessException) + { + // Ignore + } finally { IsLoading = false; diff --git a/StabilityMatrix.Avalonia/ViewModels/Progress/PackageInstallProgressItemViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/Progress/PackageInstallProgressItemViewModel.cs index fb74fc17..f977353a 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Progress/PackageInstallProgressItemViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Progress/PackageInstallProgressItemViewModel.cs @@ -43,7 +43,7 @@ public class PackageInstallProgressItemViewModel : ProgressItemViewModelBase private void PackageModificationRunnerOnProgressChanged(object? sender, ProgressReport e) { Progress.Value = e.Percentage; - Progress.Description = e.Message; + Progress.Description = e.ProcessOutput?.Text ?? e.Message; Progress.IsIndeterminate = e.IsIndeterminate; Progress.Text = packageModificationRunner.CurrentStep?.ProgressTitle; Name = packageModificationRunner.CurrentStep?.ProgressTitle; diff --git a/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs index f622cc67..c3cf4eb2 100644 --- a/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs @@ -74,6 +74,14 @@ public partial class RunningPackageViewModel : PageViewModelBase, IDisposable, I ); } + public override void OnLoaded() + { + if (AutoScrollToEnd) + { + EventManager.Instance.OnScrollToBottomRequested(); + } + } + private void BasePackageOnExited(object? sender, int e) { IsRunning = false; @@ -104,6 +112,14 @@ public partial class RunningPackageViewModel : PageViewModelBase, IDisposable, I } } + partial void OnAutoScrollToEndChanged(bool value) + { + if (value) + { + EventManager.Instance.OnScrollToBottomRequested(); + } + } + [RelayCommand] private async Task Restart() { diff --git a/StabilityMatrix.Avalonia/Views/CivitAiBrowserPage.axaml b/StabilityMatrix.Avalonia/Views/CivitAiBrowserPage.axaml index 288c0328..a1872104 100644 --- a/StabilityMatrix.Avalonia/Views/CivitAiBrowserPage.axaml +++ b/StabilityMatrix.Avalonia/Views/CivitAiBrowserPage.axaml @@ -33,7 +33,7 @@ - @@ -61,7 +61,7 @@ diff --git a/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml.cs b/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml.cs index 5123da7d..d0777121 100644 --- a/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml.cs +++ b/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml.cs @@ -36,8 +36,8 @@ public partial class ConsoleOutputPage : UserControlBase protected override void OnLoaded(RoutedEventArgs e) { - base.OnLoaded(e); EventManager.Instance.ScrollToBottomRequested += OnScrollToBottomRequested; + base.OnLoaded(e); } private void OnScrollToBottomRequested(object? sender, EventArgs e) diff --git a/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml b/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml index c4f8189f..1989f622 100644 --- a/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml +++ b/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml @@ -305,6 +305,7 @@ diff --git a/StabilityMatrix.Core/Models/Packages/A3WebUI.cs b/StabilityMatrix.Core/Models/Packages/A3WebUI.cs index 16dbf4f7..05258e0a 100644 --- a/StabilityMatrix.Core/Models/Packages/A3WebUI.cs +++ b/StabilityMatrix.Core/Models/Packages/A3WebUI.cs @@ -73,13 +73,13 @@ public class A3WebUI( public override Dictionary>? SharedOutputFolders => new() { - [SharedOutputType.Extras] = new[] { "output/extras-images" }, + [SharedOutputType.Extras] = new[] { "outputs/extras-images" }, [SharedOutputType.Saved] = new[] { "log/images" }, - [SharedOutputType.Img2Img] = new[] { "output/img2img-images" }, - [SharedOutputType.Text2Img] = new[] { "output/txt2img-images" }, - [SharedOutputType.Img2ImgGrids] = new[] { "output/img2img-grids" }, - [SharedOutputType.Text2ImgGrids] = new[] { "output/txt2img-grids" }, - [SharedOutputType.SVD] = new[] { "output/svd" } + [SharedOutputType.Img2Img] = new[] { "outputs/img2img-images" }, + [SharedOutputType.Text2Img] = new[] { "outputs/txt2img-images" }, + [SharedOutputType.Img2ImgGrids] = new[] { "outputs/img2img-grids" }, + [SharedOutputType.Text2ImgGrids] = new[] { "outputs/txt2img-grids" }, + [SharedOutputType.SVD] = new[] { "outputs/svd" } }; [SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeNotEvident")] @@ -186,7 +186,7 @@ public class A3WebUI( public override string MainBranch => "master"; - public override string OutputFolderName => "output"; + public override string OutputFolderName => "outputs"; public override IPackageExtensionManager ExtensionManager => new A3WebUiExtensionManager(this); diff --git a/StabilityMatrix.Core/Models/Packages/ComfyUI.cs b/StabilityMatrix.Core/Models/Packages/ComfyUI.cs index f172b29d..8fa0f3c4 100644 --- a/StabilityMatrix.Core/Models/Packages/ComfyUI.cs +++ b/StabilityMatrix.Core/Models/Packages/ComfyUI.cs @@ -245,7 +245,6 @@ public class ComfyUI( excludePattern: "torch" ); - await venvRunner.PipUninstall("xformers", onConsoleOutput).ConfigureAwait(false); await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false); progress?.Report(new ProgressReport(1, "Installed Package Requirements", isIndeterminate: false)); diff --git a/StabilityMatrix.Core/Models/Packages/SDWebForge.cs b/StabilityMatrix.Core/Models/Packages/SDWebForge.cs index 7bda64fc..0091b6ff 100644 --- a/StabilityMatrix.Core/Models/Packages/SDWebForge.cs +++ b/StabilityMatrix.Core/Models/Packages/SDWebForge.cs @@ -40,6 +40,17 @@ public class SDWebForge( public override IPackageExtensionManager ExtensionManager => null; public override string OutputFolderName => "output"; public override PackageDifficulty InstallerSortOrder => PackageDifficulty.ReallyRecommended; + public override Dictionary>? SharedOutputFolders => + new() + { + [SharedOutputType.Extras] = new[] { "output/extras-images" }, + [SharedOutputType.Saved] = new[] { "log/images" }, + [SharedOutputType.Img2Img] = new[] { "output/img2img-images" }, + [SharedOutputType.Text2Img] = new[] { "output/txt2img-images" }, + [SharedOutputType.Img2ImgGrids] = new[] { "output/img2img-grids" }, + [SharedOutputType.Text2ImgGrids] = new[] { "output/txt2img-grids" }, + [SharedOutputType.SVD] = new[] { "output/svd" } + }; public override List LaunchOptions => [ diff --git a/StabilityMatrix.Core/Python/PipShowResult.cs b/StabilityMatrix.Core/Python/PipShowResult.cs index 15e86cfc..7e66ccbb 100644 --- a/StabilityMatrix.Core/Python/PipShowResult.cs +++ b/StabilityMatrix.Core/Python/PipShowResult.cs @@ -1,4 +1,5 @@ -using StabilityMatrix.Core.Extensions; +using System.Diagnostics; +using StabilityMatrix.Core.Extensions; namespace StabilityMatrix.Core.Python; @@ -31,6 +32,20 @@ public record PipShowResult .SplitLines(StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) // Filter warning lines .Where(line => !line.StartsWith("WARNING", StringComparison.OrdinalIgnoreCase)) + .ToList(); + + var indexOfLicense = GetIndexBySubstring(lines, "License:"); + var indexOfLocation = GetIndexBySubstring(lines, "Location:"); + + var licenseText = + indexOfLicense == -1 ? null : string.Join('\n', lines[indexOfLicense..indexOfLocation]); + + if (indexOfLicense != -1) + { + lines.RemoveRange(indexOfLicense, indexOfLocation - indexOfLicense); + } + + var linesDict = lines .Select(line => line.Split(':', 2)) .Where(split => split.Length == 2) .Select(split => new KeyValuePair(split[0].Trim(), split[1].Trim())) @@ -38,22 +53,37 @@ public record PipShowResult return new PipShowResult { - Name = lines["Name"], - Version = lines["Version"], - Summary = lines.GetValueOrDefault("Summary"), - HomePage = lines.GetValueOrDefault("Home-page"), - Author = lines.GetValueOrDefault("Author"), - AuthorEmail = lines.GetValueOrDefault("Author-email"), - License = lines.GetValueOrDefault("License"), - Location = lines.GetValueOrDefault("Location"), - Requires = lines + Name = linesDict["Name"], + Version = linesDict["Version"], + Summary = linesDict.GetValueOrDefault("Summary"), + HomePage = linesDict.GetValueOrDefault("Home-page"), + Author = linesDict.GetValueOrDefault("Author"), + AuthorEmail = linesDict.GetValueOrDefault("Author-email"), + License = licenseText, + Location = linesDict.GetValueOrDefault("Location"), + Requires = linesDict .GetValueOrDefault("Requires") ?.Split(',', StringSplitOptions.TrimEntries) .ToList(), - RequiredBy = lines + RequiredBy = linesDict .GetValueOrDefault("Required-by") ?.Split(',', StringSplitOptions.TrimEntries) .ToList() }; } + + private static int GetIndexBySubstring(List lines, string searchString) + { + var index = -1; + for (var i = 0; i < lines.Count; i++) + { + if (!lines[i].StartsWith(searchString, StringComparison.OrdinalIgnoreCase)) + continue; + + index = i; + break; + } + + return index; + } } From 72a3b9163b12614be8e84c5604fbb5d9a5a33008 Mon Sep 17 00:00:00 2001 From: JT Date: Thu, 9 May 2024 20:00:25 -0700 Subject: [PATCH 4/4] Update OpenArtBrowserPage HorizontalAlignment -> HorizontalContentAlignment --- StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml b/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml index 1989f622..35582b93 100644 --- a/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml +++ b/StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml @@ -305,7 +305,7 @@