Browse Source

Merge branch 'dev' into downmerge

pull/629/head
JT 7 months ago committed by GitHub
parent
commit
921a54012e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 5
      StabilityMatrix.Avalonia/Controls/Inference/ImageFolderCard.axaml
  3. 11
      StabilityMatrix.Avalonia/ViewModels/Dialogs/LykosLoginViewModel.cs
  4. 5
      StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml
  5. 1
      StabilityMatrix.Avalonia/Views/Dialogs/LykosLoginDialog.axaml
  6. 8
      StabilityMatrix.Avalonia/Views/OutputsPage.axaml
  7. 20
      StabilityMatrix.Core/Api/TokenAuthHeaderHandler.cs
  8. 2
      StabilityMatrix.Core/Models/Packages/A3WebUI.cs
  9. 4
      StabilityMatrix.Core/Models/Packages/ComfyUI.cs
  10. 1
      StabilityMatrix.Core/Models/Packages/Fooocus.cs
  11. 1
      StabilityMatrix.Core/Models/Packages/FooocusMre.cs
  12. 3
      StabilityMatrix.Core/Models/Packages/KohyaSs.cs
  13. 2
      StabilityMatrix.Core/Models/Packages/OneTrainer.cs
  14. 1
      StabilityMatrix.Core/Models/Packages/RuinedFooocus.cs
  15. 2
      StabilityMatrix.Core/Models/Packages/SDWebForge.cs
  16. 2
      StabilityMatrix.Core/Models/Packages/StableDiffusionDirectMl.cs
  17. 2
      StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs
  18. 8
      StabilityMatrix.Core/Models/Packages/VoltaML.cs
  19. 20
      StabilityMatrix.Core/Models/Settings/Settings.cs

6
CHANGELOG.md

