Skip to content

Commit 52acb7d

Browse files
committed
Refactored launch option logic and positioning.
1 parent 69858c3 commit 52acb7d

1 file changed

Lines changed: 28 additions & 34 deletions

File tree

StabilityMatrix.Core/Models/Packages/ComfyZluda.cs

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
using System.Diagnostics;
2+
using System.Diagnostics;
23
using System.Text.RegularExpressions;
4+
using System.Text.RegularExpressions;
5+
using Injectio.Attributes;
36
using Injectio.Attributes;
47
using StabilityMatrix.Core.Exceptions;
58
using StabilityMatrix.Core.Extensions;
69
using StabilityMatrix.Core.Helper;
710
using StabilityMatrix.Core.Helper.Cache;
811
using StabilityMatrix.Core.Helper.HardwareInfo;
12+
using StabilityMatrix.Core.Models;
913
using StabilityMatrix.Core.Models.FileInterfaces;
1014
using StabilityMatrix.Core.Models.Progress;
1115
using StabilityMatrix.Core.Processes;
@@ -47,64 +51,54 @@ public override List<LaunchOptionDefinition> LaunchOptions
4751
{
4852
get
4953
{
50-
var options = base.LaunchOptions;
51-
52-
// Update Cross Attention Method default
53-
var crossAttentionIndex = options.FindIndex(o => o.Name == "Cross Attention Method");
54-
if (crossAttentionIndex != -1)
54+
var options = new List<LaunchOptionDefinition>
5555
{
56-
options[crossAttentionIndex] = options[crossAttentionIndex] with
56+
new()
5757
{
58+
Name = "Cross Attention Method",
59+
Type = LaunchOptionType.Bool,
5860
InitialValue = "--use-quad-cross-attention",
59-
};
60-
}
61-
62-
// Add new options before Extras (which is usually last)
63-
var extrasIndex = options.FindIndex(o => o.Name == "Extra Launch Arguments");
64-
var insertIndex = extrasIndex != -1 ? extrasIndex : options.Count;
65-
66-
options.Insert(
67-
insertIndex,
68-
new LaunchOptionDefinition
61+
Options =
62+
[
63+
"--use-split-cross-attention",
64+
"--use-quad-cross-attention",
65+
"--use-pytorch-cross-attention",
66+
"--use-sage-attention",
67+
],
68+
},
69+
new()
6970
{
7071
Name = "Disable Async Offload",
7172
Type = LaunchOptionType.Bool,
7273
InitialValue = true,
7374
Options = ["--disable-async-offload"],
74-
}
75-
);
76-
77-
options.Insert(
78-
insertIndex + 1,
79-
new LaunchOptionDefinition
75+
},
76+
new()
8077
{
8178
Name = "Disable Pinned Memory",
8279
Type = LaunchOptionType.Bool,
8380
InitialValue = true,
8481
Options = ["--disable-pinned-memory"],
85-
}
86-
);
87-
options.Insert(
88-
insertIndex + 2,
89-
new LaunchOptionDefinition
82+
},
83+
new()
9084
{
9185
Name = "Disable Smart Memory",
9286
Type = LaunchOptionType.Bool,
9387
InitialValue = false,
9488
Options = ["--disable-smart-memory"],
95-
}
96-
);
97-
options.Insert(
98-
insertIndex + 3,
99-
new LaunchOptionDefinition
89+
},
90+
new()
10091
{
10192
Name = "Disable Model/Node Caching",
10293
Type = LaunchOptionType.Bool,
10394
InitialValue = false,
10495
Options = ["--cache-none"],
105-
}
106-
);
96+
},
97+
};
10798

99+
options.AddRange(
100+
base.LaunchOptions.Except(base.LaunchOptions.Where(x => x.Name == "Cross Attention Method"))
101+
);
108102
return options;
109103
}
110104
}

0 commit comments

Comments
 (0)