Skip to content

Commit 6dcb5f6

Browse files
committed
Updated comfy rocm index and addressed pr feedback
1 parent ce9cf5f commit 6dcb5f6

6 files changed

Lines changed: 68 additions & 99 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
1111
- Added Next and Previous buttons to the Civitai details page to navigate between results
1212
### Changed
1313
- Brought back the "size remaining after download" tooltip in the new Civitai details page
14+
- Updated ComfyUI installs for AMD users on Linux to use the latest rocm6.4 torch index
1415
### Fixed
1516
- Fixed Inference custom step (e.g. HiresFix) Samplers potentially sharing state with other card UIs like model browser.
1617
- Fixed extension manager failing to install extensions due to incorrect clone directory

StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CivitDetailsPageViewModel.cs

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -731,43 +731,37 @@ private async Task DeleteModelVersion(CivitModelVersion modelVersion)
731731
}
732732

733733
[RelayCommand]
734-
public async Task NextModel()
735-
{
736-
if (!CanGoNext)
737-
return;
738-
739-
try
740-
{
741-
var modelId = ModelIdList[++CurrentIndex];
742-
CivitModel = await civitApi.GetModelById(modelId);
743-
ReloadCachesForNewModel();
744-
}
745-
catch (Exception e)
746-
{
747-
logger.LogError(e, "Failed to load CivitModel {Id}", CivitModel.Id);
748-
notificationService.Show(
749-
Resources.Label_UnexpectedErrorOccurred,
750-
e.Message,
751-
NotificationType.Error
752-
);
753-
}
754-
}
734+
public Task NextModel() => CanGoNext ? NavigateToModelByIndexOffset(1) : Task.CompletedTask;
755735

756736
[RelayCommand]
757-
public async Task PreviousModel()
737+
public Task PreviousModel() => CanGoPrevious ? NavigateToModelByIndexOffset(-1) : Task.CompletedTask;
738+
739+
private async Task NavigateToModelByIndexOffset(int offset)
758740
{
759-
if (!CanGoPrevious)
760-
return;
741+
var newIndex = CurrentIndex + offset;
742+
var modelId = ModelIdList[newIndex];
761743

762744
try
763745
{
764-
var modelId = ModelIdList[--CurrentIndex];
765-
CivitModel = await civitApi.GetModelById(modelId);
766-
ReloadCachesForNewModel();
746+
var newModel = await civitApi.GetModelById(modelId);
747+
CivitModel = newModel;
748+
CurrentIndex = newIndex;
749+
750+
// reload caches for new model
751+
modelVersionCache.EditDiff(CivitModel.ModelVersions ?? [], (a, b) => a.Id == b.Id);
752+
SelectedVersion = ModelVersions.FirstOrDefault();
753+
754+
imageCache.EditDiff(SelectedVersion?.ModelVersion.Images ?? [], (a, b) => a.Url == b.Url);
755+
civitFileCache.EditDiff(SelectedVersion?.ModelVersion.Files ?? [], (a, b) => a.Id == b.Id);
756+
757+
Description = $"""<html><body class="markdown-body">{CivitModel.Description}</body></html>""";
758+
ModelVersionDescription = string.IsNullOrWhiteSpace(SelectedVersion?.ModelVersion.Description)
759+
? string.Empty
760+
: $"""<html><body class="markdown-body">{SelectedVersion.ModelVersion.Description}</body></html>""";
767761
}
768762
catch (Exception e)
769763
{
770-
logger.LogError(e, "Failed to load CivitModel {Id}", CivitModel.Id);
764+
logger.LogError(e, "Failed to load CivitModel {Id}", modelId);
771765
notificationService.Show(
772766
Resources.Label_UnexpectedErrorOccurred,
773767
e.Message,
@@ -776,20 +770,6 @@ public async Task PreviousModel()
776770
}
777771
}
778772

779-
private void ReloadCachesForNewModel()
780-
{
781-
modelVersionCache.EditDiff(CivitModel.ModelVersions ?? [], (a, b) => a.Id == b.Id);
782-
SelectedVersion = ModelVersions.FirstOrDefault();
783-
784-
imageCache.EditDiff(SelectedVersion?.ModelVersion.Images ?? [], (a, b) => a.Url == b.Url);
785-
civitFileCache.EditDiff(SelectedVersion?.ModelVersion.Files ?? [], (a, b) => a.Id == b.Id);
786-
787-
Description = $"""<html><body class="markdown-body">{CivitModel.Description}</body></html>""";
788-
ModelVersionDescription = string.IsNullOrWhiteSpace(SelectedVersion?.ModelVersion.Description)
789-
? string.Empty
790-
: $"""<html><body class="markdown-body">{SelectedVersion.ModelVersion.Description}</body></html>""";
791-
}
792-
793773
private void VmOnNavigateToModelRequested(object? sender, int modelId)
794774
{
795775
if (sender is not ImageViewerViewModel vm)

StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -609,61 +609,39 @@ private async Task ShowVersionDialog(CheckpointFileViewModel item)
609609
}
610610

611611
if (item.CheckpointFile.HasCivitMetadata)
612-
await ShowCivitVersionDialog(item);
612+
ShowCivitVersionDialog(item);
613613
else if (item.CheckpointFile.HasOpenModelDbMetadata)
614614
await ShowOpenModelDbDialog(item);
615615
}
616616

