Skip to content

Commit c421649

Browse files
committed
Add default launch options for ZLUDA stability and update default cross attention method
1 parent 84f5085 commit c421649

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

StabilityMatrix.Core/Models/Packages/ComfyZluda.cs

Lines changed: 44 additions & 0 deletions
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;
@@ -42,6 +43,49 @@ IPyInstallationManager pyInstallationManager
4243
+ "Visual Studio Build Tools for C++ Desktop Development will be installed automatically. "
4344
+ "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 = base.LaunchOptions;
52+
53+
// Update Cross Attention Method default
54+
var crossAttentionIndex = options.FindIndex(o => o.Name == "Cross Attention Method");
55+
if (crossAttentionIndex != -1)
56+
{
57+
options[crossAttentionIndex] = options[crossAttentionIndex] with
58+
{
59+
InitialValue = "--use-quad-cross-attention"
60+
};
61+
}
62+
63+
// Add new options before Extras (which is usually last)
64+
var extrasIndex = options.FindIndex(o => o.Name == "Extra Launch Arguments");
65+
var insertIndex = extrasIndex != -1 ? extrasIndex : options.Count;
66+
67+
options.Insert(insertIndex, new LaunchOptionDefinition
68+
{
69+
Name = "Disable Async Offload",
70+
Type = LaunchOptionType.Bool,
71+
InitialValue = true,
72+
Options = ["--disable-async-offload"],
73+
Description = "Disable async weight offloading. Recommended for ZLUDA stability.",
74+
});
75+
76+
options.Insert(insertIndex + 1, new LaunchOptionDefinition
77+
{
78+
Name = "Disable Pinned Memory",
79+
Type = LaunchOptionType.Bool,
80+
InitialValue = true,
81+
Options = ["--disable-pinned-memory"],
82+
Description = "Disable pinned memory. Recommended for ZLUDA stability.",
83+
});
84+
85+
return options;
86+
}
87+
}
88+
4589
public override IEnumerable<TorchIndex> AvailableTorchIndices => [TorchIndex.Zluda];
4690

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

0 commit comments

Comments
 (0)