Skip to content

Commit

Permalink
Merge pull request #504 from ionite34/release-2.8.1
Browse files Browse the repository at this point in the history
Release 2.8.1
  • Loading branch information
mohnjiles authored Feb 6, 2024
2 parents 8cbe030 + fb122d9 commit ea27537
Show file tree
Hide file tree
Showing 18 changed files with 307 additions and 99 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Automatic Backport

on:
pull_request_target:
types: ["labeled", "closed"]

jobs:
backport:
if: startsWith(github.event.pull_request.labels.*.name, 'backport-to-')
name: Backport PR
runs-on: ubuntu-latest
steps:
- name: Write json
id: create-json
uses: jsdaniell/[email protected]
with:
name: ".backportrc.json"
json: |
{
"targetPRLabels": "backport",
"prTitle": "[{{sourceBranch}} to {{targetBranch}}] backport: {{sourcePullRequest.title}} ({{sourcePullRequest.number}})"
}
- name: Backport Action
uses: sorenlouv/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
auto_backport_label_prefix: backport-to-

- name: Info log
if: ${{ success() }}
run: cat ~/.backport/backport.info.log

- name: Debug log
if: ${{ failure() }}
run: cat ~/.backport/backport.debug.log

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ 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.8.1
### Fixed
- Fixed model links not working in RuinedFooocus for new installations
- Fixed incorrect nodejs download link on Linux (thanks to slogonomo for the fix)
- Fixed failing InvokeAI install on macOS due to missing nodejs
- Increased timeout on Recommended Models call to prevent potential timeout errors on slow connections
- Fixed SynchronizationLockException when saving settings
- Improved error messages with process output for 7z extraction errors
- Fixed missing tkinter dependency for OneTrainer on Windows
- Fixed auto-update on macOS not starting new version from an issue in starting .app bundles with arguments

## v2.8.0
### Added
- Added Image to Video project type
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,37 @@
[download-macos-arm64]: https://github.com/LykosAI/StabilityMatrix/releases/latest/download/StabilityMatrix-macos-arm64.dmg

[auto1111]: https://github.com/AUTOMATIC1111/stable-diffusion-webui
[auto1111-directml]: https://github.com/lshqqytiger/stable-diffusion-webui-directml
[webui-ux]: https://github.com/anapnoe/stable-diffusion-webui-ux
[comfy]: https://github.com/comfyanonymous/ComfyUI
[sdnext]: https://github.com/vladmandic/automatic
[voltaml]: https://github.com/VoltaML/voltaML-fast-stable-diffusion
[invokeai]: https://github.com/invoke-ai/InvokeAI
[fooocus]: https://github.com/lllyasviel/Fooocus
[fooocus-mre]: https://github.com/MoonRide303/Fooocus-MRE
[ruined-fooocus]: https://github.com/runew0lf/RuinedFooocus
[fooocus-controlnet]: https://github.com/fenneishi/Fooocus-ControlNet-SDXL
[kohya-ss]: https://github.com/bmaltais/kohya_ss
[onetrainer]: https://github.com/Nerogar/OneTrainer

[civitai]: https://civitai.com/
[huggingface]: https://huggingface.co/

Multi-Platform Package Manager and Inference UI for Stable Diffusion

### ✨ New in 2.5 - [Inference](#inference-A-reimagined-built-in-Stable-Diffusion-experience), a built-in interface for Stable Diffusion powered by ComfyUI

