diff --git a/Avalonia.Gif/Avalonia.Gif.csproj b/Avalonia.Gif/Avalonia.Gif.csproj index dbf0defd..48a8f949 100644 --- a/Avalonia.Gif/Avalonia.Gif.csproj +++ b/Avalonia.Gif/Avalonia.Gif.csproj @@ -10,7 +10,7 @@ true - + diff --git a/CHANGELOG.md b/CHANGELOG.md index a14178d4..d4b8b291 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ 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.2 +### Changed +- Updated translations for Spanish and Turkish +### Fixed +- Fixed more crashes when loading invalid connected model info files +- Fixed pip installs not parsing comments properly +- Fixed crash when sending input to a process that isn't running +- Fixed breadcrumb on console page showing incorrect running package name +- Fixed [#576](https://github.com/LykosAI/StabilityMatrix/issues/576) - drag & drop crashes on macOS & Linux +- Fixed [#594](https://github.com/LykosAI/StabilityMatrix/issues/594) - missing thumbnails in Inference model selector +- Fixed [#600](https://github.com/LykosAI/StabilityMatrix/issues/600) - kohya_ss v24+ not launching +- Downgraded Avalonia back to 11.0.9 to fix [#589](https://github.com/LykosAI/StabilityMatrix/issues/589) and possibly other rendering issues + ## v2.10.1 ### Added - Added SVD Shared Model & Output Folders for Forge (fixes [#580](https://github.com/LykosAI/StabilityMatrix/issues/580)) diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..e059bd8f --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + 11.0.9 + + diff --git a/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj b/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj index 2fbf2fd4..7d0762ac 100644 --- a/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj +++ b/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs b/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs index ef6a47f0..25993dd6 100644 --- a/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs +++ b/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs @@ -1,4 +1,5 @@ -using Avalonia.Input; +using System.Runtime.InteropServices; +using Avalonia.Input; namespace StabilityMatrix.Avalonia.Extensions; @@ -9,9 +10,16 @@ public static class DataObjectExtensions /// public static T? GetContext(this IDataObject dataObject) { - if (dataObject.Get("Context") is T context) + try { - return context; + if (dataObject.Get("Context") is T context) + { + return context; + } + } + catch (COMException) + { + return default; } return default; diff --git a/StabilityMatrix.Avalonia/Languages/Resources.es.resx b/StabilityMatrix.Avalonia/Languages/Resources.es.resx index 28b0dae1..0bc23e71 100644 --- a/StabilityMatrix.Avalonia/Languages/Resources.es.resx +++ b/StabilityMatrix.Avalonia/Languages/Resources.es.resx @@ -1025,4 +1025,58 @@ Navegador de Modelos + + Workflows + + + Scroll Infinito + + + Navegador de Workflows + + + Abrir en OpenArt + + + Detalles del Nodo + + + Descripción del Workflow + + + Navegador OpenArt + + + Vista previa del Preprocesador + + + El botón 'Abrir interfaz de usuario web' se ha movido a la barra de comandos + + + Ya se está ejecutando otra instancia de Stability Matrix. Ciérrelo antes de comenzar uno nuevo. + + + Stability Matrix ya se está ejecutando + + + {0} eliminados correctamente + + + Workflow Eliminado + + + Error al recuperar workflows + + + Workflows Instalados + + + Workflow Importado + + + Terminada la importación del workflow y los nodos personalizados + + + Se han importado el workflow y los nodos personalizados. + \ No newline at end of file diff --git a/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx b/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx index 5b6064d2..e9329a1a 100644 --- a/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx +++ b/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx @@ -1021,4 +1021,58 @@ Model Tarayıcı + + İş akışları + + + Sonsuz Kaydırma + + + İş Akışı Tarayıcısı + + + OpenArt'ta aç + + + Düğüm Ayrıntıları + + + İş Akışı Açıklaması + + + OpenArt Tarayıcı + + + Ön İşlemciyi Önizle + + + 'Web Kullanıcı Arayüzünü Aç' düğmesi komut çubuğuna taşındı + + + Stability Matrixin başka bir örneği zaten çalışıyor. Yenisini başlatmadan önce lütfen kapatın. + + + Stability Matrix zaten çalışıyor + + + {0} başarıyla silindi + + + İş Akışı Silindi + + + İş akışları alınırken hata oluştu + + + Yüklü İş Akışları + + + İş Akışı İçeri Aktarıldı + + + İş akışının ve özel düğümlerin içe aktarılması tamamlandı + + + İş akışı ve özel düğümler içe aktarıldı. + \ No newline at end of file diff --git a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj index b3fba009..096e08c9 100644 --- a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj +++ b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj @@ -39,17 +39,17 @@ - - - - - - + + + + + + - + - - + + @@ -58,10 +58,10 @@ - - - - + + + + @@ -78,25 +78,25 @@ - + - + - + - - + + - + diff --git a/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml b/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml index c1274ef4..c5105328 100644 --- a/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml +++ b/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml @@ -8,7 +8,8 @@ xmlns:sg="clr-namespace:SpacedGridControl.Avalonia;assembly=SpacedGridControl.Avalonia" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:labs="clr-namespace:Avalonia.Labs.Controls;assembly=Avalonia.Labs.Controls" - xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs"> + xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs" + xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"> @@ -29,7 +30,9 @@ - + + + @@ -220,7 +223,7 @@ Height="36" CornerRadius="60" RenderOptions.BitmapInterpolationMode="HighQuality" - Source="{Binding Local.PreviewImageFullPathGlobal}" + Source="{Binding Local.PreviewImageFullPathGlobal, Converter={StaticResource FileUriConverter}}" Stretch="UniformToFill"> diff --git a/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs b/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs index 57e6bf47..30fd84ff 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs @@ -18,6 +18,7 @@ using FluentAvalonia.UI.Media.Animation; using Microsoft.Extensions.DependencyInjection; using NLog; using StabilityMatrix.Avalonia.Animations; +using StabilityMatrix.Avalonia.Extensions; using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models.Inference; using StabilityMatrix.Avalonia.Services; @@ -249,7 +250,7 @@ public abstract partial class InferenceTabViewModelBase // 1. Context drop for LocalImageFile if (e.Data.GetDataFormats().Contains("Context")) { - if (e.Data.Get("Context") is LocalImageFile imageFile) + if (e.Data.GetContext() is { } imageFile) { e.Handled = true; return; @@ -274,7 +275,7 @@ public abstract partial class InferenceTabViewModelBase // 1. Context drop for LocalImageFile if (e.Data.GetDataFormats().Contains("Context")) { - if (e.Data.Get("Context") is LocalImageFile imageFile) + if (e.Data.GetContext() is { } imageFile) { e.Handled = true; diff --git a/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs b/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs index 5f23e3fc..51ad4025 100644 --- a/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs +++ b/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs @@ -15,6 +15,7 @@ using CommunityToolkit.Mvvm.Input; using DynamicData; using DynamicData.Binding; using FluentAvalonia.UI.Controls; +using StabilityMatrix.Avalonia.Extensions; using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.ViewModels.Base; using StabilityMatrix.Core.Attributes; @@ -279,7 +280,7 @@ public partial class CheckpointFolder : ViewModelBase var paths = files.Select(f => f.Path.LocalPath).ToArray(); await ImportFilesAsync(paths, settingsManager.Settings.IsImportAsConnected); } - else if (e.Data.Get("Context") is CheckpointFile file) + else if (e.Data.GetContext() is { } file) { await MoveBetweenFolders(file); } diff --git a/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs index 73f89a8b..f622cc67 100644 --- a/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs @@ -26,7 +26,7 @@ public partial class RunningPackageViewModel : PageViewModelBase, IDisposable, I public PackagePair RunningPackage { get; } public ConsoleViewModel Console { get; } - public override string Title => RunningPackage.InstalledPackage.PackageName ?? "Running Package"; + public override string Title => RunningPackage.InstalledPackage.DisplayName ?? "Running Package"; public override IconSource IconSource => new SymbolIconSource(); [ObservableProperty] diff --git a/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs b/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs index e95b45f4..dda5cd9c 100644 --- a/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs +++ b/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs @@ -6,6 +6,7 @@ using Avalonia.Markup.Xaml; using Avalonia.VisualTree; using DynamicData.Binding; using StabilityMatrix.Avalonia.Controls; +using StabilityMatrix.Avalonia.Extensions; using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels.CheckpointManager; using StabilityMatrix.Core.Attributes; @@ -68,7 +69,7 @@ public partial class CheckpointsPage : UserControlBase { case CheckpointFolder folder: { - if (e.Data.Get("Context") is not CheckpointFile file) + if (e.Data.GetContext() is not { } file) { await folder.OnDrop(e); break; @@ -83,7 +84,7 @@ public partial class CheckpointsPage : UserControlBase } case CheckpointFile file: { - if (e.Data.Get("Context") is not CheckpointFile dragFile) + if (e.Data.GetContext() is not { } dragFile) { await file.ParentFolder.OnDrop(e); break; @@ -132,7 +133,7 @@ public partial class CheckpointsPage : UserControlBase case CheckpointFolder folder: { folder.IsExpanded = true; - if (e.Data.Get("Context") is not CheckpointFile file) + if (e.Data.GetContext() is not { } file) { folder.IsCurrentDragTarget = true; break; @@ -144,7 +145,7 @@ public partial class CheckpointsPage : UserControlBase } case CheckpointFile file: { - if (e.Data.Get("Context") is not CheckpointFile dragFile) + if (e.Data.GetContext() is not { } dragFile) { file.ParentFolder.IsCurrentDragTarget = true; break; diff --git a/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml b/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml index d44b44e6..7fa19f89 100644 --- a/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml +++ b/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml @@ -89,6 +89,7 @@ Classes="accent" IsDefault="True" Content="{x:Static lang:Resources.Action_Send}" + IsEnabled="{Binding IsRunning}" Command="{Binding SendToConsoleCommand}"/> diff --git a/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs b/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs index 4d5ce09a..8d2c1ca7 100644 --- a/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs +++ b/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs @@ -7,9 +7,8 @@ public record GetUserResponse public required HashSet UserRoles { get; init; } public string? PatreonId { get; init; } public bool IsEmailVerified { get; init; } + public bool CanHasDevBuild { get; init; } + public bool CanHasPreviewBuild { get; init; } - public bool IsActiveSupporter => - UserRoles.Contains(LykosRole.PatreonSupporter) - || UserRoles.Contains(LykosRole.Insider) - || (UserRoles.Contains(LykosRole.Developer) && PatreonId is not null); + public bool IsActiveSupporter => CanHasDevBuild || CanHasPreviewBuild; } diff --git a/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs b/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs index d3bdca64..556852e7 100644 --- a/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs +++ b/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs @@ -7,6 +7,16 @@ public enum LykosRole Supporter = 1, PatreonSupporter = 2, Insider = 3, - BetaTester = 4, - Developer = 5 + + // 4 and 5 have been retired 🫡 + [Obsolete("Roles restructured, use the new BetaTester role")] + OLD_BetaTester = 4, + + [Obsolete("Roles restructured, use the new Developer role")] + OLD_Developer = 5, + Pioneer = 6, + Visionary = 7, + BetaTester = 100, + Translator = 101, + Developer = 900, } diff --git a/StabilityMatrix.Core/Models/Packages/KohyaSs.cs b/StabilityMatrix.Core/Models/Packages/KohyaSs.cs index 701da699..249e47dc 100644 --- a/StabilityMatrix.Core/Models/Packages/KohyaSs.cs +++ b/StabilityMatrix.Core/Models/Packages/KohyaSs.cs @@ -159,90 +159,7 @@ public class KohyaSs( Action? onConsoleOutput ) { - await SetupVenv(installedPackagePath).ConfigureAwait(false); - - // update gui files to point to venv accelerate - await runner.RunInThreadWithLock(() => - { - var scope = Py.CreateScope(); - scope.Exec( - """ - import ast - - class StringReplacer(ast.NodeTransformer): - def __init__(self, old: str, new: str, replace_count: int = -1): - self.old = old - self.new = new - self.replace_count = replace_count - - def visit_Constant(self, node: ast.Constant) -> ast.Constant: - if isinstance(node.value, str) and self.old in node.value: - new_value = node.value.replace(self.old, self.new, self.replace_count) - node.value = new_value - return node - - def rewrite_module(self, module_text: str) -> str: - tree = ast.parse(module_text) - tree = self.visit(tree) - return ast.unparse(tree) - """ - ); - - var replacementAcceleratePath = Compat.IsWindows - ? @".\venv\scripts\accelerate" - : "./venv/bin/accelerate"; - - var replacer = scope.InvokeMethod( - "StringReplacer", - "accelerate".ToPython(), - $"{replacementAcceleratePath}".ToPython(), - 1.ToPython() - ); - - var kohyaGuiDir = Path.Combine(installedPackagePath, "kohya_gui"); - var guiDirExists = Directory.Exists(kohyaGuiDir); - var filesToUpdate = new List(); - - if (guiDirExists) - { - filesToUpdate.AddRange( - [ - "lora_gui.py", - "dreambooth_gui.py", - "textual_inversion_gui.py", - "wd14_caption_gui.py", - "finetune_gui.py" - ] - ); - } - else - { - filesToUpdate.AddRange( - [ - "lora_gui.py", - "dreambooth_gui.py", - "textual_inversion_gui.py", - Path.Combine("library", "wd14_caption_gui.py"), - "finetune_gui.py" - ] - ); - } - - foreach (var file in filesToUpdate) - { - var path = Path.Combine(guiDirExists ? kohyaGuiDir : installedPackagePath, file); - if (!File.Exists(path)) - continue; - - var text = File.ReadAllText(path); - if (text.Contains(replacementAcceleratePath.Replace(@"\", @"\\"))) - continue; - - var result = replacer.InvokeMethod("rewrite_module", text.ToPython()); - var resultStr = result.ToString(); - File.WriteAllText(path, resultStr); - } - }); + var venvRunner = await SetupVenvPure(installedPackagePath).ConfigureAwait(false); void HandleConsoleOutput(ProcessOutput s) { @@ -262,7 +179,7 @@ public class KohyaSs( var args = $"\"{Path.Combine(installedPackagePath, command)}\" {arguments}"; - VenvRunner.RunDetached(args.TrimEnd(), HandleConsoleOutput, OnExit); + venvRunner.RunDetached(args.TrimEnd(), HandleConsoleOutput, OnExit); } public override Dictionary>? SharedFolders { get; } diff --git a/StabilityMatrix.Core/Models/Packages/SDWebForge.cs b/StabilityMatrix.Core/Models/Packages/SDWebForge.cs index e3be760f..43fa5e22 100644 --- a/StabilityMatrix.Core/Models/Packages/SDWebForge.cs +++ b/StabilityMatrix.Core/Models/Packages/SDWebForge.cs @@ -139,6 +139,13 @@ public class SDWebForge( progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true)); var requirements = new FilePath(installLocation, "requirements_versions.txt"); + var requirementsContent = await requirements.ReadAllTextAsync().ConfigureAwait(false); + if (!requirementsContent.Contains("pydantic")) + { + requirementsContent += "pydantic==1.10.15"; + await requirements.WriteAllTextAsync(requirementsContent).ConfigureAwait(false); + } + var pipArgs = new PipInstallArgs(); if (torchVersion is TorchVersion.DirectMl) { @@ -161,10 +168,7 @@ public class SDWebForge( ); } - pipArgs = pipArgs.WithParsedFromRequirementsTxt( - await requirements.ReadAllTextAsync().ConfigureAwait(false), - excludePattern: "torch" - ); + pipArgs = pipArgs.WithParsedFromRequirementsTxt(requirementsContent, excludePattern: "torch"); await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false); progress?.Report(new ProgressReport(1f, "Install complete", isIndeterminate: false)); diff --git a/StabilityMatrix.Core/Python/PipInstallArgs.cs b/StabilityMatrix.Core/Python/PipInstallArgs.cs index 68e371f7..558a7db8 100644 --- a/StabilityMatrix.Core/Python/PipInstallArgs.cs +++ b/StabilityMatrix.Core/Python/PipInstallArgs.cs @@ -30,7 +30,9 @@ public record PipInstallArgs : ProcessArgsBuilder { var requirementsEntries = requirements .SplitLines(StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) - .AsEnumerable(); + .Where(s => !s.StartsWith('#')) + .Select(s => s.Contains('#') ? s.Substring(0, s.IndexOf('#')) : s) + .Where(s => !string.IsNullOrWhiteSpace(s)); if (excludePattern is not null) { diff --git a/StabilityMatrix.Core/Python/PyVenvRunner.cs b/StabilityMatrix.Core/Python/PyVenvRunner.cs index 5dfc3a03..3a87341b 100644 --- a/StabilityMatrix.Core/Python/PyVenvRunner.cs +++ b/StabilityMatrix.Core/Python/PyVenvRunner.cs @@ -545,7 +545,8 @@ public class PyVenvRunner : IDisposable, IAsyncDisposable if (Compat.IsWindows) { var portableGitBin = GlobalConfig.LibraryDir.JoinDir("PortableGit", "bin"); - env["PATH"] = Compat.GetEnvPathWithExtensions(portableGitBin); + var venvBin = RootPath.JoinDir(RelativeBinPath); + env["PATH"] = Compat.GetEnvPathWithExtensions(portableGitBin, venvBin); env["GIT"] = portableGitBin.JoinFile("git.exe"); } diff --git a/StabilityMatrix.Core/Services/MetadataImportService.cs b/StabilityMatrix.Core/Services/MetadataImportService.cs index 21ce5a2c..3830fa70 100644 --- a/StabilityMatrix.Core/Services/MetadataImportService.cs +++ b/StabilityMatrix.Core/Services/MetadataImportService.cs @@ -155,9 +155,17 @@ public class MetadataImportService( var cmInfoList = new Dictionary(); foreach (var cmInfoPath in directory.EnumerateFiles("*.cm-info.json", SearchOption.AllDirectories)) { - var cmInfo = JsonSerializer.Deserialize( - await cmInfoPath.ReadAllTextAsync().ConfigureAwait(false) - ); + ConnectedModelInfo? cmInfo; + try + { + cmInfo = JsonSerializer.Deserialize( + await cmInfoPath.ReadAllTextAsync().ConfigureAwait(false) + ); + } + catch (JsonException) + { + cmInfo = null; + } if (cmInfo == null) continue; diff --git a/StabilityMatrix.Core/StabilityMatrix.Core.csproj b/StabilityMatrix.Core/StabilityMatrix.Core.csproj index 5005b1bd..76fa5624 100644 --- a/StabilityMatrix.Core/StabilityMatrix.Core.csproj +++ b/StabilityMatrix.Core/StabilityMatrix.Core.csproj @@ -27,7 +27,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -53,7 +53,7 @@ - + diff --git a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj index eb592e08..2ebeb2e8 100644 --- a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj +++ b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj @@ -15,7 +15,7 @@ - +