Skip to content

Commit

Permalink
Merge pull request LykosAI#753 from ionite34/fix-batch-seed
Browse files Browse the repository at this point in the history
Fix batch count seed increments not being recorded in project or image metadata
  • Loading branch information
mohnjiles authored Aug 5, 2024
2 parents fd1da21 + 419e617 commit 6b46cb5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b46cb5

Please sign in to comment.