### 🖱️ One click install and update for Stable Diffusion Web UI Packages
- Supports [Automatic 1111][auto1111], [Comfy UI][comfy], [SD.Next (Vladmandic)][sdnext], [VoltaML][voltaml], [InvokeAI][invokeai], [Fooocus][fooocus], and [Fooocus MRE][fooocus-mre]
- Supports:
- [Automatic 1111][auto1111], [Automatic 1111 DirectML][auto1111-directml], [SD Web UI-UX][webui-ux], [SD.Next][sdnext]
- [Fooocus][fooocus], [Fooocus MRE][fooocus-mre], [Fooocus ControlNet SDXL][fooocus-controlnet], [Ruined Fooocus][ruined-fooocus]
- [ComfyUI][comfy]
- [VoltaML][voltaml]
- [InvokeAI][invokeai]
- [Kohya's GUI][kohya-ss]
- [OneTrainer][onetrainer]
- Manage plugins / extensions for supported packages ([Automatic 1111][auto1111], [Comfy UI][comfy])
- Easily install or update Python dependencies for each package
- Embedded Git and Python dependencies, with no need for either to be globally installed
- Fully portable - move Stability Matrix's Data Directory to a new drive or computer at any time

Expand All @@ -34,15 +50,15 @@ Multi-Platform Package Manager and Inference UI for Stable Diffusion
### 🗃️ Checkpoint Manager, configured to be shared by all Package installs
- Option to find CivitAI metadata and preview thumbnails for new local imports

### ☁️ Model Browser to import from [CivitAI][civitai]
### ☁️ Model Browser to import from [CivitAI][civitai] and [HuggingFace][huggingface]
- Automatically imports to the associated model folder depending on the model type
- Downloads relevant metadata files and preview image

![header](https://cdn.lykos.ai/static/sm-banner-rounded.webp)

[![Release](https://img.shields.io/github/v/release/LykosAI/StabilityMatrix?label=Latest%20Release&link=https%3A%2F%2Fgithub.com%2FLykosAI%2FStabilityMatrix%2Freleases%2Flatest)][release]

[![Windows](https://img.shields.io/badge/Windows-%230079d5.svg?style=for-the-badge&logo=Windows%2011&logoColor=white)][download-win-x64]
[![Windows](https://img.shields.io/badge/Windows%2010,%2011-%230079d5.svg?style=for-the-badge&logo=Windows%2011&logoColor=white)][download-win-x64]
[![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)][download-linux-x64]
[![macOS](https://img.shields.io/badge/mac%20os%20%28apple%20silicon%29-000000?style=for-the-badge&logo=macos&logoColor=F0F0F0)][download-macos-arm64]

Expand Down
2 changes: 1 addition & 1 deletion StabilityMatrix.Avalonia/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ internal static IServiceCollection ConfigureServices()
.ConfigureHttpClient(c =>
{
c.BaseAddress = new Uri("https://auth.lykos.ai");
c.Timeout = TimeSpan.FromSeconds(15);
c.Timeout = TimeSpan.FromSeconds(60);
})
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false })
.AddPolicyHandler(retryPolicy)
Expand Down
19 changes: 16 additions & 3 deletions StabilityMatrix.Avalonia/DesignData/MockSettingsManager.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
using StabilityMatrix.Core.Services;
using System.Threading;
using System.Threading.Tasks;
using StabilityMatrix.Core.Services;

namespace StabilityMatrix.Avalonia.DesignData;

public class MockSettingsManager : SettingsManager
{
protected override void LoadSettings() {}
protected override void SaveSettings() {}
protected override void LoadSettings(CancellationToken cancellationToken = default) { }

protected override Task LoadSettingsAsync(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}

protected override void SaveSettings(CancellationToken cancellationToken = default) { }

protected override Task SaveSettingsAsync(CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
}
25 changes: 7 additions & 18 deletions StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ namespace StabilityMatrix.Avalonia.Helpers;

[SupportedOSPlatform("macos")]
[SupportedOSPlatform("linux")]
public class UnixPrerequisiteHelper : IPrerequisiteHelper
public class UnixPrerequisiteHelper(
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
) : IPrerequisiteHelper
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

private readonly IDownloadService downloadService;
private readonly ISettingsManager settingsManager;
private readonly IPyRunner pyRunner;

private DirectoryPath HomeDir => settingsManager.LibraryDir;
private DirectoryPath AssetsDir => HomeDir.JoinDir("Assets");

Expand All @@ -46,17 +46,6 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper
// Cached store of whether or not git is installed
private bool? isGitInstalled;

public UnixPrerequisiteHelper(
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
)
{
this.downloadService = downloadService;
this.settingsManager = settingsManager;
this.pyRunner = pyRunner;
}

private async Task<bool> CheckIsGitInstalled()
{
var result = await ProcessRunner.RunBashCommand("git --version");
Expand Down Expand Up @@ -298,7 +287,7 @@ public async Task RunNpm(
{
var command = args.Prepend([NpmPath]);

var result = await ProcessRunner.RunBashCommand(command.ToArray(), workingDirectory ?? "");
var result = await ProcessRunner.RunBashCommand(command.ToArray(), workingDirectory ?? "", envVars);
if (result.ExitCode != 0)
{
Logger.Error(
Expand Down Expand Up @@ -333,7 +322,7 @@ public async Task InstallNodeIfNecessary(IProgress<ProgressReport>? progress = n

var downloadUrl = Compat.IsMacOS
? "https://nodejs.org/dist/v20.11.0/node-v20.11.0-darwin-arm64.tar.gz"
: "https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-x64.tar.xz";
: "https://nodejs.org/dist/v20.11.0/node-v20.11.0-linux-x64.tar.gz";

var nodeDownloadPath = AssetsDir.JoinFile(Path.GetFileName(downloadUrl));

Expand Down
37 changes: 14 additions & 23 deletions StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
namespace StabilityMatrix.Avalonia.Helpers;

[SupportedOSPlatform("windows")]
public class WindowsPrerequisiteHelper : IPrerequisiteHelper
public class WindowsPrerequisiteHelper(
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
) : IPrerequisiteHelper
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

private readonly IGitHubClient gitHubClient;
private readonly IDownloadService downloadService;
private readonly ISettingsManager settingsManager;
private readonly IPyRunner pyRunner;

private const string PortableGitDownloadUrl =
"https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/PortableGit-2.41.0-64-bit.7z.exe";
private const string VcRedistDownloadUrl = "https://aka.ms/vs/16/release/vc_redist.x64.exe";
private const string TkinterDownloadUrl =
"https://cdn.lykos.ai/tkinter-cpython-embedded-3.10.11-win-x64.zip";
Expand Down Expand Up @@ -62,19 +63,6 @@ public class WindowsPrerequisiteHelper : IPrerequisiteHelper
public string GitBinPath => Path.Combine(PortableGitInstallDir, "bin");
public bool IsPythonInstalled => File.Exists(PythonDllPath);

public WindowsPrerequisiteHelper(
IGitHubClient gitHubClient,
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
)
{
this.gitHubClient = gitHubClient;
this.downloadService = downloadService;
this.settingsManager = settingsManager;
this.pyRunner = pyRunner;
}

public async Task RunGit(
ProcessArgs args,
Action<ProcessOutput>? onProcessOutput,
Expand Down Expand Up @@ -166,6 +154,11 @@ public async Task InstallPackageRequirements(
{
await InstallNodeIfNecessary(progress);
}

if (prerequisites.Contains(PackagePrerequisite.Tkinter))
{
await InstallTkinterIfNecessary(progress);
}
}

public async Task InstallAllIfNecessary(IProgress<ProgressReport>? progress = null)
Expand Down Expand Up @@ -363,13 +356,11 @@ public async Task InstallGitIfNecessary(IProgress<ProgressReport>? progress = nu

Logger.Info("Git not found at {GitExePath}, downloading...", GitExePath);

var portableGitUrl =
"https://github.com/git-for-windows/git/releases/download/v2.41.0.windows.1/PortableGit-2.41.0-64-bit.7z.exe";

// Download
if (!File.Exists(PortableGitDownloadPath))
{
await downloadService.DownloadToFileAsync(
portableGitUrl,
PortableGitDownloadUrl,
PortableGitDownloadPath,
progress: progress
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ private async Task Install()
return;
}

InstallName = InstallName.Trim();

var setPackageInstallingStep = new SetPackageInstallingStep(settingsManager, InstallName);

var installLocation = Path.Combine(settingsManager.LibraryDir, "Packages", InstallName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ AppData Directory [SpecialFolder.ApplicationData]
AppDataHome: {Compat.AppDataHome}
AppCurrentDir: {Compat.AppCurrentDir}
ExecutableName: {Compat.GetExecutableName()}
AppName: {Compat.GetAppName()}
-- Settings --
Expected Portable Marker file: {expectedPortableFile}
Portable Marker file exists: {isPortableMode}
Expand Down
61 changes: 59 additions & 2 deletions StabilityMatrix.Core/Exceptions/ProcessException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using StabilityMatrix.Core.Processes;
using System.Diagnostics;
using System.Text;
using StabilityMatrix.Core.Processes;

namespace StabilityMatrix.Core.Exceptions;

Expand All @@ -14,9 +16,64 @@ public ProcessException(string message)

public ProcessException(ProcessResult processResult)
: base(
$"Process {processResult.ProcessName} exited with code {processResult.ExitCode}. {{StdOut = {processResult.StandardOutput}, StdErr = {processResult.StandardError}}}"
$"Process {processResult.ProcessName} exited with code {processResult.ExitCode}. "
+ $"{{StdOut = {processResult.StandardOutput}, StdErr = {processResult.StandardError}}}"
)
{
ProcessResult = processResult;
}

public static void ThrowIfNonZeroExitCode(ProcessResult processResult)
{
if (processResult.IsSuccessExitCode)
return;

throw new ProcessException(processResult);
}

public static void ThrowIfNonZeroExitCode(Process process, string output)
{
if (!process.HasExited || process.ExitCode == 0)
return;

throw new ProcessException(
new ProcessResult
{
ProcessName = process.StartInfo.FileName,
ExitCode = process.ExitCode,
StandardOutput = output
}
);
}

public static void ThrowIfNonZeroExitCode(Process process, StringBuilder outputBuilder)
{
if (!process.HasExited || process.ExitCode == 0)
return;

throw new ProcessException(
new ProcessResult
{
ProcessName = process.StartInfo.FileName,
ExitCode = process.ExitCode,
StandardOutput = outputBuilder.ToString()
}
);
}

public static void ThrowIfNonZeroExitCode(Process process, string stdOut, string stdErr)
{
if (!process.HasExited || process.ExitCode == 0)
return;

throw new ProcessException(
new ProcessResult
{
ProcessName = process.StartInfo.FileName,
ExitCode = process.ExitCode,
StandardOutput = stdOut,
StandardError = stdErr
}
);
}
}
13 changes: 9 additions & 4 deletions StabilityMatrix.Core/Helper/ArchiveHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using NLog;
using SharpCompress.Common;
using SharpCompress.Readers;
using StabilityMatrix.Core.Exceptions;
using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Models.FileInterfaces;
using StabilityMatrix.Core.Models.Progress;
Expand Down Expand Up @@ -89,9 +90,10 @@ public static async Task<ArchiveInfo> Extract7Z(string archivePath, string extra
{
var args = $"x {ProcessRunner.Quote(archivePath)} -o{ProcessRunner.Quote(extractDirectory)} -y";

var result = await ProcessRunner.GetProcessResultAsync(SevenZipPath, args).ConfigureAwait(false);

result.EnsureSuccessExitCode();
var result = await ProcessRunner
.GetProcessResultAsync(SevenZipPath, args)
.EnsureSuccessExitCode()
.ConfigureAwait(false);

var output = result.StandardOutput ?? "";

Expand Down Expand Up @@ -145,7 +147,10 @@ IProgress<ProgressReport> progress
Logger.Debug($"Starting process '{SevenZipPath}' with arguments '{args}'");

using var process = ProcessRunner.StartProcess(SevenZipPath, args, outputDataReceived: onOutput);
await ProcessRunner.WaitForExitConditionAsync(process).ConfigureAwait(false);

await process.WaitForExitAsync().ConfigureAwait(false);

ProcessException.ThrowIfNonZeroExitCode(process, outputStore);

progress.Report(new ProgressReport(1f, "Finished extracting", type: ProgressType.Extract));

Expand Down
Loading

0 comments on commit ea27537

Please sign in to comment.