Skip to content

Commit ca33cf6

Browse files
authored
Merge pull request LykosAI#1197 from ionite34/downmerg-public
2 parents f4b4a53 + 3e694b9 commit ca33cf6

File tree

8 files changed

+62
-35
lines changed

8 files changed

+62
-35
lines changed

StabilityMatrix.Avalonia/ViewModels/Base/InferenceGenerationViewModelBase.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected async Task<FilePath> WriteOutputImageAsync(
143143
{
144144
GenerationParameters = args.Parameters,
145145
ProjectType = args.Project?.ProjectType,
146-
ProjectName = ProjectFile?.NameWithoutExtension
146+
ProjectName = ProjectFile?.NameWithoutExtension,
147147
};
148148

149149
// Parse to format
@@ -260,7 +260,7 @@ public async Task RunCustomGeneration(
260260
Project = InferenceProjectDocument.FromLoadable(this),
261261
FilesToTransfer = args.FilesToTransfer,
262262
Parameters = new GenerationParameters(),
263-
ClearOutputImages = true
263+
ClearOutputImages = true,
264264
};
265265

266266
await RunGeneration(generationArgs, cancellationToken);
@@ -410,7 +410,7 @@ await notificationService.ShowAsync(
410410
{
411411
Title = "Prompt Completed",
412412
Body = $"Prompt [{promptTask.Id[..7].ToLower()}] completed successfully",
413-
BodyImagePath = notificationImage?.FullPath
413+
BodyImagePath = notificationImage?.FullPath,
414414
}
415415
);
416416
}
@@ -521,14 +521,14 @@ private async Task<List<ImageSource>> ProcessOutputImages(
521521
var opts = new JsonSerializerOptions
522522
{
523523
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
524-
Converters = { new JsonStringEnumConverter() }
524+
Converters = { new JsonStringEnumConverter() },
525525
};
526526
var paramsJson = JsonSerializer.Serialize(parameters, opts);
527527
var smProject = JsonSerializer.Serialize(project, opts);
528528
var metadata = new Dictionary<ExifTag, string>
529529
{
530530
{ ExifTag.ImageDescription, paramsJson },
531-
{ ExifTag.Software, smProject }
531+
{ ExifTag.Software, smProject },
532532
};
533533

534534
var bytesWithMetadata = ImageMetadata.AddMetadataToWebp(imageArray, metadata);
@@ -779,7 +779,7 @@ out var localSemVersion
779779
{
780780
ShowDialogOnStart = true,
781781
ModificationCompleteTitle = "Extensions Installed",
782-
ModificationCompleteMessage = "Finished installing required extensions"
782+
ModificationCompleteMessage = "Finished installing required extensions",
783783
};
784784
EventManager.Instance.OnPackageInstallProgressAdded(runner);
785785

@@ -859,8 +859,14 @@ private void AttachRunningNodeChangedHandler(ComfyTask comfyTask)
859859
/// </summary>
860860
protected virtual void OnRunningNodeChanged(object? sender, string? nodeName)
861861
{
862-
// Ignore if regular progress updates started
863-
if (sender is not ComfyTask { HasProgressUpdateStarted: false })
862+
var task = sender as ComfyTask;
863+
if (task == null)
864+
{
865+
return;
866+
}
867+
868+
// Ignore if regular progress updates started, unless the running node is different from the one reporting progress
869+
if (task.HasProgressUpdateStarted && task.LastProgressUpdate?.RunningNode == nodeName)
864870
{
865871
return;
866872
}
@@ -906,7 +912,7 @@ public ModuleApplyStepEventArgs ToModuleApplyStepEventArgs()
906912
{
907913
Builder = Builder,
908914
IsEnabledOverrides = overrides,
909-
FilesToTransfer = FilesToTransfer
915+
FilesToTransfer = FilesToTransfer,
910916
};
911917
}
912918

StabilityMatrix.Avalonia/ViewModels/Inference/InferenceWanImageToVideoViewModel.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,17 @@ RunningPackageService runningPackageService
3939
/// <inheritdoc />
4040
protected override void BuildPrompt(BuildPromptEventArgs args)
4141
{
42+
var applyArgs = args.ToModuleApplyStepEventArgs();
4243
var builder = args.Builder;
4344

4445
builder.Connections.Seed = args.SeedOverride switch
4546
{
4647
{ } seed => Convert.ToUInt64(seed),
47-
_ => Convert.ToUInt64(SeedCardViewModel.Seed)
48+
_ => Convert.ToUInt64(SeedCardViewModel.Seed),
4849
};
4950

5051
// Load models
51-
ModelCardViewModel.ApplyStep(args);
52+
ModelCardViewModel.ApplyStep(applyArgs);
5253

5354
// Setup latent from image
5455
var imageLoad = builder.Nodes.AddTypedNode(
@@ -57,22 +58,24 @@ protected override void BuildPrompt(BuildPromptEventArgs args)
5758
Name = builder.Nodes.GetUniqueName("ControlNet_LoadImage"),
5859
Image =
5960
SelectImageCardViewModel.ImageSource?.GetHashGuidFileNameCached("Inference")
60-
?? throw new ValidationException()
61+
?? throw new ValidationException(),
6162
}
6263
);
6364
builder.Connections.Primary = imageLoad.Output1;
6465
builder.Connections.PrimarySize = SelectImageCardViewModel.CurrentBitmapSize;
6566

66-
BatchSizeCardViewModel.ApplyStep(args);
67+
BatchSizeCardViewModel.ApplyStep(applyArgs);
6768

68-
SelectImageCardViewModel.ApplyStep(args);
69+
SelectImageCardViewModel.ApplyStep(applyArgs);
6970

70-
PromptCardViewModel.ApplyStep(args);
71+
PromptCardViewModel.ApplyStep(applyArgs);
7172

72-
SamplerCardViewModel.ApplyStep(args);
73+
SamplerCardViewModel.ApplyStep(applyArgs);
74+
75+
applyArgs.InvokeAllPreOutputActions();
7376

7477
// Animated webp output
75-
VideoOutputSettingsCardViewModel.ApplyStep(args);
78+
VideoOutputSettingsCardViewModel.ApplyStep(applyArgs);
7679
}
7780

