Skip to content

Commit 5907005

Browse files
authored
Merge branch 'main' into backport/main/pr-1189
2 parents 873bfc5 + 482a748 commit 5907005

File tree

4 files changed

+128
-6
lines changed

4 files changed

+128
-6
lines changed

StabilityMatrix.Avalonia/ViewModels/Dialogs/UpdateViewModel.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,68 @@ await updateHelper.DownloadUpdate(
162162
);
163163
}
164164

165+
// Handle Linux AppImage update
166+
if (Compat.IsLinux && Environment.GetEnvironmentVariable("APPIMAGE") is { } appImage)
167+
{
168+
try
169+
{
170+
var updateScriptPath = UpdateHelper.UpdateFolder.JoinFile("update_script.sh").FullPath;
171+
var newAppImage = UpdateHelper.ExecutablePath.FullPath;
172+
173+
var scriptContent = """
174+
#!/bin/bash
175+
set -e
176+
177+
# Wait for the process to exit
178+
while kill -0 "$PID" 2>/dev/null; do
179+
sleep 0.5
180+
done
181+
182+
# Move the new AppImage over the old one
183+
mv -f "$NEW_APPIMAGE" "$OLD_APPIMAGE"
184+
chmod +x "$OLD_APPIMAGE"
185+
186+
# Launch the new AppImage detached
187+
"$OLD_APPIMAGE" > /dev/null 2>&1 &
188+
disown
189+
""";
190+
await File.WriteAllTextAsync(updateScriptPath, scriptContent);
191+
192+
File.SetUnixFileMode(
193+
updateScriptPath,
194+
UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute
195+
);
196+
197+
var startInfo = new System.Diagnostics.ProcessStartInfo
198+
{
199+
FileName = "/usr/bin/env",
200+
Arguments = $"bash \"{updateScriptPath}\"",
201+
UseShellExecute = false,
202+
CreateNoWindow = true,
203+
};
204+
205+
startInfo.EnvironmentVariables["PID"] = Environment.ProcessId.ToString();
206+
startInfo.EnvironmentVariables["NEW_APPIMAGE"] = newAppImage;
207+
startInfo.EnvironmentVariables["OLD_APPIMAGE"] = appImage;
208+
209+
System.Diagnostics.Process.Start(startInfo);
210+
211+
App.Shutdown();
212+
return;
213+
}
214+
catch (Exception ex)
215+
{
216+
logger.LogError(ex, "Failed to execute AppImage update script");
217+
218+
var dialog = DialogHelper.CreateMarkdownDialog(
219+
"AppImage update script failed. \nCould not replace old AppImage with new version. Please check directory permissions. \nFalling back to standard update process. User intervention required: \nAfter program closes, \nplease move the new AppImage extracted in the '.StabilityMatrixUpdate' hidden directory to the old AppImage overwriting it. \n\nClose this dialog to continue with standard update process.",
220+
Resources.Label_UnexpectedErrorOccurred
221+
);
222+
223+
await dialog.ShowAsync();
224+
}
225+
}
226+
165227
// Set current version for update messages
166228
settingsManager.Transaction(
167229
s => s.UpdatingFromVersion = Compat.AppVersion,

StabilityMatrix.Core/Models/Packages/ComfyUI.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ await StandardPipInstallProcessAsync(
382382
var indexUrl = gfxArch switch
383383
{
384384
"gfx1151" => "https://rocm.nightlies.amd.com/v2/gfx1151",
385-
_ when gfxArch.StartsWith("gfx110") => "https://rocm.nightlies.amd.com/v2/gfx110X-dgpu",
385+
_ when gfxArch.StartsWith("gfx110") => "https://rocm.nightlies.amd.com/v2/gfx110X-all",
386386
_ when gfxArch.StartsWith("gfx120") => "https://rocm.nightlies.amd.com/v2/gfx120X-all",
387387
_ => throw new ArgumentOutOfRangeException(
388388
nameof(gfxArch),
@@ -923,6 +923,8 @@ private ImmutableDictionary<string, string> GetEnvVars(ImmutableDictionary<strin
923923
// set some experimental speed improving env vars for Windows ROCm
924924
return env.SetItem("PYTORCH_TUNABLEOP_ENABLED", "1")
925925
.SetItem("MIOPEN_FIND_MODE", "2")
926-
.SetItem("TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL", "1");
926+
.SetItem("TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL", "1")
927+
.SetItem("PYTORCH_ALLOC_CONF", "max_split_size_mb:6144,garbage_collection_threshold:0.8") // greatly helps prevent GPU OOM and instability/driver timeouts/OS hard locks and decreases dependency on Tiled VAE at standard res's
928+
.SetItem("COMFYUI_ENABLE_MIOPEN", "1"); // re-enables "cudnn" in ComfyUI as it's needed for MiOpen to function properly
927929
}
928930
}

StabilityMatrix.Core/Models/Packages/ComfyZluda.cs

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using StabilityMatrix.Core.Helper;
77
using StabilityMatrix.Core.Helper.Cache;
88
using StabilityMatrix.Core.Helper.HardwareInfo;
9+
using StabilityMatrix.Core.Models;
910
using StabilityMatrix.Core.Models.FileInterfaces;
1011
using StabilityMatrix.Core.Models.Progress;
1112
using StabilityMatrix.Core.Processes;
@@ -40,8 +41,65 @@ IPyInstallationManager pyInstallationManager
4041
public override string Disclaimer =>
4142
"Prerequisite install may require admin privileges and a reboot. "
4243
+ "Visual Studio Build Tools for C++ Desktop Development will be installed automatically. "
43-
+ "AMD GPUs under the RX 6800 may require additional manual setup.";
44+
+ "AMD GPUs under the RX 6800 may require additional manual setup. ";
4445
public override string LaunchCommand => Path.Combine("zluda", "zluda.exe");
46+
47+
public override List<LaunchOptionDefinition> LaunchOptions
48+
{
49+
get
50+
{
51+
var options = new List<LaunchOptionDefinition>
52+
{
53+
new()
54+
{
55+
Name = "Cross Attention Method",
56+
Type = LaunchOptionType.Bool,
57+
InitialValue = "--use-quad-cross-attention",
58+
Options =
59+
[
60+
"--use-split-cross-attention",
61+
"--use-quad-cross-attention",
62+
"--use-pytorch-cross-attention",
63+
"--use-sage-attention",
64+
],
65+
},
66+
new()
67+
{
68+
Name = "Disable Async Offload",
69+
Type = LaunchOptionType.Bool,
70+
InitialValue = true,
71+
Options = ["--disable-async-offload"],
72+
},
73+
new()
74+
{
75+
Name = "Disable Pinned Memory",
76+
Type = LaunchOptionType.Bool,
77+
InitialValue = true,
78+
Options = ["--disable-pinned-memory"],
79+
},
80+
new()
81+
{
82+
Name = "Disable Smart Memory",
83+
Type = LaunchOptionType.Bool,
84+
InitialValue = false,
85+
Options = ["--disable-smart-memory"],
86+
},
87+
new()
88+
{
89+
Name = "Disable Model/Node Caching",
90+
Type = LaunchOptionType.Bool,
91+
InitialValue = false,
92+
Options = ["--cache-none"],
93+
},
94+
};
95+
96+
options.AddRange(
97+
base.LaunchOptions.Where(x => x.Name != "Cross Attention Method")
98+
);
99+
return options;
100+
}
101+
}
102+
45103
public override IEnumerable<TorchIndex> AvailableTorchIndices => [TorchIndex.Zluda];
46104

47105
public override TorchIndex GetRecommendedTorchVersion() => TorchIndex.Zluda;

StabilityMatrix.Core/Models/Packages/VladAutomatic.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ IPyInstallationManager pyInstallationManager
3131
public override string Name => "automatic";
3232
public override string DisplayName { get; set; } = "SD.Next";
3333
public override string Author => "vladmandic";
34-
public override string LicenseType => "AGPL-3.0";
35-
public override string LicenseUrl => "https://github.com/vladmandic/automatic/blob/master/LICENSE.txt";
36-
public override string Blurb => "Stable Diffusion implementation with advanced features and modern UI";
34+
public override string LicenseType => "Apache License 2.0";
35+
public override string LicenseUrl => "https://github.com/vladmandic/sdnext/blob/master/LICENSE.txt";
36+
public override string Blurb => "SD.Next: All-in-one WebUI for AI generative image and video creation";
3737
public override string LaunchCommand => "launch.py";
3838

3939
public override Uri PreviewImageUri => new("https://cdn.lykos.ai/sm/packages/vladautomatic/preview.webp");

0 commit comments

Comments
 (0)