Skip to content

Commit

Permalink
Merge pull request #852 from ionite34/backport/main/pr-851
Browse files Browse the repository at this point in the history
[dev to main] backport: Manually add comfy nf4 extension to manifest & update sampler/scheduler… (851)
  • Loading branch information
mohnjiles authored Oct 7, 2024
2 parents 2412a34 + 8c593ee commit 0454237
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ 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).

<<<<<<< HEAD
=======
## v2.13.0-dev.1
### Added
- Added the ability to change the Models directory separately from the rest of the Data directory. This can be set in `Settings > Select new Models Folder`
- Added "Copy" menu to the Inference gallery context menu, allowing you to copy the image or the seed (other params coming soon™️)
- Added InvokeAI model sharing option
### Supporters
#### Visionaries
- A heartfelt thank you to our incredible Visionary-tier Patreon supporter, **Waterclouds**! Your ongoing support means a lot to us, and we’re grateful to have you with us on this journey!

## v2.12.2
### Added
- Added Beta scheduler to the scheduler selector in Inference
### Fixed
- Fixed ComfyUI NF4 extension not installing properly when prompted in Inference

>>>>>>> 8c9b456c (Merge pull request #851 from ionite34/fix-nf4-sorta)
## v2.12.1
### Fixed
- Fixed [#916](https://github.com/LykosAI/StabilityMatrix/issues/916) - InvokeAI failing to install/update on macOS
Expand Down
2 changes: 2 additions & 0 deletions StabilityMatrix.Core/Helper/GenerationParametersConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static class GenerationParametersConverter
["Euler Simple"] = (ComfySampler.Euler, ComfyScheduler.Simple),
["LMS"] = (ComfySampler.LMS, ComfyScheduler.Normal),
["Heun"] = (ComfySampler.Heun, ComfyScheduler.Normal),
["Heun Beta"] = (ComfySampler.Heun, ComfyScheduler.Beta),
["DPM2"] = (ComfySampler.Dpm2, ComfyScheduler.Normal),
["DPM2 Karras"] = (ComfySampler.Dpm2, ComfyScheduler.Karras),
["DPM2 a"] = (ComfySampler.Dpm2Ancestral, ComfyScheduler.Normal),
Expand All @@ -34,6 +35,7 @@ public static class GenerationParametersConverter
["DPM adaptive"] = (ComfySampler.DpmAdaptive, ComfyScheduler.Normal),
["LMS Karras"] = (ComfySampler.LMS, ComfyScheduler.Karras),
["DDIM"] = (ComfySampler.DDIM, ComfyScheduler.Normal),
["DDIM Beta"] = (ComfySampler.DDIM, ComfyScheduler.Beta),
["UniPC"] = (ComfySampler.UniPC, ComfyScheduler.Normal),
}.ToImmutableDictionary();

Expand Down
4 changes: 3 additions & 1 deletion StabilityMatrix.Core/Models/Api/Comfy/ComfyScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public readonly record struct ComfyScheduler(string Name)
public static ComfyScheduler Exponential { get; } = new("exponential");
public static ComfyScheduler SDTurbo { get; } = new("sd_turbo");
public static ComfyScheduler Simple { get; } = new("simple");
public static ComfyScheduler Beta { get; } = new("beta");

private static Dictionary<string, string> ConvertDict { get; } =
new()
Expand All @@ -19,7 +20,8 @@ public readonly record struct ComfyScheduler(string Name)
["sgm_uniform"] = "SGM Uniform",
[Simple.Name] = "Simple",
["ddim_uniform"] = "DDIM Uniform",
[SDTurbo.Name] = "SD Turbo"
[SDTurbo.Name] = "SD Turbo",
[Beta.Name] = "Beta"
};

public static IReadOnlyList<ComfyScheduler> Defaults { get; } =
Expand Down
17 changes: 16 additions & 1 deletion StabilityMatrix.Core/Models/Packages/ComfyUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,28 @@ public override async Task<IEnumerable<PackageExtension>> GetManifestExtensionsA
.DownloadService.GetContentAsync(manifest.Uri.ToString(), cancellationToken)
.ConfigureAwait(false);

// nf4 hack
var nf4Extension = new PackageExtension
{
Author = "comfyanonymous",
Files = [new Uri("https://github.com/comfyanonymous/ComfyUI_bitsandbytes_NF4")],
Reference = new Uri("https://github.com/comfyanonymous/ComfyUI_bitsandbytes_NF4"),
Title = "ComfyUI_bitsandbytes_NF4",
InstallType = "git-clone"
};

// Parse json
var jsonManifest = JsonSerializer.Deserialize<ComfyExtensionManifest>(
content,
ComfyExtensionManifestSerializerContext.Default.Options
);

return jsonManifest?.GetPackageExtensions() ?? Enumerable.Empty<PackageExtension>();
if (jsonManifest == null)
return [];

var extensions = jsonManifest.GetPackageExtensions().ToList();
extensions.Add(nf4Extension);
return extensions;
}
catch (Exception e)
{
Expand Down

0 comments on commit 0454237

Please sign in to comment.