7881
/// <inheritdoc />

StabilityMatrix.Avalonia/ViewModels/Inference/InferenceWanTextToVideoViewModel.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ RunningPackageService runningPackageService
5959
samplerCard.IsSamplerSelectionEnabled = true;
6060
samplerCard.IsSchedulerSelectionEnabled = true;
6161
samplerCard.DenoiseStrength = 1.0d;
62-
samplerCard.EnableAddons = false;
62+
samplerCard.EnableAddons = true;
6363
samplerCard.IsLengthEnabled = true;
6464
samplerCard.Width = 832;
6565
samplerCard.Height = 480;
@@ -70,8 +70,8 @@ RunningPackageService runningPackageService
7070

7171
BatchSizeCardViewModel = vmFactory.Get<BatchSizeCardViewModel>();
7272

73-
VideoOutputSettingsCardViewModel = vmFactory.Get<VideoOutputSettingsCardViewModel>(
74-
vm => vm.Fps = 16.0d
73+
VideoOutputSettingsCardViewModel = vmFactory.Get<VideoOutputSettingsCardViewModel>(vm =>
74+
vm.Fps = 16.0d
7575
);
7676

7777
StackCardViewModel = vmFactory.Get<StackCardViewModel>();
@@ -89,16 +89,17 @@ protected override void BuildPrompt(BuildPromptEventArgs args)
8989
{
9090
base.BuildPrompt(args);
9191

92+
var applyArgs = args.ToModuleApplyStepEventArgs();
9293
var builder = args.Builder;
9394

9495
builder.Connections.Seed = args.SeedOverride switch
9596
{
9697
{ } seed => Convert.ToUInt64(seed),
97-
_ => Convert.ToUInt64(SeedCardViewModel.Seed)
98+
_ => Convert.ToUInt64(SeedCardViewModel.Seed),
9899
};
99100

100101
// Load models
101-
ModelCardViewModel.ApplyStep(args);
102+
ModelCardViewModel.ApplyStep(applyArgs);
102103

103104
builder.SetupEmptyLatentSource(
104105
SamplerCardViewModel.Width,
@@ -109,14 +110,16 @@ protected override void BuildPrompt(BuildPromptEventArgs args)
109110
LatentType.Hunyuan
110111
);
111112

112-
BatchSizeCardViewModel.ApplyStep(args);
113+
BatchSizeCardViewModel.ApplyStep(applyArgs);
113114

114-
PromptCardViewModel.ApplyStep(args);
115+
PromptCardViewModel.ApplyStep(applyArgs);
115116

116-
SamplerCardViewModel.ApplyStep(args);
117+
SamplerCardViewModel.ApplyStep(applyArgs);
118+
119+
applyArgs.InvokeAllPreOutputActions();
117120

118121
// Animated webp output
119-
VideoOutputSettingsCardViewModel.ApplyStep(args);
122+
VideoOutputSettingsCardViewModel.ApplyStep(applyArgs);
120123
}
121124

122125
/// <inheritdoc />
@@ -165,13 +168,13 @@ CancellationToken cancellationToken
165168
OutputNodeNames = buildPromptArgs.Builder.Connections.OutputNodeNames.ToArray(),
166169
Parameters = SaveStateToParameters(new GenerationParameters()) with
167170
{
168-
Seed = Convert.ToUInt64(seed)
171+
Seed = Convert.ToUInt64(seed),
169172
},
170173
Project = inferenceProject,
171174
FilesToTransfer = buildPromptArgs.FilesToTransfer,
172175
BatchIndex = i,
173176
// Only clear output images on the first batch
174-
ClearOutputImages = i == 0
177+
ClearOutputImages = i == 0,
175178
};
176179

