Skip to content

Commit b5c4bb9

Browse files
authored
Merge pull request LykosAI#1228 from ionite34/downmerg-again
Downmerg again
2 parents aab84b1 + 0fd8456 commit b5c4bb9

12 files changed

Lines changed: 449 additions & 25 deletions

File tree

StabilityMatrix.Avalonia/ViewModels/Base/PausableProgressItemViewModelBase.cs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ public abstract partial class PausableProgressItemViewModelBase : ProgressItemVi
1414
nameof(IsPaused),
1515
nameof(IsCompleted),
1616
nameof(CanPauseResume),
17-
nameof(CanCancel)
17+
nameof(CanCancel),
18+
nameof(CanRetry),
19+
nameof(CanDismiss)
1820
)]
1921
private ProgressState state = ProgressState.Inactive;
2022

@@ -33,9 +35,31 @@ public abstract partial class PausableProgressItemViewModelBase : ProgressItemVi
3335
public virtual bool SupportsPauseResume => true;
3436
public virtual bool SupportsCancel => true;
3537

38+
/// <summary>
39+
/// Override to true in subclasses that support manual retry after failure.
40+
/// Defaults to false so unrelated progress item types are never affected.
41+
/// </summary>
42+
public virtual bool SupportsRetry => false;
43+
44+
/// <summary>
45+
/// Override to true in subclasses that support dismissing a failed item,
46+
/// which runs full sidecar cleanup before removing the entry.
47+
/// </summary>
48+
public virtual bool SupportsDismiss => false;
49+
3650
public bool CanPauseResume => SupportsPauseResume && !IsCompleted && !IsPending;
3751
public bool CanCancel => SupportsCancel && !IsCompleted;
3852

53+
/// <summary>
54+
/// True only when this item supports retry AND is in the Failed state.
55+
/// </summary>
56+
public bool CanRetry => SupportsRetry && State == ProgressState.Failed;
57+
58+
/// <summary>
59+
/// True only when this item supports dismiss AND is in the Failed state.
60+
/// </summary>
61+
public bool CanDismiss => SupportsDismiss && State == ProgressState.Failed;
62+
3963
private AsyncRelayCommand? pauseCommand;
4064
public IAsyncRelayCommand PauseCommand => pauseCommand ??= new AsyncRelayCommand(Pause);
4165

@@ -51,6 +75,16 @@ public abstract partial class PausableProgressItemViewModelBase : ProgressItemVi
5175

5276
public virtual Task Cancel() => Task.CompletedTask;
5377

78+
private AsyncRelayCommand? retryCommand;
79+
public IAsyncRelayCommand RetryCommand => retryCommand ??= new AsyncRelayCommand(Retry);
80+
81+
public virtual Task Retry() => Task.CompletedTask;
82+
83+
private AsyncRelayCommand? dismissCommand;
84+
public IAsyncRelayCommand DismissCommand => dismissCommand ??= new AsyncRelayCommand(Dismiss);
85+
86+
public virtual Task Dismiss() => Task.CompletedTask;
87+
5488
[RelayCommand]
5589
private Task TogglePauseResume()
5690
{

StabilityMatrix.Avalonia/ViewModels/Progress/DownloadProgressItemViewModel.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ private void OnProgressStateChanged(ProgressState state)
7171
}
7272
}
7373

74+
/// <summary>
75+
/// Downloads support manual retry when they reach the Failed state.
76+
/// </summary>
77+
public override bool SupportsRetry => true;
78+
79+
/// <summary>
80+
/// Downloads support dismiss, which cleans up all sidecar files when
81+
/// the user discards a failed download without retrying.
82+
/// </summary>
83+
public override bool SupportsDismiss => true;
84+
7485
/// <inheritdoc />
7586
public override Task Cancel()
7687
{
@@ -91,4 +102,23 @@ public override Task Resume()
91102
{
92103
return downloadService.TryResumeDownload(download);
93104
}
105+
106+
/// <inheritdoc />
107+
/// Resets the internal retry counter so the user gets a fresh 3-attempt budget,
108+
/// then re-registers the download in the service dictionary (it was removed on
109+
/// failure) and resumes it through the normal concurrency queue.
110+
public override Task Retry()
111+
{
112+
download.ResetAttempts();
113+
return downloadService.TryRestartDownload(download);
114+
}
115+
116+
/// <inheritdoc />
117+
/// Runs full cleanup (temp file + sidecar files) for a failed download the user
118+
/// chooses not to retry, then transitions to Cancelled so the service removes it.
119+
public override Task Dismiss()
120+
{
121+
download.Dismiss();
122+
return Task.CompletedTask;
123+
}
94124
}

StabilityMatrix.Avalonia/Views/ProgressManagerPage.axaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,24 @@
113113
IsVisible="{Binding CanCancel}">
114114
<ui:SymbolIcon Symbol="Cancel" />
115115
</Button>
116+
117+
<!-- Retry button: only visible when download is in Failed state -->
118+
<Button
119+
Classes="transparent-full"
120+
Command="{Binding RetryCommand}"
121+
IsVisible="{Binding CanRetry}"
122+
ToolTip.Tip="Retry download">
123+
<ui:SymbolIcon Symbol="Refresh" />
124+
</Button>
125+
126+
<!-- Dismiss button: cleans up sidecar files for failed downloads that won't be retried -->
127+
<Button
128+
Classes="transparent-full"
129+
Command="{Binding DismissCommand}"
130+
IsVisible="{Binding CanDismiss}"
131+
ToolTip.Tip="Dismiss and clean up">
132+
<ui:SymbolIcon Symbol="Delete" />
133+
</Button>
116134
</StackPanel>
117135