@ -6,9 +6,15 @@ 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.1
### Changed
- Improved error message when logging in with a Lykos account fails due to incorrect email or password.
### Fixed
- Fixed package launch not working when environment variable `SETUPTOOLS_USE_DISTUTILS` is set due to conflict with a default environment variable. User environment variables will now correctly override any default environment variables.
- Fixed "No refresh token found" error when failing to login with Lykos account in some cases.
- Fixed [#584](https://github.com/LykosAI/StabilityMatrix/issues/584) - `--launch-package` argument not working
- Fixed [#581](https://github.com/LykosAI/StabilityMatrix/issues/581) - Inference teaching tip showing more often than it should
- Fixed [#574](https://github.com/LykosAI/StabilityMatrix/issues/574) - local images not showing on macOS or Linux
- Fixed [#578](https://github.com/LykosAI/StabilityMatrix/issues/578) - "python setup.py egg_info did not run successfully" failure when installing Auto1111 or SDWebUI Forge
## v2.10.0
### Added

5
StabilityMatrix.Avalonia/Controls/Inference/ImageFolderCard.axaml

@ -11,6 +11,7 @@
xmlns:scroll="clr-namespace:StabilityMatrix.Avalonia.Controls.Scroll"
xmlns:labs="clr-namespace:Avalonia.Labs.Controls;assembly=Avalonia.Labs.Controls"
xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs"
xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"
x:DataType="vmInference:ImageFolderCardViewModel">
<Design.PreviewWith>
@ -21,6 +22,8 @@
</Panel>
</Design.PreviewWith>
<converters:FileUriConverter x:Key="FileUriConverter" />
<ControlTheme x:Key="{x:Type controls:ImageFolderCard}" TargetType="controls:ImageFolderCard">
<Setter Property="Background" Value="Transparent" />
<!-- Set Defaults -->
@ -200,7 +203,7 @@
<vendorLabs:BetterAsyncImage
Width="{Binding $parent[ItemsRepeater].((vmInference:ImageFolderCardViewModel)DataContext).ImageSize.Width}"
Height="{Binding $parent[ItemsRepeater].((vmInference:ImageFolderCardViewModel)DataContext).ImageSize.Height}"
Source="{Binding AbsolutePath}"
Source="{Binding AbsolutePath, Converter={StaticResource FileUriConverter}}"
Stretch="UniformToFill" />
<Border

11
StabilityMatrix.Avalonia/ViewModels/Dialogs/LykosLoginViewModel.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@ -90,7 +91,15 @@ public partial class LykosLoginViewModel : TaskDialogViewModelBase
}
catch (ApiException e)
{
LoginError = new AppException("Failed to login", $"{e.StatusCode} - {e.Message}");
LoginError = e.StatusCode switch
{
HttpStatusCode.Unauthorized
=> new AppException(
"Incorrect email or password",
"Please try again or reset your password"
),
_ => new AppException("Failed to login", $"{e.StatusCode} - {e.Message}")
};
}
}

5
StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml

@ -31,6 +31,7 @@
x:Key="TextDropShadowEffect" />
<converters:EnumStringConverter x:Key="EnumStringConverter" />
<converters:FileUriConverter x:Key="FileUriConverter"/>
<!-- Template for a single badge -->
<DataTemplate DataType="{x:Type system:String}" x:Key="BadgeTemplate">
@ -143,7 +144,7 @@
<vendorLabs:BetterAsyncImage
Margin="0,0,0,4"
CornerRadius="4"
Source="{Binding PreviewImagePath}"
Source="{Binding PreviewImagePath, Converter={StaticResource FileUriConverter}}"
Stretch="Uniform"
IsVisible="{Binding IsConnectedModel}" />
<TextBlock
@ -182,7 +183,7 @@
Grid.ColumnSpan="2"
Margin="0, 4,0,4"
CornerRadius="8"
Source="{Binding PreviewImagePath}"
Source="{Binding PreviewImagePath, Converter={StaticResource FileUriConverter}}"
ClipToBounds="True"
Stretch="UniformToFill"
Height="300"

1
StabilityMatrix.Avalonia/Views/Dialogs/LykosLoginDialog.axaml

@ -14,6 +14,7 @@
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
xmlns:ctxt="clr-namespace:ColorTextBlock.Avalonia;assembly=ColorTextBlock.Avalonia"
Focusable="True"
MaxWidth="400"
d:DataContext="{x:Static mocks:DesignData.LykosLoginViewModel}"
d:DesignHeight="350"
d:DesignWidth="400"

8
StabilityMatrix.Avalonia/Views/OutputsPage.axaml

@ -13,6 +13,7 @@
xmlns:selectableImageCard="clr-namespace:StabilityMatrix.Avalonia.Controls.SelectableImageCard"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"
d:DataContext="{x:Static mocks:DesignData.OutputsPageViewModel}"
d:DesignHeight="650"
d:DesignWidth="800"
@ -20,6 +21,11 @@
x:DataType="vm:OutputsPageViewModel"
Focusable="True"
mc:Ignorable="d">
<controls:UserControlBase.Resources>
<converters:FileUriConverter x:Key="FileUriConverter" />
</controls:UserControlBase.Resources>
<Grid Margin="16" RowDefinitions="Auto,*"
ColumnDefinitions="Auto, *">
@ -177,7 +183,7 @@
ImageHeight="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).ImageSize.Height}"
ImageWidth="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).ImageSize.Width}"
IsSelected="{Binding IsSelected}"
Source="{Binding ImageFile.AbsolutePath}">
Source="{Binding ImageFile.AbsolutePath, Converter={StaticResource FileUriConverter}}">
<selectableImageCard:SelectableImageButton.ContextFlyout>
<ui:FAMenuFlyout>
<ui:MenuFlyoutItem

20
StabilityMatrix.Core/Api/TokenAuthHeaderHandler.cs

@ -22,8 +22,8 @@ public class TokenAuthHeaderHandler : DelegatingHandler
.HandleResult<HttpResponseMessage>(
r =>
r.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden
&& r.RequestMessage?.Headers.Authorization
is { Scheme: "Bearer", Parameter: not null }
&& r.RequestMessage?.Headers.Authorization is { Scheme: "Bearer", Parameter: { } param }
&& !string.IsNullOrWhiteSpace(param)
)
.RetryAsync(
async (result, _) =>
@ -35,9 +35,7 @@ public class TokenAuthHeaderHandler : DelegatingHandler
"Refreshing access token for status ({StatusCode})",
result.Result.StatusCode
);
var (newToken, _) = await tokenProvider
.RefreshTokensAsync()
.ConfigureAwait(false);
var (newToken, _) = await tokenProvider.RefreshTokensAsync().ConfigureAwait(false);
Logger.Info(
"Access token refreshed: {OldToken} -> {NewToken}",
@ -46,10 +44,6 @@ public class TokenAuthHeaderHandler : DelegatingHandler
);
}
);
// InnerHandler must be left as null when using DI, but must be assigned a value when
// using RestService.For<IMyApi>
// InnerHandler = new HttpClientHandler();
}
protected override Task<HttpResponseMessage> SendAsync(
@ -58,10 +52,18 @@ public class TokenAuthHeaderHandler : DelegatingHandler
)
{
return policy.ExecuteAsync(async () =>
{
// Only add if Authorization is already set to Bearer and access token is not empty
// this allows some routes to not use the access token
if (request.Headers.Authorization is { Scheme: "Bearer" })
{
var accessToken = await tokenProvider.GetAccessTokenAsync().ConfigureAwait(false);
if (!string.IsNullOrWhiteSpace(accessToken))
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
}
}
return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
});

