Browse Source

Fix denoise strength not being 1.0 for txt2img

pull/341/head
JT 11 months ago
parent
commit
81351d3a0f
  1. 4
      CHANGELOG.md
  2. 46
      StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs

4
CHANGELOG.md

@ -5,6 +5,10 @@ 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.7.4
### Fixed
- Fixed denoise strength in Inference Text to Image
## v2.7.3
### Added
- Added missing IPAdapter and CLIP Vision folder links for ComfyUI

46
StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs

@ -26,9 +26,7 @@ namespace StabilityMatrix.Avalonia.ViewModels.Inference;
[View(typeof(InferenceTextToImageView), IsPersistent = true)]
[ManagedService]
[Transient]
public class InferenceTextToImageViewModel
: InferenceGenerationViewModelBase,
IParametersLoadableState
public class InferenceTextToImageViewModel : InferenceGenerationViewModelBase, IParametersLoadableState
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@ -81,6 +79,7 @@ public class InferenceTextToImageViewModel
samplerCard.IsCfgScaleEnabled = true;
samplerCard.IsSamplerSelectionEnabled = true;
samplerCard.IsSchedulerSelectionEnabled = true;
samplerCard.DenoiseStrength = 1.0d;
});
PromptCardViewModel = vmFactory.Get<PromptCardViewModel>();
@ -162,22 +161,19 @@ public class InferenceTextToImageViewModel
/// <inheritdoc />
protected override IEnumerable<ImageSource> GetInputImages()
{
var samplerImages = SamplerCardViewModel.ModulesCardViewModel.Cards
var samplerImages = SamplerCardViewModel
.ModulesCardViewModel
.Cards
.OfType<IInputImageProvider>()
.SelectMany(m => m.GetInputImages());
var moduleImages = ModulesCardViewModel.Cards
.OfType<IInputImageProvider>()
.SelectMany(m => m.GetInputImages());
var moduleImages = ModulesCardViewModel.Cards.OfType<IInputImageProvider>().SelectMany(m => m.GetInputImages());
return samplerImages.Concat(moduleImages);
}
/// <inheritdoc />
protected override async Task GenerateImageImpl(
GenerateOverrides overrides,
CancellationToken cancellationToken
)
protected override async Task GenerateImageImpl(GenerateOverrides overrides, CancellationToken cancellationToken)
{
// Validate the prompts
if (!await PromptCardViewModel.ValidatePrompts())
@ -205,11 +201,7 @@ public class InferenceTextToImageViewModel
{
var seed = seedCard.Seed + i;
var buildPromptArgs = new BuildPromptEventArgs
{
Overrides = overrides,
SeedOverride = seed
};
var buildPromptArgs = new BuildPromptEventArgs { Overrides = overrides, SeedOverride = seed };
BuildPrompt(buildPromptArgs);
var generationArgs = new ImageGenerationEventArgs
@ -270,16 +262,12 @@ public class InferenceTextToImageViewModel
if (state.TryGetPropertyValue("HiresSampler", out var hiresSamplerState))
{
module
.GetCard<SamplerCardViewModel>()
.LoadStateFromJsonObject(hiresSamplerState!.AsObject());
module.GetCard<SamplerCardViewModel>().LoadStateFromJsonObject(hiresSamplerState!.AsObject());
}
if (state.TryGetPropertyValue("HiresUpscaler", out var hiresUpscalerState))
{
module
.GetCard<UpscalerCardViewModel>()
.LoadStateFromJsonObject(hiresUpscalerState!.AsObject());
module.GetCard<UpscalerCardViewModel>().LoadStateFromJsonObject(hiresUpscalerState!.AsObject());
}
});
@ -289,17 +277,17 @@ public class InferenceTextToImageViewModel
if (state.TryGetPropertyValue("Upscaler", out var upscalerState))
{
module
.GetCard<UpscalerCardViewModel>()
.LoadStateFromJsonObject(upscalerState!.AsObject());
module.GetCard<UpscalerCardViewModel>().LoadStateFromJsonObject(upscalerState!.AsObject());
}
});
// Add FreeU to sampler
SamplerCardViewModel.ModulesCardViewModel.AddModule<FreeUModule>(module =>
{
module.IsEnabled = state.GetPropertyValueOrDefault<bool>("IsFreeUEnabled");
});
SamplerCardViewModel
.ModulesCardViewModel
.AddModule<FreeUModule>(module =>
{
module.IsEnabled = state.GetPropertyValueOrDefault<bool>("IsFreeUEnabled");
});
}
base.LoadStateFromJsonObject(state);

Loading…
Cancel
Save