Skip to content

Commit d79e3fc

Browse files
authored
Merge pull request LykosAI#985 from ionite34/backport/main/pr-984
[dev to main] backport: Add blackwell torch/vision versions for comfyUI & fix unet path for l… (984)
2 parents 207e6c6 + bc24742 commit d79e3fc

File tree

4 files changed

+67
-27
lines changed

4 files changed

+67
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ All notable changes to Stability Matrix will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html).
7-
7+
88
## v2.13.4
9+
### Added
10+
- Added support for RTX 5000-series GPUs in ComfyUI
911
### Changed
1012
- Upgraded ComfyUI CUDA torch to 12.6
1113
### Fixed
1214
- Fixed [#1128](https://github.com/LykosAI/StabilityMatrix/issues/1128) - overwriting models when downloading multiple with the same name
1315
- Fixed ROCm torch indexes for ComfyUI & Forge
1416
- Fixed model browser sometimes downloading to `ModelsLora` or `ModelsStableDiffusion` folders instead of the correct folder
17+
- Fixed incorrect Unet folder path for ComfyUI users on Linux/macOS
1518

1619
## v2.13.3
1720
### Changed

StabilityMatrix.Core/Helper/HardwareInfo/GpuInfo.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ public bool IsNvidia
2727
}
2828
}
2929

30+
public bool IsBlackwellGpu()
31+
{
32+
if (Name is null)
33+
return false;
34+
35+
return IsNvidia
36+
&& Name.Contains("RTX 50", StringComparison.OrdinalIgnoreCase)
37+
&& !Name.Contains("RTX 5000", StringComparison.OrdinalIgnoreCase);
38+
}
39+
3040
public bool IsAmd => Name?.Contains("amd", StringComparison.OrdinalIgnoreCase) ?? false;
3141
public bool IsIntel => Name?.Contains("arc", StringComparison.OrdinalIgnoreCase) ?? false;
3242

StabilityMatrix.Core/Helper/HardwareInfo/HardwareHelper.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,17 @@ public static bool HasNvidiaGpu()
250250
return IterGpuInfo().Any(gpu => gpu.IsNvidia);
251251
}
252252

253+
public static bool HasBlackwellGpu()
254+
{
255+
return IterGpuInfo()
256+
.Any(
257+
gpu =>
258+
gpu is { IsNvidia: true, Name: not null }
259+
&& gpu.Name.Contains("RTX 50", StringComparison.OrdinalIgnoreCase)
260+
&& !gpu.Name.Contains("RTX 5000", StringComparison.OrdinalIgnoreCase)
261+
);
262+
}
263+
253264
/// <summary>
254265
/// Return true if the system has at least one AMD GPU.
255266
/// </summary>

StabilityMatrix.Core/Models/Packages/ComfyUI.cs

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -207,36 +207,52 @@ public override async Task InstallPackage(
207207

208208
var pipArgs = new PipInstallArgs();
209209

210-
pipArgs = torchVersion switch
210+
var isBlackwell =
211+
SettingsManager.Settings.PreferredGpu?.IsBlackwellGpu() ?? HardwareHelper.HasBlackwellGpu();
212+
213+
if (isBlackwell)
211214
{
212-
TorchIndex.DirectMl => pipArgs.WithTorchDirectML(),
213-
_
214-
=> pipArgs
215-
.AddArg("--upgrade")
216-
.WithTorch()
217-
.WithTorchVision()
218-
.WithTorchExtraIndex(
219-
torchVersion switch
220-
{
221-
TorchIndex.Cpu => "cpu",
222-
TorchIndex.Cuda => "cu126",
223-
TorchIndex.Rocm => "rocm6.2.4",
224-
TorchIndex.Mps => "cpu",
225-
_
226-
=> throw new ArgumentOutOfRangeException(
227-
nameof(torchVersion),
228-
torchVersion,
229-
null
230-
)
231-
}
232-
)
233-
};
215+
pipArgs = pipArgs
216+
.AddArg(
217+
"https://huggingface.co/w-e-w/torch-2.6.0-cu128.nv/resolve/main/torch-2.6.0%2Bcu128.nv-cp310-cp310-win_amd64.whl"
218+
)
219+
.AddArg(
220+
"https://huggingface.co/w-e-w/torch-2.6.0-cu128.nv/resolve/main/torchvision-0.20.0a0%2Bcu128.nv-cp310-cp310-win_amd64.whl"
221+
);
222+
}
223+
else
224+
{
225+
pipArgs = torchVersion switch
226+
{
227+
TorchIndex.DirectMl => pipArgs.WithTorchDirectML(),
228+
_
229+
=> pipArgs
230+
.AddArg("--upgrade")
231+
.WithTorch()
232+
.WithTorchVision()
233+
.WithTorchExtraIndex(
234+
torchVersion switch
235+
{
236+
TorchIndex.Cpu => "cpu",
237+
TorchIndex.Cuda => "cu126",
238+
TorchIndex.Rocm => "rocm6.2.4",
239+
TorchIndex.Mps => "cpu",
240+
_
241+
=> throw new ArgumentOutOfRangeException(
242+
nameof(torchVersion),
243+
torchVersion,
244+
null
245+
)
246+
}
247+
)
248+
};
249+
}
234250

235251
var requirements = new FilePath(installLocation, "requirements.txt");
236252

237253
pipArgs = pipArgs.WithParsedFromRequirementsTxt(
238254
await requirements.ReadAllTextAsync(cancellationToken).ConfigureAwait(false),
239-
excludePattern: "torch$|numpy"
255+
excludePattern: isBlackwell ? "torch$|torchvision$|numpy" : "torch$|numpy"
240256
);
241257

242258
// https://github.com/comfyanonymous/ComfyUI/pull/4121
@@ -385,7 +401,7 @@ private async Task SetupModelFoldersConfig(DirectoryPath installDirectory)
385401
nodeValue.Children["ultralytics_bbox"] = Path.Combine(modelsDir, "Ultralytics", "bbox");
386402
nodeValue.Children["ultralytics_segm"] = Path.Combine(modelsDir, "Ultralytics", "segm");
387403
nodeValue.Children["sams"] = Path.Combine(modelsDir, "Sams");
388-
nodeValue.Children["diffusion_models"] = Path.Combine(modelsDir, "unet");
404+
nodeValue.Children["diffusion_models"] = Path.Combine(modelsDir, "Unet");
389405
}
390406
else
391407
{
@@ -429,7 +445,7 @@ private async Task SetupModelFoldersConfig(DirectoryPath installDirectory)
429445
{ "ultralytics_bbox", Path.Combine(modelsDir, "Ultralytics", "bbox") },
430446
{ "ultralytics_segm", Path.Combine(modelsDir, "Ultralytics", "segm") },
431447
{ "sams", Path.Combine(modelsDir, "Sams") },
432-
{ "diffusion_models", Path.Combine(modelsDir, "unet") }
448+
{ "diffusion_models", Path.Combine(modelsDir, "Unet") }
433449
}
434450
);
435451
}

0 commit comments

Comments
 (0)