Browse Source

Merge pull request #515 from LykosAI/main

v2.9.1.1
pull/566/head
JT 8 months ago committed by GitHub
parent
commit
8cebc775e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 51
      StabilityMatrix.Core/Models/Packages/KohyaSs.cs

1
CHANGELOG.md

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
- Fixed [#502](https://github.com/LykosAI/StabilityMatrix/issues/502) - missing launch options for Forge - Fixed [#502](https://github.com/LykosAI/StabilityMatrix/issues/502) - missing launch options for Forge
- Fixed [#500](https://github.com/LykosAI/StabilityMatrix/issues/500) - missing output images in Forge when using output sharing - Fixed [#500](https://github.com/LykosAI/StabilityMatrix/issues/500) - missing output images in Forge when using output sharing
- Fixed [#490](https://github.com/LykosAI/StabilityMatrix/issues/490) - `mpmath has no attribute 'rational'` error on macOS - Fixed [#490](https://github.com/LykosAI/StabilityMatrix/issues/490) - `mpmath has no attribute 'rational'` error on macOS
- Fixed [#510](https://github.com/ionite34/StabilityMatrix/pull/564/files) - kohya_ss packages with v23.0.x failing to install due to missing 'packaging' dependency
- Fixed incorrect progress text when deleting a checkpoint from the Checkpoints page - Fixed incorrect progress text when deleting a checkpoint from the Checkpoints page
- Fixed incorrect icon colors on macOS - Fixed incorrect icon colors on macOS

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

@ -116,12 +116,24 @@ public class KohyaSs(
Action<ProcessOutput>? onConsoleOutput = null Action<ProcessOutput>? onConsoleOutput = null
) )
{ {
progress?.Report(new ProgressReport(-1f, "Updating submodules", isIndeterminate: true));
await PrerequisiteHelper
.RunGit(
["submodule", "update", "--init", "--recursive", "--quiet"],
onConsoleOutput,
installLocation
)
.ConfigureAwait(false);
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true)); progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
// Setup venv // Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
// Extra dep needed before running setup since v23.0.x
await venvRunner.PipInstall("packaging").ConfigureAwait(false);
if (Compat.IsWindows) if (Compat.IsWindows)
{ {
var setupSmPath = Path.Combine(installLocation, "setup", "setup_sm.py"); var setupSmPath = Path.Combine(installLocation, "setup", "setup_sm.py");
@ -136,18 +148,17 @@ public class KohyaSs(
await File.WriteAllTextAsync(setupSmPath, setupText).ConfigureAwait(false); await File.WriteAllTextAsync(setupSmPath, setupText).ConfigureAwait(false);
// Install // Install
venvRunner.RunDetached("setup/setup_sm.py", onConsoleOutput); await venvRunner.CustomInstall("setup/setup_sm.py", onConsoleOutput).ConfigureAwait(false);
await venvRunner.Process.WaitForExitAsync().ConfigureAwait(false);
await venvRunner.PipInstall("bitsandbytes-windows").ConfigureAwait(false); await venvRunner.PipInstall("bitsandbytes-windows").ConfigureAwait(false);
} }
else if (Compat.IsLinux) else if (Compat.IsLinux)
{ {
venvRunner.RunDetached( await venvRunner
.CustomInstall(
"setup/setup_linux.py --platform-requirements-file=requirements_linux.txt --no_run_accelerate", "setup/setup_linux.py --platform-requirements-file=requirements_linux.txt --no_run_accelerate",
onConsoleOutput onConsoleOutput
); )
await venvRunner.Process.WaitForExitAsync().ConfigureAwait(false); .ConfigureAwait(false);
} }
} }
@ -198,18 +209,40 @@ public class KohyaSs(
1.ToPython() 1.ToPython()
); );
var filesToUpdate = new[] 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", "lora_gui.py",
"dreambooth_gui.py", "dreambooth_gui.py",
"textual_inversion_gui.py", "textual_inversion_gui.py",
Path.Combine("library", "wd14_caption_gui.py"), Path.Combine("library", "wd14_caption_gui.py"),
"finetune_gui.py" "finetune_gui.py"
}; ]
);
}
foreach (var file in filesToUpdate) foreach (var file in filesToUpdate)
{ {
var path = Path.Combine(installedPackagePath, file); var path = Path.Combine(guiDirExists ? kohyaGuiDir : installedPackagePath, file);
if (!File.Exists(path))
continue;
var text = File.ReadAllText(path); var text = File.ReadAllText(path);
if (text.Contains(replacementAcceleratePath.Replace(@"\", @"\\"))) if (text.Contains(replacementAcceleratePath.Replace(@"\", @"\\")))
continue; continue;

Loading…
Cancel
Save