617-
private async Task ShowCivitVersionDialog(CheckpointFileViewModel item)
617+
private void ShowCivitVersionDialog(CheckpointFileViewModel item)
618618
{
619619
var model = item.CheckpointFile.LatestModelInfo;
620-
CivitDetailsPageViewModel newVm;
621-
if (model is null)
620+
if (item.CheckpointFile.ConnectedModelInfo?.ModelId == null)
622621
{
623-
if (item.CheckpointFile.ConnectedModelInfo?.ModelId == null)
624-
{
625-
notificationService.Show(
626-
"Model not found",
627-
"Model not found in index, please try again later.",
628-
NotificationType.Error
629-
);
630-
return;
631-
}
632-
633-
newVm = dialogFactory.Get<CivitDetailsPageViewModel>(vm =>
634-
{
635-
var allModelIds = Models
636-
.Where(x => x.CheckpointFile.ConnectedModelInfo?.ModelId != null)
637-
.Select(x => x.CheckpointFile.ConnectedModelInfo!.ModelId!.Value)
638-
.Distinct()
639-
.ToList();
640-
var index = Models.IndexOf(item);
641-
642-
vm.ModelIdList = allModelIds;
643-
vm.CurrentIndex = index;
644-
vm.CivitModel = new CivitModel { Id = item.CheckpointFile.ConnectedModelInfo.ModelId.Value };
645-
646-
return vm;
647-
});
622+
notificationService.Show(
623+
"Model not found",
624+
"Model not found in index, please try again later.",
625+
NotificationType.Error
626+
);
627+
return;
648628
}
649-
else
629+
630+
var allModelIds = Models
631+
.Where(x => x.CheckpointFile.ConnectedModelInfo?.ModelId != null)
632+
.Select(x => x.CheckpointFile.ConnectedModelInfo!.ModelId!.Value)
633+
.Distinct()
634+
.ToList();
635+
var index = Models.IndexOf(item);
636+
637+
var newVm = dialogFactory.Get<CivitDetailsPageViewModel>(vm =>
650638
{
651-
newVm = dialogFactory.Get<CivitDetailsPageViewModel>(vm =>
652-
{
653-
var allModelIds = Models
654-
.Where(x => x.CheckpointFile.ConnectedModelInfo?.ModelId != null)
655-
.Select(x => x.CheckpointFile.ConnectedModelInfo!.ModelId!.Value)
656-
.Distinct()
657-
.ToList();
658-
var index = Models.IndexOf(item);
659-
660-
vm.ModelIdList = allModelIds;
661-
vm.CurrentIndex = index;
662-
vm.CivitModel = model;
663-
664-
return vm;
665-
});
666-
}
639+
vm.CivitModel =
640+
model ?? new CivitModel { Id = item.CheckpointFile.ConnectedModelInfo.ModelId.Value };
641+
vm.ModelIdList = allModelIds;
642+
vm.CurrentIndex = index;
643+
return vm;
644+
});
667645

668646
navigationService.NavigateTo(newVm, BetterSlideNavigationTransition.PageSlideFromRight);
669647
}

StabilityMatrix.Avalonia/ViewModels/Dialogs/CivitFileViewModel.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public partial class CivitFileViewModel : DisposableViewModelBase
2222
private readonly ISettingsManager settingsManager;
2323
private readonly IServiceManager<ViewModelBase> vmFactory;
2424
private readonly Func<CivitFileViewModel, string?, Task>? downloadAction;
25+
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
2526

2627
[ObservableProperty]
2728
private CivitFile civitFile;
@@ -171,9 +172,7 @@ private async Task Delete()
171172
}
172173
catch (Exception e)
173174
{
174-
LogManager
175-
.GetCurrentClassLogger()
176-
.Error(e, "Failed to delete model files for {ModelName}", CivitFile.Name);
175+
Logger.Error(e, "Failed to delete model files for {ModelName}", CivitFile.Name);
177176
await modelIndexService.RefreshIndex();
178177
return;
179178
}

StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageExtensionBrowserViewModel.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -714,17 +714,28 @@ private async Task InstallExtensionManualAsync()
714714
if (string.IsNullOrWhiteSpace(url))
715715
return;
716716

717-
// check if have enough parts
718-
if (url.Split('/').Length < 5)
717+
if (
718+
!Uri.TryCreate(url, UriKind.Absolute, out var uri)
719+
|| !uri.Host.Equals("github.com", StringComparison.OrdinalIgnoreCase)
720+
)
721+
{
722+
notificationService.Show("Invalid URL", "Please provide a valid GitHub repository URL.");
723+
return;
724+
}
725+
726+
var segments = uri.AbsolutePath.Split('/', StringSplitOptions.RemoveEmptyEntries);
727+
if (segments.Length < 2)
719728
{
720-
notificationService.Show("Invalid URL", "The provided URL does not contain enough information.");
729+
notificationService.Show(
730+
"Invalid URL",
731+
"The URL does not appear to be a valid GitHub repository."
732+
);
721733
return;
722734
}
723735

724-
// get the author from github url
725-
var author = url.Split('/')[3];
726-
// get the title from the url
727-
var title = url.Split('/')[4].Replace(".git", "");
736+
var author = segments[0];
737+
var title = segments[1].Replace(".git", "");
738+
728739
// create a new PackageExtension
729740
var packageExtension = new PackageExtension
730741
{

StabilityMatrix.Core/Models/Packages/ComfyUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public override async Task InstallPackage(
415415
TorchIndex.Cpu => "cpu",
416416
TorchIndex.Cuda when isLegacyNvidia => "cu126",
417417
TorchIndex.Cuda => "cu128",
418-
TorchIndex.Rocm => "rocm6.3",
418+
TorchIndex.Rocm => "rocm6.4",
419419
TorchIndex.Mps => "cpu",
420420
_ => throw new ArgumentOutOfRangeException(
421421
nameof(torchVersion),

0 commit comments

Comments
 (0)