2
StabilityMatrix.Core/Models/Packages/A3WebUI.cs

@ -204,6 +204,8 @@ public class A3WebUI(
await using var venvRunner = new PyVenvRunner(venvPath);
venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);

4
StabilityMatrix.Core/Models/Packages/ComfyUI.cs

@ -195,8 +195,9 @@ public class ComfyUI(
// Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);
progress?.Report(
@ -245,6 +246,7 @@ 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));

1
StabilityMatrix.Core/Models/Packages/Fooocus.cs

@ -193,6 +193,7 @@ public class Fooocus(
)
{
var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false);
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true));

1
StabilityMatrix.Core/Models/Packages/FooocusMre.cs

@ -111,6 +111,7 @@ public class FooocusMre(
)
{
var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false);
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
progress?.Report(new ProgressReport(-1f, "Installing torch...", isIndeterminate: true));

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

@ -126,9 +126,12 @@ public class KohyaSs(
.ConfigureAwait(false);
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
// Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
// Extra dep needed before running setup since v23.0.x

2
StabilityMatrix.Core/Models/Packages/OneTrainer.cs

@ -57,6 +57,8 @@ public class OneTrainer(
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
progress?.Report(new ProgressReport(-1f, "Installing requirements", isIndeterminate: true));

1
StabilityMatrix.Core/Models/Packages/RuinedFooocus.cs

@ -116,6 +116,7 @@ public class RuinedFooocus(
if (torchVersion == TorchVersion.Cuda)
{
var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false);
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true));

2
StabilityMatrix.Core/Models/Packages/SDWebForge.cs

@ -142,6 +142,8 @@ public class SDWebForge(
await using var venvRunner = new PyVenvRunner(venvPath);
venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);

2
StabilityMatrix.Core/Models/Packages/StableDiffusionDirectMl.cs

@ -76,6 +76,8 @@ public class StableDiffusionDirectMl(
// Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
switch (torchVersion)

2
StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs

@ -190,6 +190,8 @@ public class StableDiffusionUx(
// Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
switch (torchVersion)

8
StabilityMatrix.Core/Models/Packages/VoltaML.cs

@ -21,12 +21,15 @@ public class VoltaML(
public override string DisplayName { get; set; } = "VoltaML";
public override string Author => "VoltaML";
public override string LicenseType => "GPL-3.0";
public override string LicenseUrl => "https://github.com/VoltaML/voltaML-fast-stable-diffusion/blob/main/License";
public override string LicenseUrl =>
"https://github.com/VoltaML/voltaML-fast-stable-diffusion/blob/main/License";
public override string Blurb => "Fast Stable Diffusion with support for AITemplate";
public override string LaunchCommand => "main.py";
public override Uri PreviewImageUri =>
new("https://github.com/LykosAI/StabilityMatrix/assets/13956642/d9a908ed-5665-41a5-a380-98458f4679a8");
new(
"https://github.com/LykosAI/StabilityMatrix/assets/13956642/d9a908ed-5665-41a5-a380-98458f4679a8"
);
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Simple;
@ -155,6 +158,7 @@ public class VoltaML(
progress?.Report(new ProgressReport(-1, "Setting up venv", isIndeterminate: true));
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);

20
StabilityMatrix.Core/Models/Settings/Settings.cs

@ -118,10 +118,22 @@ public class Settings
public Dictionary<string, string>? UserEnvironmentVariables { get; set; }
[JsonIgnore]
public IReadOnlyDictionary<string, string> EnvironmentVariables =>
DefaultEnvironmentVariables
.Concat(UserEnvironmentVariables ?? [])
.ToDictionary(x => x.Key, x => x.Value);
public IReadOnlyDictionary<string, string> EnvironmentVariables
{
get
{
if (UserEnvironmentVariables is null || UserEnvironmentVariables.Count == 0)
{
return DefaultEnvironmentVariables;
}
return DefaultEnvironmentVariables
.Concat(UserEnvironmentVariables)
.GroupBy(pair => pair.Key)
// User variables override default variables with the same key
.ToDictionary(grouping => grouping.Key, grouping => grouping.Last().Value);
}
}
public HashSet<string>? InstalledModelHashes { get; set; } = new();

Loading…
Cancel
Save