Skip to content

Commit

Permalink
Merge pull request #629 from LykosAI/main
Browse files Browse the repository at this point in the history
v2.10.3
  • Loading branch information
mohnjiles authored May 10, 2024
2 parents d7f977f + ad79d6e commit 3d9c193
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 29 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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
### 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
- Updated translations for Spanish and Turkish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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;
Expand Down Expand Up @@ -114,6 +115,10 @@ public async Task LoadExtraInfo(DirectoryPath venvPath)
}
}
}
catch (ProcessException)
{
// Ignore
}
finally
{
IsLoading = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public PackageInstallProgressItemViewModel(IPackageModificationRunner packageMod
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;
Expand Down
16 changes: 16 additions & 0 deletions StabilityMatrix.Avalonia/ViewModels/RunningPackageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ ConsoleViewModel console
);
}

public override void OnLoaded()
{
if (AutoScrollToEnd)
{
EventManager.Instance.OnScrollToBottomRequested();
}
}

private void BasePackageOnExited(object? sender, int e)
{
IsRunning = false;
Expand Down Expand Up @@ -104,6 +112,14 @@ private void DocumentOnLineCountChanged(object? sender, EventArgs e)
}
}

partial void OnAutoScrollToEndChanged(bool value)
{
if (value)
{
EventManager.Instance.OnScrollToBottomRequested();
}
}

[RelayCommand]
private async Task Restart()
{
Expand Down
6 changes: 3 additions & 3 deletions StabilityMatrix.Avalonia/Views/CivitAiBrowserPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</Transitions>
</Setter>

<Style Selector="^ labs|AsyncImage">
<Style Selector="^ vendorLabs|BetterAsyncImage">
<Setter Property="Transitions">
<Transitions>
<TransformOperationsTransition Property="RenderTransform"
Expand All @@ -49,7 +49,7 @@
<Style Selector="^:pointerover">
<Setter Property="BoxShadow" Value="0 0 40 0 #60000000"/>
<Setter Property="Cursor" Value="Hand" />
<Style Selector="^ labs|AsyncImage">
<Style Selector="^ vendorLabs|BetterAsyncImage">
<Setter Property="CornerRadius" Value="12"/>
<Setter Property="RenderTransform" Value="scale(1.03, 1.03)"/>
</Style>
Expand All @@ -61,7 +61,7 @@
<Style Selector="^:not(:pointerover)">
<Setter Property="BoxShadow" Value="0 0 20 0 #60000000"/>
<Setter Property="Cursor" Value="Arrow" />
<Style Selector="^ labs|AsyncImage">
<Style Selector="^ vendorLabs|BetterAsyncImage">
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="RenderTransform" Value="scale(1, 1)"/>
</Style>
Expand Down
2 changes: 1 addition & 1 deletion StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ protected override void OnUnloaded(RoutedEventArgs e)

protected override void OnLoaded(RoutedEventArgs e)
{
base.OnLoaded(e);
EventManager.Instance.ScrollToBottomRequested += OnScrollToBottomRequested;
base.OnLoaded(e);
}

private void OnScrollToBottomRequested(object? sender, EventArgs e)
Expand Down
1 change: 1 addition & 0 deletions StabilityMatrix.Avalonia/Views/OpenArtBrowserPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@

<ScrollViewer Grid.Row="2"
ScrollChanged="ScrollViewer_OnScrollChanged"
HorizontalContentAlignment="Center"
IsVisible="{Binding !IsLoading}">
<ItemsRepeater ItemsSource="{Binding SearchResults}"
ItemTemplate="{StaticResource OpenArtWorkflowTemplate}">
Expand Down
16 changes: 8 additions & 8 deletions StabilityMatrix.Core/Models/Packages/A3WebUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ IPrerequisiteHelper prerequisiteHelper
public override Dictionary<SharedOutputType, IReadOnlyList<string>>? 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")]
Expand Down Expand Up @@ -186,7 +186,7 @@ IPrerequisiteHelper prerequisiteHelper

public override string MainBranch => "master";

public override string OutputFolderName => "output";
public override string OutputFolderName => "outputs";

public override IPackageExtensionManager ExtensionManager => new A3WebUiExtensionManager(this);

Expand Down Expand Up @@ -223,7 +223,7 @@ public override async Task InstallPackage(
TorchVersion.Cpu => "cpu",
TorchVersion.Cuda => "cu121",
TorchVersion.Rocm => "rocm5.6",
TorchVersion.Mps => "nightly/cpu",
TorchVersion.Mps => "cpu",
_ => throw new ArgumentOutOfRangeException(nameof(torchVersion), torchVersion, null)
}
)
Expand Down
4 changes: 1 addition & 3 deletions StabilityMatrix.Core/Models/Packages/ComfyUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ public override async Task InstallPackage(
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")
Expand Down Expand Up @@ -246,7 +245,6 @@ await requirements.ReadAllTextAsync().ConfigureAwait(false),
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));
Expand Down
13 changes: 12 additions & 1 deletion StabilityMatrix.Core/Models/Packages/SDWebForge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ IPrerequisiteHelper prerequisiteHelper
public override IPackageExtensionManager ExtensionManager => null;
public override string OutputFolderName => "output";
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.ReallyRecommended;
public override Dictionary<SharedOutputType, IReadOnlyList<string>>? 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<LaunchOptionDefinition> LaunchOptions =>
[
Expand Down Expand Up @@ -162,7 +173,7 @@ public override async Task InstallPackage(
TorchVersion.Cpu => "cpu",
TorchVersion.Cuda => "cu121",
TorchVersion.Rocm => "rocm5.6",
TorchVersion.Mps => "nightly/cpu",
TorchVersion.Mps => "cpu",
_ => throw new ArgumentOutOfRangeException(nameof(torchVersion), torchVersion, null)
}
);
Expand Down
2 changes: 1 addition & 1 deletion StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ await venvRunner
new PipInstallArgs()
.WithTorch("==2.1.2")
.WithTorchVision()
.WithTorchExtraIndex("nightly/cpu"),
.WithTorchExtraIndex("cpu"),
onConsoleOutput
)
.ConfigureAwait(false);
Expand Down
52 changes: 41 additions & 11 deletions StabilityMatrix.Core/Python/PipShowResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using StabilityMatrix.Core.Extensions;
using System.Diagnostics;
using StabilityMatrix.Core.Extensions;

namespace StabilityMatrix.Core.Python;

Expand Down Expand Up @@ -31,29 +32,58 @@ public static PipShowResult Parse(string output)
.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<string, string>(split[0].Trim(), split[1].Trim()))
.ToDictionary(pair => pair.Key, pair => pair.Value);

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<string> 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;
}
}

0 comments on commit 3d9c193

Please sign in to comment.