Browse Source

Merge pull request #374 from ionite34/model-format-fixes

pull/298/head
Ionite 12 months ago committed by GitHub
parent
commit
72c4493c53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 1
      StabilityMatrix.Avalonia/App.axaml.cs
  3. 5
      StabilityMatrix.Core/Converters/Json/DefaultUnknownEnumConverter.cs
  4. 6
      StabilityMatrix.Core/Models/Api/CivitModelFormat.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.6.6
### Fixed
- Fixed error when receiving unknown model format values from the Model Browser
## v2.6.5
### Fixed
- Fixed process errors when installing or updating Pip packages using the Python packages dialog

1
StabilityMatrix.Avalonia/App.axaml.cs

@ -424,6 +424,7 @@ public sealed class App : Application
jsonSerializerOptions.Converters.Add(new ObjectToInferredTypesConverter());
jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitFileType>());
jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitModelType>());
jsonSerializerOptions.Converters.Add(new DefaultUnknownEnumConverter<CivitModelFormat>());
jsonSerializerOptions.Converters.Add(
new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)
);

5
StabilityMatrix.Core/Converters/Json/DefaultUnknownEnumConverter.cs

@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.Json;
@ -84,6 +85,8 @@ public class DefaultUnknownEnumConverter<
{
return enumMemberValue;
}
Debug.WriteLine($"Unknown enum member value for {typeToConvert}: {readerString}");
}
return UnknownValue;

6
StabilityMatrix.Core/Models/Api/CivitModelFormat.cs

@ -1,12 +1,14 @@
using System.Text.Json.Serialization;
using StabilityMatrix.Core.Converters.Json;
namespace StabilityMatrix.Core.Models.Api;
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonConverter(typeof(DefaultUnknownEnumConverter<CivitModelFormat>))]
public enum CivitModelFormat
{
Unknown,
SafeTensor,
PickleTensor,
Diffusers,
Other
}

Loading…
Cancel
Save