Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.11.6 #810

Merged
merged 22 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
491c9e7
Merge pull request #738 from ionite34/settings-relay
ionite34 Jul 30, 2024
e11074e
Merge pull request #743 from ionite34/downmerge
mohnjiles Aug 2, 2024
dbc1898
Merge branch 'main' into backport/main/pr-738
ionite34 Aug 2, 2024
194592d
fix ip adapter links in huggingface browser
mohnjiles Aug 2, 2024
b22ec12
Merge pull request #747 from ionite34/backport-ip-adapter-link-fixes
mohnjiles Aug 2, 2024
f9233bb
Merge pull request #750 from ionite34/disposables-improvement
ionite34 Aug 3, 2024
7620d58
Merge branch 'main' into backport/main/pr-738
ionite34 Aug 3, 2024
bf7f0b8
Merge pull request #739 from ionite34/backport/main/pr-738
ionite34 Aug 3, 2024
55fbf12
Fix backport merge
ionite34 Aug 3, 2024
267a604
Fix formatting
ionite34 Aug 3, 2024
eaa88d5
Fix merge
ionite34 Aug 3, 2024
d92b5f9
Fix merge
ionite34 Aug 3, 2024
c99f9a1
Actually fix merge
ionite34 Aug 4, 2024
861b6d8
Missing usings
ionite34 Aug 4, 2024
d55886a
Merge branch 'main' into backport/main/pr-750
ionite34 Aug 4, 2024
79dd805
Merge pull request #751 from ionite34/backport/main/pr-750
ionite34 Aug 4, 2024
59557c8
Merge pull request #753 from ionite34/fix-batch-seed
mohnjiles Aug 5, 2024
5644f30
Merge pull request #755 from ionite34/backport/main/pr-753
mohnjiles Aug 5, 2024
9ded82d
Merge pull request #758 from ionite34/fix-swarm-args
mohnjiles Aug 8, 2024
86db8db
Merge pull request #759 from ionite34/backport/main/pr-758
mohnjiles Aug 8, 2024
2144816
Merge pull request #762 from ionite34/fix-swarm-env-vars
mohnjiles Aug 9, 2024
21f51a2
Merge pull request #763 from ionite34/backport/main/pr-762
mohnjiles Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to Stability Matrix will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html).

