Skip to content

Commit

Permalink
Merge pull request LykosAI#842 from ionite34/backport/main/pr-841
Browse files Browse the repository at this point in the history
[dev to main] backport: Fixed a few github issues (841)
  • Loading branch information
mohnjiles authored Sep 28, 2024
2 parents 0fe3a2e + 6d78aba commit 6dc2c2d
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 122 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
## v2.12.1
### Fixed
- Fixed [#916](https://github.com/LykosAI/StabilityMatrix/issues/916) - InvokeAI failing to install/update on macOS
- Fixed [#914](https://github.com/LykosAI/StabilityMatrix/issues/914) - Unable to use escaped colon `:` character in Inference prompts
- Fixed [#908](https://github.com/LykosAI/StabilityMatrix/issues/908) - Forge unable to use models from "unet" shared folder
- Fixed [#902](https://github.com/LykosAI/StabilityMatrix/issues/902) - Images from shared outputs folder not displaying properly in Stable Diffusion WebUI-UX
- Fixed [#898](https://github.com/LykosAI/StabilityMatrix/issues/898) - Incorrect launch options for RuinedFooocus
- Fixed index url parsing in Python Packages window causing some packages to not have versions available

## v2.12.0
### Added
Expand Down
4 changes: 2 additions & 2 deletions StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"name": "constant.character.escape.prompt"
}
},
"end": "[-+.!(){}\\[\\]<\\>]",
"end": "[-+.!(){}\\[\\]<\\>:]",
"endCaptures": {
"0": {
"name": "constant.character.escape.target.prompt"
Expand All @@ -35,7 +35,7 @@
"name": "meta.structure.escape.prompt",
"patterns": [
{
"match": "[^-+.!(){}\\[\\]<\\>]",
"match": "[^-+.!(){}\\[\\]<\\>:]",
"name": "invalid.illegal.escape.prompt"
}
]
Expand Down
67 changes: 34 additions & 33 deletions StabilityMatrix.Core/Models/Packages/A3WebUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,42 @@ IPrerequisiteHelper prerequisiteHelper
public override Dictionary<SharedFolderType, IReadOnlyList<string>> SharedFolders =>
new()
{
[SharedFolderType.StableDiffusion] = new[] { "models/Stable-diffusion" },
[SharedFolderType.ESRGAN] = new[] { "models/ESRGAN" },
[SharedFolderType.GFPGAN] = new[] { "models/GFPGAN" },
[SharedFolderType.RealESRGAN] = new[] { "models/RealESRGAN" },
[SharedFolderType.SwinIR] = new[] { "models/SwinIR" },
[SharedFolderType.Lora] = new[] { "models/Lora" },
[SharedFolderType.LyCORIS] = new[] { "models/LyCORIS" },
[SharedFolderType.ApproxVAE] = new[] { "models/VAE-approx" },
[SharedFolderType.VAE] = new[] { "models/VAE" },
[SharedFolderType.DeepDanbooru] = new[] { "models/deepbooru" },
[SharedFolderType.Karlo] = new[] { "models/karlo" },
[SharedFolderType.TextualInversion] = new[] { "embeddings" },
[SharedFolderType.Hypernetwork] = new[] { "models/hypernetworks" },
[SharedFolderType.ControlNet] = new[] { "models/controlnet/ControlNet" },
[SharedFolderType.Codeformer] = new[] { "models/Codeformer" },
[SharedFolderType.LDSR] = new[] { "models/LDSR" },
[SharedFolderType.AfterDetailer] = new[] { "models/adetailer" },
[SharedFolderType.T2IAdapter] = new[] { "models/controlnet/T2IAdapter" },
[SharedFolderType.IpAdapter] = new[] { "models/controlnet/IpAdapter" },
[SharedFolderType.InvokeIpAdapters15] = new[] { "models/controlnet/DiffusersIpAdapters" },
[SharedFolderType.InvokeIpAdaptersXl] = new[] { "models/controlnet/DiffusersIpAdaptersXL" },
[SharedFolderType.SVD] = new[] { "models/svd" },
[SharedFolderType.CLIP] = new[] { "models/text_encoder" }
[SharedFolderType.StableDiffusion] = ["models/Stable-diffusion/sd"],
[SharedFolderType.ESRGAN] = ["models/ESRGAN"],
[SharedFolderType.GFPGAN] = ["models/GFPGAN"],
[SharedFolderType.RealESRGAN] = ["models/RealESRGAN"],
[SharedFolderType.SwinIR] = ["models/SwinIR"],
[SharedFolderType.Lora] = ["models/Lora"],
[SharedFolderType.LyCORIS] = ["models/LyCORIS"],
[SharedFolderType.ApproxVAE] = ["models/VAE-approx"],
[SharedFolderType.VAE] = ["models/VAE"],
[SharedFolderType.DeepDanbooru] = ["models/deepbooru"],
[SharedFolderType.Karlo] = ["models/karlo"],
[SharedFolderType.TextualInversion] = ["embeddings"],
[SharedFolderType.Hypernetwork] = ["models/hypernetworks"],
[SharedFolderType.ControlNet] = ["models/controlnet/ControlNet"],
[SharedFolderType.Codeformer] = ["models/Codeformer"],
[SharedFolderType.LDSR] = ["models/LDSR"],
[SharedFolderType.AfterDetailer] = ["models/adetailer"],
[SharedFolderType.T2IAdapter] = ["models/controlnet/T2IAdapter"],
[SharedFolderType.IpAdapter] = ["models/controlnet/IpAdapter"],
[SharedFolderType.InvokeIpAdapters15] = ["models/controlnet/DiffusersIpAdapters"],
[SharedFolderType.InvokeIpAdaptersXl] = ["models/controlnet/DiffusersIpAdaptersXL"],
[SharedFolderType.SVD] = ["models/svd"],
[SharedFolderType.CLIP] = ["models/text_encoder"],
[SharedFolderType.Unet] = ["models/Stable-diffusion/unet"],
};

public override Dictionary<SharedOutputType, IReadOnlyList<string>>? SharedOutputFolders =>
new()
{
[SharedOutputType.Extras] = new[] { "outputs/extras-images" },
[SharedOutputType.Saved] = new[] { "log/images" },
[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" }
[SharedOutputType.Extras] = ["outputs/extras-images"],
[SharedOutputType.Saved] = ["log/images"],
[SharedOutputType.Img2Img] = ["outputs/img2img-images"],
[SharedOutputType.Text2Img] = ["outputs/txt2img-images"],
[SharedOutputType.Img2ImgGrids] = ["outputs/img2img-grids"],
[SharedOutputType.Text2ImgGrids] = ["outputs/txt2img-grids"],
[SharedOutputType.SVD] = ["outputs/svd"]
};

[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeNotEvident")]
Expand All @@ -101,7 +102,7 @@ IPrerequisiteHelper prerequisiteHelper
DefaultValue = "7860",
Options = ["--port"]
},
new LaunchOptionDefinition
new()
{
Name = "Share",
Type = LaunchOptionType.Bool,
Expand Down Expand Up @@ -181,10 +182,10 @@ IPrerequisiteHelper prerequisiteHelper
];

public override IEnumerable<SharedFolderMethod> AvailableSharedFolderMethods =>
new[] { SharedFolderMethod.Symlink, SharedFolderMethod.None };
[SharedFolderMethod.Symlink, SharedFolderMethod.None];

public override IEnumerable<TorchIndex> AvailableTorchIndices =>
new[] { TorchIndex.Cpu, TorchIndex.Cuda, TorchIndex.Rocm, TorchIndex.Mps };
[TorchIndex.Cpu, TorchIndex.Cuda, TorchIndex.Rocm, TorchIndex.Mps];

public override string MainBranch => "master";

Expand Down
6 changes: 0 additions & 6 deletions StabilityMatrix.Core/Models/Packages/Fooocus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ IPrerequisiteHelper prerequisiteHelper
Options = { "--language" }
},
new LaunchOptionDefinition
{
Name = "Auto-Launch",
Type = LaunchOptionType.Bool,
Options = { "--auto-launch" }
},
new LaunchOptionDefinition
{
Name = "Disable Image Log",
Type = LaunchOptionType.Bool,
Expand Down
57 changes: 12 additions & 45 deletions StabilityMatrix.Core/Models/Packages/RuinedFooocus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,77 +32,44 @@ IPrerequisiteHelper prerequisiteHelper
public override SharedFolderMethod RecommendedSharedFolderMethod => SharedFolderMethod.Symlink;

public override List<LaunchOptionDefinition> LaunchOptions =>
new()
{
new LaunchOptionDefinition
{
Name = "Preset",
Type = LaunchOptionType.Bool,
Options = { "--preset anime", "--preset realistic" }
},
new LaunchOptionDefinition
[
new()
{
Name = "Port",
Type = LaunchOptionType.String,
Description = "Sets the listen port",
Options = { "--port" }
},
new LaunchOptionDefinition
new()
{
Name = "Share",
Type = LaunchOptionType.Bool,
Description = "Set whether to share on Gradio",
Options = { "--share" }
},
new LaunchOptionDefinition
new()
{
Name = "Listen",
Type = LaunchOptionType.String,
Description = "Set the listen interface",
Options = { "--listen" }
},
new LaunchOptionDefinition
new()
{
Name = "Output Directory",
Name = "Auth",
Type = LaunchOptionType.String,
Description = "Override the output directory",
Options = { "--output-directory" }
Description = "Set credentials username/password",
Options = { "--auth" }
},
new()
{
Name = "VRAM",
Type = LaunchOptionType.Bool,
InitialValue = HardwareHelper.IterGpuInfo().Select(gpu => gpu.MemoryLevel).Max() switch
{
MemoryLevel.Low => "--lowvram",
MemoryLevel.Medium => "--normalvram",
_ => null
},
Options = { "--highvram", "--normalvram", "--lowvram", "--novram" }
},
new LaunchOptionDefinition
{
Name = "Use DirectML",
Type = LaunchOptionType.Bool,
Description = "Use pytorch with DirectML support",
InitialValue = HardwareHelper.PreferDirectML(),
Options = { "--directml" }
},
new LaunchOptionDefinition
{
Name = "Disable Xformers",
Type = LaunchOptionType.Bool,
InitialValue = !HardwareHelper.HasNvidiaGpu(),
Options = { "--disable-xformers" }
},
new LaunchOptionDefinition
{
Name = "Auto-Launch",
Name = "No Browser",
Type = LaunchOptionType.Bool,
Options = { "--auto-launch" }
Description = "Do not launch in browser",
Options = { "--nobrowser" }
},
LaunchOptionDefinition.Extras
};
];

public override async Task InstallPackage(
string installLocation,
Expand Down
26 changes: 13 additions & 13 deletions StabilityMatrix.Core/Models/Packages/SDWebForge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,78 +41,78 @@ IPrerequisiteHelper prerequisiteHelper

public override List<LaunchOptionDefinition> LaunchOptions =>
[
new LaunchOptionDefinition
new()
{
Name = "Host",
Type = LaunchOptionType.String,
DefaultValue = "localhost",
Options = ["--server-name"]
},
new LaunchOptionDefinition
new()
{
Name = "Port",
Type = LaunchOptionType.String,
DefaultValue = "7860",
Options = ["--port"]
},
new LaunchOptionDefinition
new()
{
Name = "Share",
Type = LaunchOptionType.Bool,
Description = "Set whether to share on Gradio",
Options = { "--share" }
},
new LaunchOptionDefinition
new()
{
Name = "Pin Shared Memory",
Type = LaunchOptionType.Bool,
Options = { "--pin-shared-memory" }
},
new LaunchOptionDefinition
new()
{
Name = "CUDA Malloc",
Type = LaunchOptionType.Bool,
Options = { "--cuda-malloc" }
},
new LaunchOptionDefinition
new()
{
Name = "CUDA Stream",
Type = LaunchOptionType.Bool,
Options = { "--cuda-stream" }
},
new LaunchOptionDefinition
new()
{
Name = "Always Offload from VRAM",
Type = LaunchOptionType.Bool,
Options = ["--always-offload-from-vram"]
},
new LaunchOptionDefinition
new()
{
Name = "Always GPU",
Type = LaunchOptionType.Bool,
Options = ["--always-gpu"]
},
new LaunchOptionDefinition
new()
{
Name = "Always CPU",
Type = LaunchOptionType.Bool,
Options = ["--always-cpu"]
},
new LaunchOptionDefinition
new()
{
Name = "Use DirectML",
Type = LaunchOptionType.Bool,
InitialValue = HardwareHelper.PreferDirectML(),
Options = ["--directml"]
},
new LaunchOptionDefinition
new()
{
Name = "Skip Torch CUDA Test",
Type = LaunchOptionType.Bool,
InitialValue = Compat.IsMacOS,
Options = ["--skip-torch-cuda-test"]
},
new LaunchOptionDefinition
new()
{
Name = "No half-precision VAE",
Type = LaunchOptionType.Bool,
Expand All @@ -123,7 +123,7 @@ IPrerequisiteHelper prerequisiteHelper
];

public override IEnumerable<TorchIndex> AvailableTorchIndices =>
new[] { TorchIndex.Cpu, TorchIndex.Cuda, TorchIndex.DirectMl, TorchIndex.Rocm, TorchIndex.Mps };
[TorchIndex.Cpu, TorchIndex.Cuda, TorchIndex.DirectMl, TorchIndex.Rocm, TorchIndex.Mps];

public override async Task InstallPackage(
string installLocation,
Expand Down
30 changes: 8 additions & 22 deletions StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ IPrerequisiteHelper prerequisiteHelper

public override string OutputFolderName => "outputs";

public override IReadOnlyList<string> ExtraLaunchArguments =>
settingsManager.IsLibraryDirSet ? ["--gradio-allowed-path", settingsManager.ImagesDirectory] : [];

public override async Task InstallPackage(
string installLocation,
InstalledPackage installedPackage,
Expand Down Expand Up @@ -263,33 +266,16 @@ void HandleConsoleOutput(ProcessOutput s)
}

VenvRunner.RunDetached(
[Path.Combine(installLocation, options.Command ?? LaunchCommand), ..options.Arguments],
[
Path.Combine(installLocation, options.Command ?? LaunchCommand),
..options.Arguments,
..ExtraLaunchArguments
],
HandleConsoleOutput,
OnExit
);
}

private async Task InstallRocmTorch(
PyVenvRunner venvRunner,
IProgress<ProgressReport>? progress = null,
Action<ProcessOutput>? onConsoleOutput = null
)
{
progress?.Report(new ProgressReport(-1f, "Installing PyTorch for ROCm", isIndeterminate: true));

await venvRunner.PipInstall(["--upgrade", "pip", "wheel"], onConsoleOutput).ConfigureAwait(false);

await venvRunner
.PipInstall(
new PipInstallArgs()
.WithTorch("==2.0.1")
.WithTorchVision("==0.15.2")
.WithTorchExtraIndex("rocm5.4.2"),
onConsoleOutput
)
.ConfigureAwait(false);
}

private class A3WebUiExtensionManager(StableDiffusionUx package)
: GitPackageExtensionManager(package.PrerequisiteHelper)
{
Expand Down
2 changes: 1 addition & 1 deletion StabilityMatrix.Core/Python/PyVenvRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public async Task<IReadOnlyList<PipPackageInfo>> PipList()

if (indexUrl is not null)
{
args = args.AddArg(("--index-url", indexUrl));
args = args.AddKeyedArgs("--index-url", ["--index-url", indexUrl]);
}

var result = await ProcessRunner
Expand Down

0 comments on commit 6dc2c2d

Please sign in to comment.