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

feat: support optimization and requirements fields #83

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class RawLegacy_StableDiffusion_ModelRecord(BaseModel):

name: str
baseline: str
optimization: str | None = None
type: str
inpainting: bool
description: str | None = None
Expand All @@ -58,6 +59,7 @@ class RawLegacy_StableDiffusion_ModelRecord(BaseModel):
homepage: str | None = None
nsfw: bool
download_all: bool
requirements: dict[str, int | str | list[int] | list[str] | bool] | None = None
config: Mapping[str, list[RawLegacy_FileRecord | RawLegacy_DownloadRecord]]
available: bool | None = None
features_not_supported: list[FEATURE_SUPPORTED] | None = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class Legacy_StableDiffusion_ModelRecord(StagingLegacy_Generic_ModelRecord):
trigger: list[str] | None = None
homepage: str | None = None
size_on_disk_bytes: int | None = None
optimization: str | None = None
requirements: dict[str, int | str | list[int] | list[str] | bool] | None = None


class Legacy_Generic_ModelReference(BaseModel):
Expand Down
4 changes: 4 additions & 0 deletions horde_model_reference/model_reference_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class StableDiffusion_ModelRecord(Generic_ModelRecord):
"""If this is an inpainting model or not."""
baseline: STABLE_DIFFUSION_BASELINE_CATEGORY | str
"""The model on which this model is based."""
optimization: str | None = None
"""The optimization type of the model."""
tags: list[str] | None = []
"""Any tags associated with the model which may be useful for searching."""
showcases: list[str] | None = []
Expand All @@ -88,6 +90,8 @@ class StableDiffusion_ModelRecord(Generic_ModelRecord):
style: MODEL_STYLE | str | None = None
"""The style of the model."""

requirements: dict[str, int | str | list[int] | list[str] | bool] | None = None

size_on_disk_bytes: int | None = None

@model_validator(mode="after")
Expand Down
49 changes: 49 additions & 0 deletions legacy_stable_diffusion.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
"title": "Baseline",
"type": "string"
},
"optimization": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Optimization"
},
"type": {
"title": "Type",
"type": "string"
Expand Down Expand Up @@ -222,6 +234,43 @@
"title": "Download All",
"type": "boolean"
},
"requirements": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
},
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "boolean"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Requirements"
},
"config": {
"additionalProperties": {
"items": {
Expand Down
4 changes: 4 additions & 0 deletions stable_diffusion.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"features_not_supported": null,
"inpainting": false,
"baseline": "stable_diffusion_1",
"optimization": null,
"tags": [
"anime",
"faces"
Expand All @@ -33,6 +34,7 @@
"homepage": "https://www.not.a.real_website.com",
"nsfw": false,
"style": "generalist",
"requirements": null,
"size_on_disk_bytes": 123456789
},
"example model 2": {
Expand All @@ -54,6 +56,7 @@
"features_not_supported": null,
"inpainting": false,
"baseline": "stable_diffusion_1",
"optimization": null,
"tags": [
"anime",
"faces"
Expand All @@ -69,6 +72,7 @@
"homepage": "https://www.another_fake_website.com",
"nsfw": true,
"style": "anime",
"requirements": null,
"size_on_disk_bytes": 123456789
}
}
49 changes: 49 additions & 0 deletions stable_diffusion.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@
],
"title": "Baseline"
},
"optimization": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Optimization"
},
"tags": {
"anyOf": [
{
Expand Down Expand Up @@ -262,6 +274,43 @@
"default": null,
"title": "Style"
},
"requirements": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
},
{
"items": {
"type": "integer"
},
"type": "array"
},
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "boolean"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Requirements"
},
"size_on_disk_bytes": {
"anyOf": [
{
Expand Down
Loading