From 67ce55d429ba29542367a78f6db89679c9200de0 Mon Sep 17 00:00:00 2001 From: JT Date: Wed, 3 Apr 2024 19:28:04 -0700 Subject: [PATCH] Fixed invoke install/run failing & fixed model browser not showing any images --- CHANGELOG.md | 7 +++ .../DesignData/DesignData.cs | 2 +- .../CheckpointBrowserCardViewModel.cs | 2 +- .../Dialogs/SelectModelVersionViewModel.cs | 2 +- StabilityMatrix.Core/Models/Api/CivitImage.cs | 14 ++--- .../Models/Packages/InvokeAI.cs | 57 ++----------------- 6 files changed, 23 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cebef51c..cb439da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ 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.9.3 +### Changed +- Removed Symlink option for InvokeAI to prevent InvokeAI from moving models into its own directories (will be replaced with a Config option in a future update) +### Fixed +- Fixed images not appearing in Civitai Model Browser when "Show NSFW" was disabled +- Fixed [#556](https://github.com/LykosAI/StabilityMatrix/issues/556) - "Could not find entry point for InvokeAI" error + ## v2.9.2 ### Changed - Due to changes with the CivitAI API, you can no longer select a specific page in the CivitAI Model Browser diff --git a/StabilityMatrix.Avalonia/DesignData/DesignData.cs b/StabilityMatrix.Avalonia/DesignData/DesignData.cs index 9cabf8af..263ae811 100644 --- a/StabilityMatrix.Avalonia/DesignData/DesignData.cs +++ b/StabilityMatrix.Avalonia/DesignData/DesignData.cs @@ -345,7 +345,7 @@ public static class DesignData { new() { - Nsfw = "None", + NsfwLevel = 1, Url = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/" + "78fd2a0a-42b6-42b0-9815-81cb11bb3d05/00009-2423234823.jpeg" diff --git a/StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs index 148712c0..048a6c3d 100644 --- a/StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs @@ -158,7 +158,7 @@ public partial class CheckpointBrowserCardViewModel : Base.ProgressViewModel // Try to find a valid image var image = images ?.Where(img => LocalModelFile.SupportedImageExtensions.Any(img.Url.Contains)) - .FirstOrDefault(image => nsfwEnabled || image.Nsfw == "None"); + .FirstOrDefault(image => nsfwEnabled || image.NsfwLevel <= 1); if (image != null) { CardImage = new Uri(image.Url); diff --git a/StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs index 9ef4c378..2cf7f264 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs @@ -99,7 +99,7 @@ public partial class SelectModelVersionViewModel( var allImages = value ?.ModelVersion ?.Images - ?.Where(img => nsfwEnabled || img.Nsfw == "None") + ?.Where(img => nsfwEnabled || img.NsfwLevel <= 1) ?.Select(x => new ImageSource(x.Url)) .ToList(); diff --git a/StabilityMatrix.Core/Models/Api/CivitImage.cs b/StabilityMatrix.Core/Models/Api/CivitImage.cs index 0cab1b50..82aadce2 100644 --- a/StabilityMatrix.Core/Models/Api/CivitImage.cs +++ b/StabilityMatrix.Core/Models/Api/CivitImage.cs @@ -6,18 +6,18 @@ public class CivitImage { [JsonPropertyName("url")] public string Url { get; set; } - - [JsonPropertyName("nsfw")] - public string Nsfw { get; set; } - + + [JsonPropertyName("nsfwLevel")] + public int? NsfwLevel { get; set; } + [JsonPropertyName("width")] public int Width { get; set; } - + [JsonPropertyName("height")] public int Height { get; set; } - + [JsonPropertyName("hash")] public string Hash { get; set; } - + // TODO: "meta" ( object? ) } diff --git a/StabilityMatrix.Core/Models/Packages/InvokeAI.cs b/StabilityMatrix.Core/Models/Packages/InvokeAI.cs index 6502f292..625a76f9 100644 --- a/StabilityMatrix.Core/Models/Packages/InvokeAI.cs +++ b/StabilityMatrix.Core/Models/Packages/InvokeAI.cs @@ -32,23 +32,14 @@ public class InvokeAI : BaseGitPackage public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Nightmare; public override IReadOnlyList ExtraLaunchCommands => - new[] - { - "invokeai-configure", - "invokeai-merge", - "invokeai-metadata", - "invokeai-model-install", - "invokeai-node-cli", - "invokeai-ti", - "invokeai-update", - }; + new[] { "invokeai-db-maintenance", "invokeai-import-images", }; public override Uri PreviewImageUri => new("https://raw.githubusercontent.com/invoke-ai/InvokeAI/main/docs/assets/canvas_preview.png"); public override IEnumerable AvailableSharedFolderMethods => - new[] { SharedFolderMethod.Symlink, SharedFolderMethod.None }; - public override SharedFolderMethod RecommendedSharedFolderMethod => SharedFolderMethod.Symlink; + new[] { SharedFolderMethod.None }; + public override SharedFolderMethod RecommendedSharedFolderMethod => SharedFolderMethod.None; public override string MainBranch => "main"; @@ -127,23 +118,11 @@ public class InvokeAI : BaseGitPackage Options = ["--allow-origins"] }, new LaunchOptionDefinition - { - Name = "Always use CPU", - Type = LaunchOptionType.Bool, - Options = ["--always_use_cpu"] - }, - new LaunchOptionDefinition { Name = "Precision", Type = LaunchOptionType.Bool, Options = ["--precision auto", "--precision float16", "--precision float32"] }, - new LaunchOptionDefinition - { - Name = "Aggressively free up GPU memory after each operation", - Type = LaunchOptionType.Bool, - Options = ["--free_gpu_mem"] - }, LaunchOptionDefinition.Extras ]; @@ -223,9 +202,9 @@ public class InvokeAI : BaseGitPackage await venvRunner .PipInstall( new PipInstallArgs(args.Any() ? args.ToArray() : Array.Empty()) - .WithTorch("==2.1.2") - .WithTorchVision("==0.16.2") - .WithXFormers("==0.0.23post1") + .WithTorch("==2.2.1") + .WithTorchVision("==0.17.1") + .WithXFormers("==0.0.25") .WithTorchExtraIndex("cu121"), onConsoleOutput ) @@ -262,24 +241,6 @@ public class InvokeAI : BaseGitPackage .ConfigureAwait(false); await venvRunner.PipInstall("rich packaging python-dotenv", onConsoleOutput).ConfigureAwait(false); - - progress?.Report(new ProgressReport(-1f, "Configuring InvokeAI", isIndeterminate: true)); - - // need to setup model links before running invokeai-configure so it can do its conversion - await SetupModelFolders(installLocation, selectedSharedFolderMethod).ConfigureAwait(false); - - await RunInvokeCommand( - installLocation, - "invokeai-configure", - "--yes --skip-sd-weights", - true, - onConsoleOutput, - spam3: true - ) - .ConfigureAwait(false); - - await VenvRunner.Process.WaitForExitAsync(); - progress?.Report(new ProgressReport(1f, "Done!", isIndeterminate: false)); } @@ -362,12 +323,6 @@ public class InvokeAI : BaseGitPackage await SetupVenv(installedPackagePath).ConfigureAwait(false); - arguments = command switch - { - "invokeai-configure" => "--yes --skip-sd-weights", - _ => arguments - }; - VenvRunner.EnvironmentVariables = GetEnvVars(installedPackagePath); // fix frontend build missing for people who updated to v3.6 before the fix