## v2.11.6
### 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
- Fixed [#795](https://github.com/LykosAI/StabilityMatrix/issues/795) - SwarmUI launch args not working properly
- Fixed [#745](https://github.com/LykosAI/StabilityMatrix/issues/745) - not passing Environment Variables to SwarmUI
### Supporters
#### Visionaries
- Shoutout to our Visionary-tier Patreon supporter, **Scopp Mcdee**! Huge thanks for your continued support!
#### Pioneers
- Many thanks to our Pioneer-tier supporters on Patreon: **tankfox**, **tanangular**, **Mr. Unknown**, and **Szir777**! Your continued support is greatly appreciated!

## v2.11.5
### Added
Expand Down
27 changes: 7 additions & 20 deletions StabilityMatrix.Avalonia/Assets/hf-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,19 +390,16 @@
"ModelName": "SD 1.5 Adapter",
"RepositoryPath": "InvokeAI/ip_adapter_sd15",
"Files": [
"image_encoder.txt",
"ip_adapter.bin"
"ip-adapter_sd15.safetensors"
],
"Subfolder": "ip_adapter_sd15",
"LicenseType": "Apache 2.0"
},
{
"ModelCategory": "DiffusersIpAdapter",
"ModelName": "SD 1.5 Light Adapter",
"RepositoryPath": "InvokeAI/ip_adapter_sd15_light",
"Files": [
"image_encoder.txt",
"ip_adapter.bin"
"ip-adapter_sd15_light.safetensors"
],
"Subfolder": "ip_adapter_sd15_light",
"LicenseType": "Apache 2.0"
Expand All @@ -412,54 +409,44 @@
"ModelName": "SD 1.5 Plus Adapter",
"RepositoryPath": "InvokeAI/ip_adapter_plus_sd15",
"Files": [
"image_encoder.txt",
"ip_adapter.bin"
"ip-adapter-plus_sd15.safetensors"
],
"Subfolder": "ip_adapter_plus_sd15",
"LicenseType": "Apache 2.0"
},
{
"ModelCategory": "DiffusersIpAdapter",
"ModelName": "SD 1.5 Face Plus Adapter",
"RepositoryPath": "InvokeAI/ip_adapter_plus_face_sd15",
"Files": [
"image_encoder.txt",
"ip_adapter.bin"
"ip-adapter-plus-face_sd15.safetensors"
],
"Subfolder": "ip_adapter_plus_face_sd15",
"LicenseType": "Apache 2.0"
},
{
"ModelCategory": "DiffusersIpAdapterXl",
"ModelName": "SDXL Adapter",
"RepositoryPath": "InvokeAI/ip_adapter_sdxl",
"Files": [
"image_encoder.txt",
"ip_adapter.bin"
"ip-adapter_sdxl.safetensors"
],
"Subfolder": "ip_adapter_sdxl",
"LicenseType": "Apache 2.0"
},
{
"ModelCategory": "DiffusersIpAdapterXl",
"ModelName": "SDXL Plus Adapter",
"RepositoryPath": "InvokeAI/ip-adapter-plus_sdxl_vit-h",
"Files": [
"image_encoder.txt",
"ip_adapter.bin"
"ip-adapter-plus_sdxl_vit-h.safetensors"
],
"Subfolder": "ip_adapter_plus_sdxl_vit-h",
"LicenseType": "Apache 2.0"
},
{
"ModelCategory": "DiffusersIpAdapterXl",
"ModelName": "SDXL Face Plus Adapter",
"RepositoryPath": "InvokeAI/ip-adapter-plus-face_sdxl_vit-h",
"Files": [
"image_encoder.txt",
"ip_adapter.bin"
"ip-adapter-plus-face_sdxl_vit-h.safetensors"
],
"Subfolder": "ip_adapter_plus_face_sdxl_vit-h",
"LicenseType": "CreativeML Open RAIL-M"
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Reactive.Disposables;
using JetBrains.Annotations;

namespace StabilityMatrix.Avalonia.ViewModels.Base;

public abstract class DisposableLoadableViewModelBase : LoadableViewModelBase, IDisposable
{
private readonly CompositeDisposable instanceDisposables = new();

/// <summary>
/// Adds a disposable to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposable">The disposable to add.</param>
protected void AddDisposable([HandlesResourceDisposal] IDisposable disposable)
{
instanceDisposables.Add(disposable);
}

/// <summary>
/// Adds disposables to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposables">The disposables to add.</param>
protected void AddDisposable([HandlesResourceDisposal] params IDisposable[] disposables)
{
foreach (var disposable in disposables)
{
instanceDisposables.Add(disposable);
}
}

/// <summary>
/// Adds a disposable to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposable">The disposable to add.</param>
/// <typeparam name="T">The type of the disposable.</typeparam>
/// <returns>The disposable that was added.</returns>
protected T AddDisposable<T>([HandlesResourceDisposal] T disposable)
where T : IDisposable
{
instanceDisposables.Add(disposable);
return disposable;
}

/// <summary>
/// Adds disposables to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposables">The disposables to add.</param>
/// <typeparam name="T">The type of the disposables.</typeparam>
/// <returns>The disposables that were added.</returns>
protected T[] AddDisposable<T>([HandlesResourceDisposal] params T[] disposables)
where T : IDisposable
{
foreach (var disposable in disposables)
{
instanceDisposables.Add(disposable);
}

return disposables;
}

protected virtual void Dispose(bool disposing)
{
if (disposing)
{
instanceDisposables.Dispose();
}
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Reactive.Disposables;
using JetBrains.Annotations;

namespace StabilityMatrix.Avalonia.ViewModels.Base;

public abstract class DisposableViewModelBase : ViewModelBase, IDisposable
{
private readonly CompositeDisposable instanceDisposables = new();

/// <summary>
/// Adds a disposable to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposable">The disposable to add.</param>
protected void AddDisposable([HandlesResourceDisposal] IDisposable disposable)
{
instanceDisposables.Add(disposable);
}

/// <summary>
/// Adds disposables to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposables">The disposables to add.</param>
protected void AddDisposable([HandlesResourceDisposal] params IDisposable[] disposables)
{
foreach (var disposable in disposables)
{
instanceDisposables.Add(disposable);
}
}

/// <summary>
/// Adds a disposable to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposable">The disposable to add.</param>
/// <typeparam name="T">The type of the disposable.</typeparam>
/// <returns>The disposable that was added.</returns>
protected T AddDisposable<T>([HandlesResourceDisposal] T disposable)
where T : IDisposable
{
instanceDisposables.Add(disposable);
return disposable;
}

/// <summary>
/// Adds disposables to be disposed when this view model is disposed.
/// </summary>
/// <param name="disposables">The disposables to add.</param>
/// <typeparam name="T">The type of the disposables.</typeparam>
/// <returns>The disposables that were added.</returns>
protected T[] AddDisposable<T>([HandlesResourceDisposal] params T[] disposables)
where T : IDisposable
{
foreach (var disposable in disposables)
{
instanceDisposables.Add(disposable);
}

return disposables;
}

protected virtual void Dispose(bool disposing)
{
if (disposing)
{
instanceDisposables.Dispose();
}
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ RunningPackageService runningPackageService
ClientManager = inferenceClientManager;

ImageGalleryCardViewModel = vmFactory.Get<ImageGalleryCardViewModel>();
ImageFolderCardViewModel = vmFactory.Get<ImageFolderCardViewModel>();
ImageFolderCardViewModel = AddDisposable(vmFactory.Get<ImageFolderCardViewModel>());

GenerateImageCommand.WithConditionalNotificationErrorHandler(notificationService);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
namespace StabilityMatrix.Avalonia.ViewModels.Base;

public abstract partial class InferenceTabViewModelBase
: LoadableViewModelBase,
IDisposable,
: DisposableLoadableViewModelBase,
IPersistentViewProvider,
IDropTarget
{
Expand Down Expand Up @@ -158,21 +157,16 @@ private async Task DebugLoadViewState()
}
}

protected virtual void Dispose(bool disposing)
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (disposing)
{
((IPersistentViewProvider)this).AttachedPersistentView = null;
}
}

/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

/// <summary>
/// Loads image and metadata from a file path
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace StabilityMatrix.Avalonia.ViewModels.Inference;
[View(typeof(ImageFolderCard))]
[ManagedService]
[Transient]
public partial class ImageFolderCardViewModel : ViewModelBase
public partial class ImageFolderCardViewModel : DisposableViewModelBase
{
private readonly ILogger<ImageFolderCardViewModel> logger;
private readonly IImageIndexService imageIndexService;
Expand Down Expand Up @@ -83,11 +83,13 @@ INotificationService notificationService
.Bind(LocalImages)
.Subscribe();

settingsManager.RelayPropertyFor(
this,
vm => vm.ImageSize,
settings => settings.InferenceImageSize,
delay: TimeSpan.FromMilliseconds(250)
AddDisposable(
settingsManager.RelayPropertyFor(
this,
vm => vm.ImageSize,
settings => settings.InferenceImageSize,
delay: TimeSpan.FromMilliseconds(250)
)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ RunningPackageService runningPackageService
samplerCard.DenoiseStrength = 1.0d;
});

PromptCardViewModel = vmFactory.Get<PromptCardViewModel>();
PromptCardViewModel = AddDisposable(vmFactory.Get<PromptCardViewModel>());

BatchSizeCardViewModel = vmFactory.Get<BatchSizeCardViewModel>();

ModulesCardViewModel = vmFactory.Get<StackEditableCardViewModel>(modulesCard =>
Expand All @@ -108,13 +109,15 @@ RunningPackageService runningPackageService
);

// When refiner is provided in model card, enable for sampler
ModelCardViewModel
.WhenPropertyChanged(x => x.IsRefinerSelectionEnabled)
.Subscribe(e =>
{
SamplerCardViewModel.IsRefinerStepsEnabled =
e.Sender is { IsRefinerSelectionEnabled: true, SelectedRefiner: not null };
});
AddDisposable(
ModelCardViewModel
.WhenPropertyChanged(x => x.IsRefinerSelectionEnabled)
.Subscribe(e =>
{
SamplerCardViewModel.IsRefinerStepsEnabled =
e.Sender is { IsRefinerSelectionEnabled: true, SelectedRefiner: not null };
})
);
}

/// <inheritdoc />
Expand Down Expand Up @@ -211,13 +214,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
Loading
Loading