Skip to content

Commit

Permalink
Merge pull request LykosAI#776 from ionite34/fix-model-browser
Browse files Browse the repository at this point in the history
Fix model browser parsing shenanigans
  • Loading branch information
mohnjiles authored Aug 15, 2024
2 parents 3e70f9e + 63c9ed4 commit 298c39c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
#### Visionaries
- Shoutout to our Visionary-tier Patreon supporters, **Scopp Mcdee**, **Waterclouds**, and our newest Visionary, **Akiro_Senkai**! Many thanks for your generous support!

## v2.11.8
### Fixed
- Fixed CivitAI model browser not loading search results

## v2.11.7
### Changed
- Forge will use the recommended pytorch version 2.3.1 the next time it is updated
Expand Down
12 changes: 6 additions & 6 deletions StabilityMatrix.Avalonia/DesignData/DesignData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ public static void Initialize()
FileMetadata = new CivitFileMetadata
{
Format = CivitModelFormat.SafeTensor,
Fp = CivitModelFpType.fp16,
Size = CivitModelSize.pruned,
Fp = "fp16",
Size = "pruned",
},
TrainedWords = ["aurora", "lightning"]
}
Expand Down Expand Up @@ -636,8 +636,8 @@ public static UpdateSettingsViewModel UpdateSettingsViewModel
Metadata = new CivitFileMetadata
{
Format = CivitModelFormat.SafeTensor,
Fp = CivitModelFpType.fp16,
Size = CivitModelSize.pruned
Fp = "fp16",
Size = "pruned"
}
},
new()
Expand All @@ -647,8 +647,8 @@ public static UpdateSettingsViewModel UpdateSettingsViewModel
Metadata = new CivitFileMetadata
{
Format = CivitModelFormat.SafeTensor,
Fp = CivitModelFpType.fp32,
Size = CivitModelSize.full
Fp = "fp32",
Size = "full"
},
Hashes = new CivitFileHashes { BLAKE3 = "ABCD" }
}
Expand Down
10 changes: 6 additions & 4 deletions StabilityMatrix.Avalonia/Services/ModelDownloadLinkHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ private void UriReceivedHandler(Uri receivedUri)
x => x.Type == civitFileType && x.Metadata.Format == civitFormat
);

if (!string.IsNullOrWhiteSpace(fp) && Enum.TryParse<CivitModelFpType>(fp, out var fpType))
if (!string.IsNullOrWhiteSpace(fp))
{
possibleFiles = possibleFiles?.Where(x => x.Metadata.Fp == fpType);
possibleFiles = possibleFiles?.Where(
x => x.Metadata.Fp != null && x.Metadata.Fp.Equals(fp, StringComparison.OrdinalIgnoreCase)
);
}

if (!string.IsNullOrWhiteSpace(size) && Enum.TryParse<CivitModelSize>(size, out var modelSize))
if (!string.IsNullOrWhiteSpace(size))
{
possibleFiles = possibleFiles?.Where(x => x.Metadata.Size == modelSize);
possibleFiles = possibleFiles?.Where(x => x.Metadata.Size != null && x.Metadata.Size == size);
}

possibleFiles = possibleFiles?.ToList();
Expand Down
8 changes: 4 additions & 4 deletions StabilityMatrix.Core/Models/Api/CivitFileMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace StabilityMatrix.Core.Models.Api;
public class CivitFileMetadata
{
[JsonPropertyName("fp")]
public CivitModelFpType? Fp { get; set; }
public string? Fp { get; set; }

[JsonPropertyName("size")]
public CivitModelSize? Size { get; set; }
public string? Size { get; set; }

[JsonPropertyName("format")]
public CivitModelFormat? Format { get; set; }
}

0 comments on commit 298c39c

Please sign in to comment.