Skip to content

Commit 7e5389f

Browse files
authored
Merge pull request LykosAI#1102 from ionite34/backport/main/pr-1101
[dev to main] backport: Fixed a few github issues & update download locations for wan/hunyuan/ggufs (1101)
2 parents a1fe98c + ea800e1 commit 7e5389f

File tree

9 files changed

+123
-76
lines changed

9 files changed

+123
-76
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ 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).
77

88
## v2.14.3
9+
### Added
10+
- Added the ability to search by pasting an entire Civitai model URL into the search bar in the Civitai model browser (when the Civitai API gets fixed)
911
### Changed
10-
- The main sidebar now remembers whether it was collapsed or expanded between restarts.
12+
- The main sidebar now remembers whether it was collapsed or expanded between restarts
13+
- Updated pre-selected download locations for certain model types in the Civitai model browser
1114
### Fixed
1215
- Fixed missing .NET 8 dependency for SwarmUI installs in certain cases
16+
- Fixed [#1291](https://github.com/LykosAI/StabilityMatrix/issues/1291) - Certain GPUs not being detected on Linux
17+
- Fixed [#1284](https://github.com/LykosAI/StabilityMatrix/issues/1284) - Output browser not ignoring InvokeAI thumbnails folders
18+
- Fixed [#1305](https://github.com/LykosAI/StabilityMatrix/issues/1305) - FluxGym installing incorrect packages for Blackwell GPUs
19+
- Fixed [#1316](https://github.com/LykosAI/StabilityMatrix/issues/1316) - Errors when installing Triton & SageAttention
1320

1421
## v2.14.2
1522
### Changed

StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,30 +147,26 @@ private void CheckIfInstalled()
147147

148148
var latestVersionInstalled =
149149
latestVersion.Files != null
150-
&& latestVersion.Files.Any(
151-
file =>
152-
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
153-
&& installedModels.Contains(file.Hashes.BLAKE3)
150+
&& latestVersion.Files.Any(file =>
151+
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
152+
&& installedModels.Contains(file.Hashes.BLAKE3)
154153
);
155154

156155
// check if any of the ModelVersion.Files.Hashes.BLAKE3 hashes are in the installedModels list
157156
var anyVersionInstalled =
158157
latestVersionInstalled
159-
|| CivitModel.ModelVersions.Any(
160-
version =>
161-
version.Files != null
162-
&& version.Files.Any(
163-
file =>
164-
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
165-
&& installedModels.Contains(file.Hashes.BLAKE3)
166-
)
158+
|| CivitModel.ModelVersions.Any(version =>
159+
version.Files != null
160+
&& version.Files.Any(file =>
161+
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
162+
&& installedModels.Contains(file.Hashes.BLAKE3)
163+
)
167164
);
168165

169-
UpdateCardText = latestVersionInstalled
170-
? "Installed"
171-
: anyVersionInstalled
172-
? "Update Available"
173-
: string.Empty;
166+
UpdateCardText =
167+
latestVersionInstalled ? "Installed"
168+
: anyVersionInstalled ? "Update Available"
169+
: string.Empty;
174170

175171
ShowUpdateCard = anyVersionInstalled;
176172
}
@@ -179,15 +175,15 @@ private void UpdateImage()
179175
{
180176
var nsfwEnabled = settingsManager.Settings.ModelBrowserNsfwEnabled;
181177
var hideEarlyAccessModels = settingsManager.Settings.HideEarlyAccessModels;
182-
var version = CivitModel.ModelVersions?.FirstOrDefault(
183-
v => !hideEarlyAccessModels || !v.IsEarlyAccess
178+
var version = CivitModel.ModelVersions?.FirstOrDefault(v =>
179+
!hideEarlyAccessModels || !v.IsEarlyAccess
184180
);
185181
var images = version?.Images;
186182

187183
// Try to find a valid image
188184
var image = images
189-
?.Where(
190-
img => LocalModelFile.SupportedImageExtensions.Any(img.Url.Contains) && img.Type == "image"
185+
?.Where(img =>
186+
LocalModelFile.SupportedImageExtensions.Any(img.Url.Contains) && img.Type == "image"
191187
)
192188
.FirstOrDefault(image => nsfwEnabled || image.NsfwLevel <= 1);
193189
if (image != null)
@@ -351,6 +347,9 @@ private async Task ShowVersionDialog(CivitModel model)
351347
if (
352348
model.BaseModelType == CivitBaseModelType.Flux1D.GetStringValue()
353349
|| model.BaseModelType == CivitBaseModelType.Flux1S.GetStringValue()
350+
|| model.BaseModelType == CivitBaseModelType.WanVideo.GetStringValue()
351+
|| model.BaseModelType == CivitBaseModelType.HunyuanVideo.GetStringValue()
352+
|| selectedFile?.Metadata.Format is CivitModelFormat.GGUF
354353
)
355354
{
356355
sharedFolder = SharedFolderType.DiffusionModels.GetStringValue();

StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CivitAiBrowserViewModel.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,29 @@ private async Task SearchModels(bool isInfiniteScroll = false)
640640
modelRequest.Sort = CivitSortMode.HighestRated;
641641
}
642642
}
643+
else if (SearchQuery.StartsWith("https://civitai.com/models/"))
644+
{
645+
/* extract model ID from URL, could be one of:
646+
https://civitai.com/models/443821?modelVersionId=1957537
647+
https://civitai.com/models/443821/cyberrealistic-pony
648+
https://civitai.com/models/443821
649+
*/
650+
var modelId = SearchQuery
651+
.Replace("https://civitai.com/models/", string.Empty)
652+
.Split(['?', '/'], StringSplitOptions.RemoveEmptyEntries)
653+
.FirstOrDefault();
654+
655+
modelRequest.Period = CivitPeriod.AllTime;
656+
modelRequest.BaseModels = null;
657+
modelRequest.Types = null;
658+
modelRequest.CommaSeparatedModelIds = modelId;
659+
660+
if (modelRequest.Sort is CivitSortMode.Favorites or CivitSortMode.Installed)
661+
{
662+
SortMode = CivitSortMode.HighestRated;
663+
modelRequest.Sort = CivitSortMode.HighestRated;
664+
}
665+
}
643666
else
644667
{
645668
modelRequest.Query = SearchQuery;

StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ private void LoadInstallLocations()
314314

315315
var downloadDirectory = GetSharedFolderPath(
316316
rootModelsDirectory,
317-
SelectedFile?.CivitFile.Type,
317+
SelectedFile?.CivitFile,
318318
CivitModel.Type,
319319
CivitModel.BaseModelType
320320
);
@@ -356,12 +356,12 @@ var directory in downloadDirectory.EnumerateDirectories(
356356

357357
private static DirectoryPath GetSharedFolderPath(
358358
DirectoryPath rootModelsDirectory,
359-
CivitFileType? fileType,
359+
CivitFile? civitFile,
360360
CivitModelType modelType,
361361
string? baseModelType
362362
)
363363
{
364-
if (fileType is CivitFileType.VAE)
364+
if (civitFile?.Type is CivitFileType.VAE)
365365
{
366366
return rootModelsDirectory.JoinDir(SharedFolderType.VAE.GetStringValue());
367367
}
@@ -371,17 +371,15 @@ modelType is CivitModelType.Checkpoint
371371
&& (
372372
baseModelType == CivitBaseModelType.Flux1D.GetStringValue()
373373
|| baseModelType == CivitBaseModelType.Flux1S.GetStringValue()
374+
|| baseModelType == CivitBaseModelType.WanVideo.GetStringValue()
375+
|| baseModelType == CivitBaseModelType.HunyuanVideo.GetStringValue()
376+
|| civitFile?.Metadata.Format == CivitModelFormat.GGUF
374377
)
375378
)
376379
{
377380
return rootModelsDirectory.JoinDir(SharedFolderType.DiffusionModels.GetStringValue());
378381
}
379382

380-
if (modelType is CivitModelType.Checkpoint && baseModelType == "Wan Video")
381-
{
382-
return rootModelsDirectory.JoinDir(SharedFolderType.DiffusionModels.GetStringValue());
383-
}
384-
385383
return rootModelsDirectory.JoinDir(modelType.ConvertTo<SharedFolderType>().GetStringValue());
386384
}
387385
}

StabilityMatrix.Avalonia/ViewModels/OutputsPageViewModel.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public async Task ConsolidateImages()
460460
{
461461
Text = Resources.Label_ConsolidateExplanation,
462462
TextWrapping = TextWrapping.Wrap,
463-
Margin = new Thickness(0, 8, 0, 16)
463+
Margin = new Thickness(0, 8, 0, 16),
464464
}
465465
);
466466
foreach (var category in Categories)
@@ -476,7 +476,7 @@ public async Task ConsolidateImages()
476476
Content = $"{category.Name} ({category.Path})",
477477
IsChecked = true,
478478
Margin = new Thickness(0, 8, 0, 0),
479-
Tag = category.Path
479+
Tag = category.Path,
480480
}
481481
);
482482
}
@@ -602,7 +602,14 @@ private void GetOutputs(string directory)
602602

603603
var files = Directory
604604
.EnumerateFiles(directory, "*", EnumerationOptionConstants.AllDirectories)
605-
.Where(file => allowedExtensions.Contains(new FilePath(file).Extension))
605+
.Where(file =>
606+
allowedExtensions.Contains(new FilePath(file).Extension)
607+
&& new FilePath(file).Info.DirectoryName?.EndsWith(
608+
"thumbnails",
609+
StringComparison.OrdinalIgnoreCase
610+
)
611+
is false
612+
)
606613
.Select(file => LocalImageFile.FromPath(file))
607614
.ToList();
608615

@@ -647,24 +654,17 @@ private void RefreshCategories()
647654
.Settings.InstalledPackages.Where(x => !x.UseSharedOutputFolder)
648655
.Select(packageFactory.GetPackagePair)
649656
.WhereNotNull()
650-
.Where(
651-
p =>
652-
p.BasePackage.SharedOutputFolders is { Count: > 0 } && p.InstalledPackage.FullPath != null
653-
)
654-
.Select(
655-
pair =>
656-
new TreeViewDirectory
657-
{
658-
Path = Path.Combine(
659-
pair.InstalledPackage.FullPath!,
660-
pair.BasePackage.OutputFolderName
661-
),
662-
Name = pair.InstalledPackage.DisplayName ?? "",
663-
SubDirectories = GetSubfolders(
664-
Path.Combine(pair.InstalledPackage.FullPath!, pair.BasePackage.OutputFolderName)
665-
)
666-
}
657+
.Where(p =>
658+
p.BasePackage.SharedOutputFolders is { Count: > 0 } && p.InstalledPackage.FullPath != null
667659
)
660+
.Select(pair => new TreeViewDirectory
661+
{
662+
Path = Path.Combine(pair.InstalledPackage.FullPath!, pair.BasePackage.OutputFolderName),
663+
Name = pair.InstalledPackage.DisplayName ?? "",
664+
SubDirectories = GetSubfolders(
665+
Path.Combine(pair.InstalledPackage.FullPath!, pair.BasePackage.OutputFolderName)
666+
),
667+
})
668668
.ToList();
669669

670670
packageCategories.Insert(
@@ -673,7 +673,7 @@ private void RefreshCategories()
673673
{
674674
Path = settingsManager.ImagesDirectory,
675675
Name = "Shared Output Folder",
676-
SubDirectories = GetSubfolders(settingsManager.ImagesDirectory)
676+
SubDirectories = GetSubfolders(settingsManager.ImagesDirectory),
677677
}
678678
);
679679

StabilityMatrix.Core/Helper/HardwareInfo/HardwareHelper.cs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private static IEnumerable<GpuInfo> IterGpuInfoWindows()
7070
[SupportedOSPlatform("linux")]
7171
private static IEnumerable<GpuInfo> IterGpuInfoLinux()
7272
{
73-
var output = RunBashCommand("lspci | grep VGA");
73+
var output = RunBashCommand("lspci | grep -E \"(VGA|3D)\"");
7474
var gpuLines = output.Split("\n");
7575

7676
var gpuIndex = 0;
@@ -153,15 +153,26 @@ public static IEnumerable<GpuInfo> IterGpuInfo(bool forceRefresh = false)
153153
return cachedGpuInfos;
154154
}
155155

156-
if (Compat.IsWindows)
156+
if (Compat.IsMacOS)
157+
{
158+
return cachedGpuInfos = IterGpuInfoMacos().ToList();
159+
}
160+
161+
if (Compat.IsLinux || Compat.IsWindows)
157162
{
158163
try
159164
{
160165
var smi = IterGpuInfoNvidiaSmi()?.ToList();
166+
var fallback = Compat.IsLinux
167+
? IterGpuInfoLinux().ToList()
168+
: IterGpuInfoWindows().ToList();
169+
161170
if (smi is null)
162-
return cachedGpuInfos = IterGpuInfoWindows().ToList();
171+
{
172+
return cachedGpuInfos = fallback;
173+
}
163174

164-
var newList = smi.Concat(IterGpuInfoWindows().Where(gpu => !gpu.IsNvidia))
175+
var newList = smi.Concat(fallback.Where(gpu => !gpu.IsNvidia))
165176
.Select(
166177
(gpu, index) =>
167178
new GpuInfo
@@ -177,22 +188,15 @@ public static IEnumerable<GpuInfo> IterGpuInfo(bool forceRefresh = false)
177188
catch (Exception e)
178189
{
179190
Logger.Error(e, "Failed to get GPU info using nvidia-smi, falling back to registry");
180-
return cachedGpuInfos = IterGpuInfoWindows().ToList();
181-
}
182-
}
183191

184-
if (Compat.IsLinux)
185-
{
186-
return cachedGpuInfos = IterGpuInfoLinux().ToList();
187-
}
188-
189-
if (Compat.IsMacOS)
190-
{
191-
return cachedGpuInfos = IterGpuInfoMacos().ToList();
192+
var fallback = Compat.IsLinux
193+
? IterGpuInfoLinux().ToList()
194+
: IterGpuInfoWindows().ToList();
195+
return cachedGpuInfos = fallback;
196+
}
192197
}
193198

194199
Logger.Error("Unknown OS, returning empty GPU info list");
195-
196200
return cachedGpuInfos = [];
197201
}
198202
}

StabilityMatrix.Core/Models/Api/CivitModelFpType.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ public enum CivitModelFpType
1010
bf16,
1111
fp16,
1212
fp32,
13-
tf32
13+
tf32,
14+
fp8,
15+
nf4,
1416
}

StabilityMatrix.Core/Models/PackageModification/InstallSageAttentionStep.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ public async Task ExecuteAsync(IProgress<ProgressReport>? progress = null)
6060
sageWheelUrl =
6161
"https://github.com/woct0rdho/SageAttention/releases/download/v2.1.1-windows/sageattention-2.1.1+cu128torch2.7.0-cp310-cp310-win_amd64.whl";
6262
}
63+
else if (torchInfo.Version.Contains("2.7.1") && torchInfo.Version.Contains("cu128"))
64+
{
65+
sageWheelUrl =
66+
$"https://github.com/woct0rdho/SageAttention/releases/download/v2.2.0-windows/sageattention-2.2.0+cu128torch2.7.1-cp310-cp310-win_amd64.whl";
67+
}
68+
else if (torchInfo.Version.Contains("2.8.0") && torchInfo.Version.Contains("cu128"))
69+
{
70+
sageWheelUrl =
71+
$"https://github.com/woct0rdho/SageAttention/releases/download/v2.2.0-windows/sageattention-2.2.0+cu128torch2.8.0-cp310-cp310-win_amd64.whl";
72+
}
6373

6474
var pipArgs = new PipInstallArgs();
6575
if (IsBlackwellGpu)

StabilityMatrix.Core/Models/Packages/FluxGym.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ IPrerequisiteHelper prerequisiteHelper
4747
new SharedFolderLayoutRule
4848
{
4949
SourceTypes = [SharedFolderType.TextEncoders],
50-
TargetRelativePaths = ["models/clip"]
50+
TargetRelativePaths = ["models/clip"],
5151
},
5252
new SharedFolderLayoutRule
5353
{
5454
SourceTypes = [SharedFolderType.DiffusionModels],
55-
TargetRelativePaths = ["models/unet"]
55+
TargetRelativePaths = ["models/unet"],
5656
},
5757
new SharedFolderLayoutRule
5858
{
5959
SourceTypes = [SharedFolderType.VAE],
6060
TargetRelativePaths = ["models/vae"],
61-
}
62-
]
61+
},
62+
],
6363
};
6464