118136
<ProgressBar

StabilityMatrix.Core/Models/Packages/A3WebUI.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,19 @@ public override async Task InstallPackage(
219219
.ConfigureAwait(false);
220220

221221
var torchIndex = options.PythonOptions.TorchIndex ?? GetRecommendedTorchVersion();
222-
var isBlackwell =
222+
var isLegacyNvidia =
223223
torchIndex is TorchIndex.Cuda
224-
&& (SettingsManager.Settings.PreferredGpu?.IsBlackwellGpu() ?? HardwareHelper.HasBlackwellGpu());
224+
&& (SettingsManager.Settings.PreferredGpu?.IsLegacyNvidiaGpu() ?? HardwareHelper.HasLegacyNvidiaGpu());
225225

226226
// 1. Configure the entire install process declaratively.
227227
var config = new PipInstallConfig
228228
{
229229
RequirementsFilePaths = ["requirements_versions.txt"],
230-
TorchVersion = torchIndex == TorchIndex.Mps ? "==2.3.1" : (isBlackwell ? "" : "==2.1.2"),
231-
TorchvisionVersion = torchIndex == TorchIndex.Mps ? "==0.18.1" : (isBlackwell ? "" : "==0.16.2"),
232-
XformersVersion = isBlackwell ? " " : "==0.0.23.post1",
233-
CudaIndex = isBlackwell ? "cu128" : "cu121",
234-
RocmIndex = "rocm5.6",
230+
TorchVersion = " ",
231+
TorchvisionVersion = " ",
232+
XformersVersion = isLegacyNvidia ? "==0.0.30" : " ",
233+
CudaIndex = isLegacyNvidia ? "cu126" : "cu128",
234+
RocmIndex = "rocm7.2",
235235
ExtraPipArgs =
236236
[
237237
"https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip",

StabilityMatrix.Core/Models/Packages/ComfyUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ _ when gfxArch.StartsWith("gfx120") => "https://rocm.nightlies.amd.com/v2/gfx120
431431
ExtraPipArgs = ["numpy<2"],
432432
TorchaudioVersion = " ", // Request torchaudio without a specific version
433433
CudaIndex = isLegacyNvidia ? "cu126" : "cu130",
434-
RocmIndex = "rocm7.1",
434+
RocmIndex = "rocm7.2",
435435
UpgradePackages = true,
436436
PostInstallPipArgs = ["typing-extensions>=4.15.0"],
437437
};

StabilityMatrix.Core/Models/Packages/InvokeAI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public override async Task InstallPackage(
229229
TorchIndex.Cpu when Compat.IsLinux => "https://download.pytorch.org/whl/cpu",
230230
TorchIndex.Cuda when isLegacyNvidiaGpu => "https://download.pytorch.org/whl/cu126",
231231
TorchIndex.Cuda => "https://download.pytorch.org/whl/cu128",
232-
TorchIndex.Rocm => "https://download.pytorch.org/whl/rocm6.3",
232+
TorchIndex.Rocm => "https://download.pytorch.org/whl/rocm7.2",
233233
_ => string.Empty,
234234
};
235235

StabilityMatrix.Core/Models/Packages/PipInstallConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public record PipInstallConfig
1515
public string TorchaudioVersion { get; init; } = "";
1616
public string XformersVersion { get; init; } = "";
1717
public string CudaIndex { get; init; } = "cu130";
18-
public string RocmIndex { get; init; } = "rocm6.4";
18+
public string RocmIndex { get; init; } = "rocm7.2";
1919
public bool ForceReinstallTorch { get; init; } = true;
2020
public bool UpgradePackages { get; init; } = false;
2121
public bool SkipTorchInstall { get; init; } = false;

StabilityMatrix.Core/Models/Packages/SDWebForge.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,18 @@ public override async Task InstallPackage(
181181
}
182182

183183
var torchIndex = options.PythonOptions.TorchIndex ?? GetRecommendedTorchVersion();
184-
var isBlackwell =
184+
var isLegacyNvidia =
185185
torchIndex is TorchIndex.Cuda
186-
&& (SettingsManager.Settings.PreferredGpu?.IsBlackwellGpu() ?? HardwareHelper.HasBlackwellGpu());
186+
&& (SettingsManager.Settings.PreferredGpu?.IsLegacyNvidiaGpu() ?? HardwareHelper.HasLegacyNvidiaGpu());
187187

188188
var config = new PipInstallConfig
189189
{
190190
PrePipInstallArgs = ["joblib"],
191191
RequirementsFilePaths = requirementsPaths,
192-
TorchVersion = "",
193-
TorchvisionVersion = "",
194-
CudaIndex = isBlackwell ? "cu128" : "cu126",
195-
RocmIndex = "rocm7.1",
192+
TorchVersion = " ",
193+
TorchvisionVersion = " ",
194+
CudaIndex = isLegacyNvidia ? "cu126" : "cu128",
195+
RocmIndex = "rocm7.2",
196196
ExtraPipArgs =
197197
[
198198
"https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip",

0 commit comments

Comments
 (0)