|
1 | 1 | using System.Diagnostics; |
| 2 | +using System.Diagnostics; |
2 | 3 | using System.Text.RegularExpressions; |
| 4 | +using System.Text.RegularExpressions; |
| 5 | +using Injectio.Attributes; |
3 | 6 | using Injectio.Attributes; |
4 | 7 | using StabilityMatrix.Core.Exceptions; |
5 | 8 | using StabilityMatrix.Core.Extensions; |
6 | 9 | using StabilityMatrix.Core.Helper; |
7 | 10 | using StabilityMatrix.Core.Helper.Cache; |
8 | 11 | using StabilityMatrix.Core.Helper.HardwareInfo; |
| 12 | +using StabilityMatrix.Core.Models; |
9 | 13 | using StabilityMatrix.Core.Models.FileInterfaces; |
10 | 14 | using StabilityMatrix.Core.Models.Progress; |
11 | 15 | using StabilityMatrix.Core.Processes; |
@@ -47,64 +51,54 @@ public override List<LaunchOptionDefinition> LaunchOptions |
47 | 51 | { |
48 | 52 | get |
49 | 53 | { |
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> |
55 | 55 | { |
56 | | - options[crossAttentionIndex] = options[crossAttentionIndex] with |
| 56 | + new() |
57 | 57 | { |
| 58 | + Name = "Cross Attention Method", |
| 59 | + Type = LaunchOptionType.Bool, |
58 | 60 | 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() |
69 | 70 | { |
70 | 71 | Name = "Disable Async Offload", |
71 | 72 | Type = LaunchOptionType.Bool, |
72 | 73 | InitialValue = true, |
73 | 74 | Options = ["--disable-async-offload"], |
74 | | - } |
75 | | - ); |
76 | | - |
77 | | - options.Insert( |
78 | | - insertIndex + 1, |
79 | | - new LaunchOptionDefinition |
| 75 | + }, |
| 76 | + new() |
80 | 77 | { |
81 | 78 | Name = "Disable Pinned Memory", |
82 | 79 | Type = LaunchOptionType.Bool, |
83 | 80 | InitialValue = true, |
84 | 81 | Options = ["--disable-pinned-memory"], |
85 | | - } |
86 | | - ); |
87 | | - options.Insert( |
88 | | - insertIndex + 2, |
89 | | - new LaunchOptionDefinition |
| 82 | + }, |
| 83 | + new() |
90 | 84 | { |
91 | 85 | Name = "Disable Smart Memory", |
92 | 86 | Type = LaunchOptionType.Bool, |
93 | 87 | InitialValue = false, |
94 | 88 | Options = ["--disable-smart-memory"], |
95 | | - } |
96 | | - ); |
97 | | - options.Insert( |
98 | | - insertIndex + 3, |
99 | | - new LaunchOptionDefinition |
| 89 | + }, |
| 90 | + new() |
100 | 91 | { |
101 | 92 | Name = "Disable Model/Node Caching", |
102 | 93 | Type = LaunchOptionType.Bool, |
103 | 94 | InitialValue = false, |
104 | 95 | Options = ["--cache-none"], |
105 | | - } |
106 | | - ); |
| 96 | + }, |
| 97 | + }; |
107 | 98 |
|
| 99 | + options.AddRange( |
| 100 | + base.LaunchOptions.Except(base.LaunchOptions.Where(x => x.Name == "Cross Attention Method")) |
| 101 | + ); |
108 | 102 | return options; |
109 | 103 | } |
110 | 104 | } |
|
0 commit comments