6565
public override Dictionary<SharedOutputType, IReadOnlyList<string>>? SharedOutputFolders => null;
@@ -115,16 +115,20 @@ await sdsRequirements.ReadAllTextAsync(cancellationToken).ConfigureAwait(false),
115115
await venvRunner.PipInstall(sdsPipArgs, onConsoleOutput).ConfigureAwait(false);
116116

117117
progress?.Report(new ProgressReport(-1f, "Installing requirements", isIndeterminate: true));
118+
119+
var isLegacyNvidiaGpu =
120+
SettingsManager.Settings.PreferredGpu?.IsLegacyNvidiaGpu() ?? HardwareHelper.HasLegacyNvidiaGpu();
121+
118122
var requirements = new FilePath(installLocation, "requirements.txt");
119123
var pipArgs = new PipInstallArgs()
120-
.AddArg("--pre")
121124
.WithTorch()
122125
.WithTorchVision()
123126
.WithTorchAudio()
124-
.WithTorchExtraIndex("cu121")
127+
.WithTorchExtraIndex(isLegacyNvidiaGpu ? "cu126" : "cu128")
128+
.AddArg("bitsandbytes>=0.46.0")
125129
.WithParsedFromRequirementsTxt(
126130
await requirements.ReadAllTextAsync(cancellationToken).ConfigureAwait(false),
127-
"torch"
131+
"torch$|bitsandbytes"
128132
);
129133

130134
if (installedPackage.PipOverrides != null)
@@ -163,7 +167,7 @@ void HandleConsoleOutput(ProcessOutput s)
163167
}
164168

165169
VenvRunner.RunDetached(
166-
[Path.Combine(installLocation, options.Command ?? LaunchCommand), ..options.Arguments],
170+
[Path.Combine(installLocation, options.Command ?? LaunchCommand), .. options.Arguments],
167171
HandleConsoleOutput,
168172
OnExit
169173
);

0 commit comments

Comments
 (0)