177180
batchArgs.Add(generationArgs);

StabilityMatrix.Avalonia/ViewModels/Inference/WanSamplerCardViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.Linq;
23
using Injectio.Attributes;
34
using StabilityMatrix.Avalonia.Controls;
45
using StabilityMatrix.Avalonia.Models.Inference;
56
using StabilityMatrix.Avalonia.Services;
67
using StabilityMatrix.Avalonia.ViewModels.Base;
8+
using StabilityMatrix.Avalonia.ViewModels.Inference.Modules;
79
using StabilityMatrix.Core.Attributes;
810
using StabilityMatrix.Core.Extensions;
911
using StabilityMatrix.Core.Models.Api.Comfy;
@@ -34,6 +36,14 @@ TabContext tabContext
3436

3537
public override void ApplyStep(ModuleApplyStepEventArgs e)
3638
{
39+
if (EnableAddons)
40+
{
41+
foreach (var module in ModulesCardViewModel.Cards.OfType<ModuleBase>())
42+
{
43+
module.ApplyStep(e);
44+
}
45+
}
46+
3747
// Set primary sampler and scheduler
3848
var primarySampler = SelectedSampler ?? throw new ValidationException("Sampler not selected");
3949
e.Builder.Connections.PrimarySampler = primarySampler;

StabilityMatrix.Core/Models/Api/Comfy/Nodes/ComfyNodeBuilder.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.ComponentModel.DataAnnotations;
33
using System.Diagnostics.CodeAnalysis;
44
using System.Drawing;
5+
using System.Text.Json.Serialization;
56
using OneOf;
67
using StabilityMatrix.Core.Attributes;
78
using StabilityMatrix.Core.Extensions;
@@ -67,17 +68,21 @@ public record TiledVAEDecode : ComfyTypedNodeBase<ImageNodeConnection>
6768
{
6869
public required LatentNodeConnection Samples { get; init; }
6970
public required VAENodeConnection Vae { get; init; }
70-
71+
7172
[Range(64, 4096)]
73+
[JsonPropertyName("tile_size")]
7274
public int TileSize { get; init; } = 512;
73-
75+
7476
[Range(0, 4096)]
77+
[JsonPropertyName("overlap")]
7578
public int Overlap { get; init; } = 64;
76-
79+
7780
[Range(8, 4096)]
81+
[JsonPropertyName("temporal_size")]
7882
public int TemporalSize { get; init; } = 64;
79-
83+
8084
[Range(4, 4096)]
85+
[JsonPropertyName("temporal_overlap")]
8186
public int TemporalOverlap { get; init; } = 8;
8287
}
8388

StabilityMatrix.Core/Models/Packages/ComfyUI.cs

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

StabilityMatrix.Core/Models/Packages/SDWebForge.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ torchIndex is TorchIndex.Cuda
194194
TorchVersion = "",
195195
TorchvisionVersion = "",
196196
CudaIndex = isBlackwell ? "cu128" : "cu126",
197-
RocmIndex = "rocm6.4",
197+
RocmIndex = "rocm7.1",
198198
ExtraPipArgs =
199199
[
200200
"https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip",

StabilityMatrix.Tests/Models/Packages/PackageLinkTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public sealed class PackageLinkTests
1717
new() { DefaultRequestHeaders = { { "User-Agent", "StabilityMatrix/2.0" } } };
1818

1919
private static IEnumerable<object[]> PackagesData =>
20-
PackageHelper.GetPackages().Select(p => new object[] { p });
20+
PackageHelper.GetPackages().Where(x => x is not ComfyZluda).Select(p => new object[] { p });
2121

2222
private static readonly AsyncRetryPolicy<HttpResponseMessage> RetryPolicy = Policy<HttpResponseMessage>
2323
.HandleResult(response => response.StatusCode == System.Net.HttpStatusCode.TooManyRequests)

0 commit comments

Comments
 (0)