diff --git a/CHANGELOG.md b/CHANGELOG.md index 57ecec61..528a45d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2 ### Fixed - Fixed incorrect IPAdapter download links in the HuggingFace model browser - Fixed potential memory leak of transient controls (Inference Prompt and Output Image Viewer) not being garbage collected due to event subscriptions +- Fixed Batch Count seeds not being recorded properly in Inference projects and image metadata ## v2.11.5 ### Added diff --git a/StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs index 5d042da7..f6278fcf 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs @@ -242,13 +242,23 @@ CancellationToken cancellationToken var buildPromptArgs = new BuildPromptEventArgs { Overrides = overrides, SeedOverride = seed }; BuildPrompt(buildPromptArgs); + // update seed in project for batches + var inferenceProject = InferenceProjectDocument.FromLoadable(this); + if (inferenceProject.State?["Seed"]?["Seed"] is not null) + { + inferenceProject = inferenceProject.WithState(x => x["Seed"]["Seed"] = seed); + } + var generationArgs = new ImageGenerationEventArgs { Client = ClientManager.Client, Nodes = buildPromptArgs.Builder.ToNodeDictionary(), OutputNodeNames = buildPromptArgs.Builder.Connections.OutputNodeNames.ToArray(), - Parameters = SaveStateToParameters(new GenerationParameters()), - Project = InferenceProjectDocument.FromLoadable(this), + Parameters = SaveStateToParameters(new GenerationParameters()) with + { + Seed = Convert.ToUInt64(seed) + }, + Project = inferenceProject, FilesToTransfer = buildPromptArgs.FilesToTransfer, BatchIndex = i, // Only clear output images on the first batch