Browse Source

Merge pull request #605 from LykosAI/main

v2.10.2
dependabot/nuget/Octokit-11.0.1
JT 7 months ago committed by GitHub
parent
commit
d544351dd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      Avalonia.Gif/Avalonia.Gif.csproj
  2. 13
      CHANGELOG.md
  3. 5
      Directory.Build.props
  4. 4
      StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj
  5. 14
      StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs
  6. 54
      StabilityMatrix.Avalonia/Languages/Resources.es.resx
  7. 54
      StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx
  8. 38
      StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj
  9. 13
      StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml
  10. 5
      StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs
  11. 3
      StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs
  12. 2
      StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs
  13. 9
      StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs
  14. 1
      StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml
  15. 7
      StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs
  16. 14
      StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs
  17. 87
      StabilityMatrix.Core/Models/Packages/KohyaSs.cs
  18. 12
      StabilityMatrix.Core/Models/Packages/SDWebForge.cs
  19. 4
      StabilityMatrix.Core/Python/PipInstallArgs.cs
  20. 3
      StabilityMatrix.Core/Python/PyVenvRunner.cs
  21. 14
      StabilityMatrix.Core/Services/MetadataImportService.cs
  22. 6
      StabilityMatrix.Core/StabilityMatrix.Core.csproj
  23. 2
      StabilityMatrix.UITests/StabilityMatrix.UITests.csproj

2
Avalonia.Gif/Avalonia.Gif.csproj

@ -10,7 +10,7 @@
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.10" />
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="SkiaSharp" Version="2.88.7" />
<PackageReference Include="DotNet.Bundle" Version="0.9.13" />
</ItemGroup>

13
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))

5
Directory.Build.props

@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.0.9</AvaloniaVersion>
</PropertyGroup>
</Project>

4
StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj

@ -19,8 +19,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.10" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.10" />
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
<PackageReference Include="DotNet.Bundle" Version="0.9.13" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />

14
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
/// </summary>
public static T? GetContext<T>(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;

54
StabilityMatrix.Avalonia/Languages/Resources.es.resx

@ -1025,4 +1025,58 @@
<data name="Label_ModelBrowser" xml:space="preserve">
<value>Navegador de Modelos</value>
</data>
<data name="Label_Workflows" xml:space="preserve">
<value>Workflows</value>
</data>
<data name="Label_InfiniteScrolling" xml:space="preserve">
<value>Scroll Infinito</value>
</data>
<data name="Label_WorkflowBrowser" xml:space="preserve">
<value>Navegador de Workflows</value>
</data>
<data name="Action_OpenOnOpenArt" xml:space="preserve">
<value>Abrir en OpenArt</value>
</data>
<data name="Label_NodeDetails" xml:space="preserve">
<value>Detalles del Nodo</value>
</data>
<data name="Label_WorkflowDescription" xml:space="preserve">
<value>Descripción del Workflow</value>
</data>
<data name="Label_OpenArtBrowser" xml:space="preserve">
<value>Navegador OpenArt</value>
</data>
<data name="Action_PreviewPreprocessor" xml:space="preserve">
<value>Vista previa del Preprocesador</value>
</data>
<data name="TeachingTip_WebUiButtonMoved" xml:space="preserve">
<value>El botón &apos;Abrir interfaz de usuario web&apos; se ha movido a la barra de comandos</value>
</data>
<data name="Label_AnotherInstanceAlreadyRunning" xml:space="preserve">
<value>Ya se está ejecutando otra instancia de Stability Matrix. Ciérrelo antes de comenzar uno nuevo.</value>
</data>
<data name="Label_StabilityMatrixAlreadyRunning" xml:space="preserve">
<value>Stability Matrix ya se está ejecutando</value>
</data>
<data name="Label_WorkflowDeletedSuccessfully" xml:space="preserve">
<value>{0} eliminados correctamente</value>
</data>
<data name="Label_WorkflowDeleted" xml:space="preserve">
<value>Workflow Eliminado</value>
</data>
<data name="Label_ErrorRetrievingWorkflows" xml:space="preserve">
<value>Error al recuperar workflows</value>
</data>
<data name="TabLabel_InstalledWorkflows" xml:space="preserve">
<value>Workflows Instalados</value>
</data>
<data name="Label_WorkflowImported" xml:space="preserve">
<value>Workflow Importado</value>
</data>
<data name="Label_FinishedImportingWorkflow" xml:space="preserve">
<value>Terminada la importación del workflow y los nodos personalizados</value>
</data>
<data name="Label_WorkflowImportComplete" xml:space="preserve">
<value>Se han importado el workflow y los nodos personalizados.</value>
</data>
</root>

54
StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx

@ -1021,4 +1021,58 @@
<data name="Label_ModelBrowser" xml:space="preserve">
<value>Model Tarayıcı</value>
</data>
<data name="Label_Workflows" xml:space="preserve">
<value>İş akışları</value>
</data>
<data name="Label_InfiniteScrolling" xml:space="preserve">
<value>Sonsuz Kaydırma</value>
</data>
<data name="Label_WorkflowBrowser" xml:space="preserve">
<value>İş Akışı Tarayıcısı</value>
</data>
<data name="Action_OpenOnOpenArt" xml:space="preserve">
<value>OpenArt&apos;ta aç</value>
</data>
<data name="Label_NodeDetails" xml:space="preserve">
<value>Düğüm Ayrıntıları</value>
</data>
<data name="Label_WorkflowDescription" xml:space="preserve">
<value>İş Akışı Açıklaması</value>
</data>
<data name="Label_OpenArtBrowser" xml:space="preserve">
<value>OpenArt Tarayıcı</value>
</data>
<data name="Action_PreviewPreprocessor" xml:space="preserve">
<value>Ön İşlemciyi Önizle</value>
</data>
<data name="TeachingTip_WebUiButtonMoved" xml:space="preserve">
<value>&apos;Web Kullanıcı Arayüzünü Aç&apos; düğmesi komut çubuğuna taşındı</value>
</data>
<data name="Label_AnotherInstanceAlreadyRunning" xml:space="preserve">
<value>Stability Matrixin başka bir örneği zaten çalışıyor. Yenisini başlatmadan önce lütfen kapatın.</value>
</data>
<data name="Label_StabilityMatrixAlreadyRunning" xml:space="preserve">
<value>Stability Matrix zaten çalışıyor</value>
</data>
<data name="Label_WorkflowDeletedSuccessfully" xml:space="preserve">
<value>{0} başarıyla silindi</value>
</data>
<data name="Label_WorkflowDeleted" xml:space="preserve">
<value>İş Akışı Silindi</value>
</data>
<data name="Label_ErrorRetrievingWorkflows" xml:space="preserve">
<value>İş akışları alınırken hata oluştu</value>
</data>
<data name="TabLabel_InstalledWorkflows" xml:space="preserve">
<value>Yüklü İş Akışları</value>
</data>
<data name="Label_WorkflowImported" xml:space="preserve">
<value>İş Akışı İçeri Aktarıldı</value>
</data>
<data name="Label_FinishedImportingWorkflow" xml:space="preserve">
<value>İş akışının ve özel düğümlerin içe aktarılması tamamlandı</value>
</data>
<data name="Label_WorkflowImportComplete" xml:space="preserve">
<value>İş akışı ve özel düğümler içe aktarıldı.</value>
</data>
</root>

38
StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj

@ -39,17 +39,17 @@
<PackageReference Include="AsyncImageLoader.Avalonia" Version="3.2.1" />
<PackageReference Include="AutoComplete.Net" Version="1.2211.2014.42"/>
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.6" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.10" />
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="11.0.10" />
<PackageReference Include="Avalonia.Controls.PanAndZoom" Version="11.0.0.3" />
<PackageReference Include="Avalonia" Version="11.0.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.10" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.10" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Controls.PanAndZoom" Version="11.0.0.2" />
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.HtmlRenderer" Version="11.0.0" />
<PackageReference Include="Avalonia.Labs.Controls" Version="11.0.10.1" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.10.1" />
<PackageReference Include="Avalonia.Labs.Controls" Version="11.0.3" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.6" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.0.6" />
<PackageReference Include="bodong.Avalonia.PropertyGrid" Version="11.0.6.3" />
<PackageReference Include="bodong.PropertyModels" Version="11.0.6.2" />
@ -58,10 +58,10 @@
<PackageReference Include="DesktopNotifications" Version="1.3.1" />
<PackageReference Include="DesktopNotifications.Avalonia" Version="1.3.1" />
<PackageReference Include="DiscordRichPresence" Version="1.2.1.24" />
<PackageReference Include="Dock.Avalonia" Version="11.0.0.7" />
<PackageReference Include="Dock.Model.Avalonia" Version="11.0.0.7" />
<PackageReference Include="Dock.Serializer" Version="11.0.0.7" />
<PackageReference Include="DynamicData" Version="8.4.1" />
<PackageReference Include="Dock.Avalonia" Version="11.0.0.5" />
<PackageReference Include="Dock.Model.Avalonia" Version="11.0.0.5" />
<PackageReference Include="Dock.Serializer" Version="11.0.0.5" />
<PackageReference Include="DynamicData" Version="8.3.27" />
<PackageReference Include="DotNet.Bundle" Version="0.9.13" />
<PackageReference Include="Exceptionless.DateTimeExtensions" Version="3.4.3" />
<PackageReference Include="FluentAvalonia.BreadcrumbBar" Version="2.0.2" />
@ -78,25 +78,25 @@
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.3" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="OneOf" Version="3.0.263" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="Polly" Version="8.3.0" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageReference Include="Projektanker.Icons.Avalonia.FontAwesome" Version="9.1.2" />
<PackageReference Include="Projektanker.Icons.Avalonia.FontAwesome" Version="9.1.1" />
<PackageReference Include="RockLib.Reflection.Optimized" Version="3.0.0" />
<PackageReference Include="Sentry" Version="4.2.1" />
<PackageReference Include="Sentry.NLog" Version="4.2.1" />
<PackageReference Include="Sentry" Version="4.1.2" />
<PackageReference Include="Sentry.NLog" Version="4.1.2" />
<PackageReference Include="SpacedGrid-Avalonia" Version="11.0.0" />
<PackageReference Include="Sylvan.Common" Version="0.4.3" />
<PackageReference Include="Sylvan.Data" Version="0.2.13" />
<PackageReference Include="Sylvan.Data.Csv" Version="1.3.7" />
<PackageReference Include="System.Drawing.Common" Version="8.0.3" />
<PackageReference Include="System.Drawing.Common" Version="8.0.2" />
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.56" />
<PackageReference Include="URISchemeTools" Version="1.0.2" />

13
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">
<Design.PreviewWith>
<Panel Width="450" Height="600">
@ -29,7 +30,9 @@
</StackPanel>
</Panel>
</Design.PreviewWith>
<converters:FileUriConverter x:Key="FileUriConverter" />
<!-- ReSharper disable once Xaml.StaticResourceNotResolved -->
<ControlTheme
x:Key="BetterComboBoxItemHybridModelTheme"
@ -50,7 +53,7 @@
CornerRadius="6"
IsVisible="{Binding Local.PreviewImageFullPathGlobal, Converter={x:Static StringConverters.IsNotNullOrEmpty}, FallbackValue=''}"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="{Binding Local.PreviewImageFullPathGlobal, FallbackValue=''}"
Source="{Binding Local.PreviewImageFullPathGlobal, FallbackValue='', Converter={StaticResource FileUriConverter}}"
Stretch="UniformToFill"/>
<StackPanel
Grid.Column="1"
@ -132,7 +135,7 @@
Height="42"
RenderOptions.BitmapInterpolationMode="HighQuality"
CornerRadius="40"
Source="{Binding Local.PreviewImageFullPathGlobal}"
Source="{Binding Local.PreviewImageFullPathGlobal, Converter={StaticResource FileUriConverter}}"
Stretch="UniformToFill"/>
<!-- Text -->
@ -220,7 +223,7 @@
Height="36"
CornerRadius="60"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="{Binding Local.PreviewImageFullPathGlobal}"
Source="{Binding Local.PreviewImageFullPathGlobal, Converter={StaticResource FileUriConverter}}"
Stretch="UniformToFill">
</vendorLabs:BetterAsyncImage>

5
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<LocalImageFile>() 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<LocalImageFile>() is { } imageFile)
{
e.Handled = true;

3
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<CheckpointFile>() is { } file)
{
await MoveBetweenFolders(file);
}

2
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]

9
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<CheckpointFile>() 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<CheckpointFile>() 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<CheckpointFile>() 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<CheckpointFile>() is not { } dragFile)
{
file.ParentFolder.IsCurrentDragTarget = true;
break;

1
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}"/>
</Grid>

7
StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs

@ -7,9 +7,8 @@ public record GetUserResponse
public required HashSet<LykosRole> 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;
}

14
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,
}

87
StabilityMatrix.Core/Models/Packages/KohyaSs.cs

@ -159,90 +159,7 @@ public class KohyaSs(
Action<ProcessOutput>? 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<string>();
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<SharedFolderType, IReadOnlyList<string>>? SharedFolders { get; }

12
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));

4
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)
{

3
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");
}

14
StabilityMatrix.Core/Services/MetadataImportService.cs

@ -155,9 +155,17 @@ public class MetadataImportService(
var cmInfoList = new Dictionary<FilePath, ConnectedModelInfo>();
foreach (var cmInfoPath in directory.EnumerateFiles("*.cm-info.json", SearchOption.AllDirectories))
{
var cmInfo = JsonSerializer.Deserialize<ConnectedModelInfo>(
await cmInfoPath.ReadAllTextAsync().ConfigureAwait(false)
);
ConnectedModelInfo? cmInfo;
try
{
cmInfo = JsonSerializer.Deserialize<ConnectedModelInfo>(
await cmInfoPath.ReadAllTextAsync().ConfigureAwait(false)
);
}
catch (JsonException)
{
cmInfo = null;
}
if (cmInfo == null)
continue;

6
StabilityMatrix.Core/StabilityMatrix.Core.csproj

@ -27,7 +27,7 @@
<PackageReference Include="DeviceId.Windows" Version="6.6.0" />
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.6.0" />
<PackageReference Include="DotNet.Bundle" Version="0.9.13" />
<PackageReference Include="DynamicData" Version="8.4.1" />
<PackageReference Include="DynamicData" Version="8.3.27" />
<PackageReference Include="ExifLibNet" Version="2.1.4" />
<PackageReference Include="FreneticLLC.FreneticUtilities" Version="1.0.24" />
<PackageReference Include="Hardware.Info" Version="100.1.0" />
@ -45,7 +45,7 @@
<PackageReference Include="Octokit" Version="10.0.0" />
<PackageReference Include="OneOf" Version="3.0.263" />
<PackageReference Include="OneOf.SourceGenerator" Version="3.0.263" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="Polly" Version="8.3.0" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageReference Include="pythonnet" Version="3.0.3" />
<PackageReference Include="Refit" Version="7.0.0" />
@ -53,7 +53,7 @@
<PackageReference Include="RockLib.Reflection.Optimized" Version="3.0.0" />
<PackageReference Include="Salaros.ConfigParser" Version="0.3.8" />
<PackageReference Include="Semver" Version="3.0.0-beta.1" />
<PackageReference Include="Sentry.NLog" Version="4.2.1" />
<PackageReference Include="Sentry.NLog" Version="4.1.2" />
<PackageReference Include="SharpCompress" Version="0.36.0" />
<PackageReference Include="SkiaSharp" Version="2.88.7" />
<PackageReference Include="Websocket.Client" Version="5.1.1" />

2
StabilityMatrix.UITests/StabilityMatrix.UITests.csproj

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Headless.XUnit" Version="11.0.10" />
<PackageReference Include="Avalonia.Headless.XUnit" Version="$(AvaloniaVersion)" />
<PackageReference Include="DotNet.Bundle" Version="0.9.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />

Loading…
Cancel
Save