Skip to content

model_reference_records

The model database pydantic models and associate enums/lookups.

MODEL_RECORD_TYPE_LOOKUP module-attribute

MODEL_RECORD_TYPE_LOOKUP: dict[
    MODEL_REFERENCE_CATEGORY | str, type[GenericModelRecord]
] = {}

_ERROR_POLICY module-attribute

_ERROR_POLICY = FieldPolicy(severity='error')

_WARNING_POLICY module-attribute

_WARNING_POLICY = FieldPolicy(severity='warning')

__all__ module-attribute

__all__ = [
    "MODEL_RECORD_TYPE_LOOKUP",
    "AudioGenerationModelRecord",
    "BlipModelRecord",
    "ClipModelRecord",
    "CodeformerModelRecord",
    "ControlNetAnnotatorModelRecord",
    "ControlNetModelRecord",
    "DownloadRecord",
    "EsrganModelRecord",
    "FineTuneSeriesInfo",
    "GenericModelRecord",
    "GenericModelRecordConfig",
    "GenericModelRecordMetadata",
    "GfpganModelRecord",
    "ImageGenerationModelRecord",
    "LoraModelRecord",
    "MiscellaneousModelRecord",
    "SafetyCheckerModelRecord",
    "TextGenerationModelRecord",
    "TextualInversionModelRecord",
    "VideoGenerationModelRecord",
    "get_record_type_for_category",
    "register_record_type",
]

DownloadRecord

Bases: BaseModel

A record of a file to download for a model. Typically a ckpt file.

Source code in src/horde_model_reference/model_reference_records.py
class DownloadRecord(BaseModel):  # TODO Rename? (record to subrecord?)
    """A record of a file to download for a model. Typically a ckpt file."""

    model_config = get_default_config()

    file_name: str
    """The horde specific filename. This is not necessarily the same as the file's name on the model host."""
    file_url: str
    """The fully qualified URL to download the file from."""
    sha256sum: str = "FIXME"
    """The sha256sum of the file."""
    content_hash: str | None = None
    """Normalized, container-independent tensor-region content hash of this component file.

    Distinct from the whole-file :attr:`sha256sum`: it hashes only the component's tensor payload (sorted by
    name, folding in dtype/shape/bytes and excluding container metadata and key ordering), so byte-equivalent
    VAE/text-encoder weights shipped in different containers share one hash. This cross-platform-stable value
    (a pure function of the file bytes, independent of device and load-time dtype) is the identity the
    canonical registry keys on for cross-process sharing. ``None`` when unknown or unhashable (e.g. a
    ``.ckpt`` pickle file)."""
    file_purpose: str | None = None
    """The role this file plays for the model (e.g. ``"vae"`` or ``"text_encoders"``).

    Drives on-disk placement: component files route to a sibling folder rather than sitting beside the
    primary checkpoint. ``None`` means the file is the primary file for its category."""
    known_slow_download: bool | None = None
    """Whether the download is known to be slow or not."""
    size_bytes: int | None = None
    """The size of this file in bytes, if known. ``None`` when the reference does not declare it."""

model_config class-attribute instance-attribute

model_config = get_default_config()

file_name instance-attribute

file_name: str

The horde specific filename. This is not necessarily the same as the file's name on the model host.

file_url instance-attribute

file_url: str

The fully qualified URL to download the file from.

sha256sum class-attribute instance-attribute

sha256sum: str = 'FIXME'

The sha256sum of the file.

content_hash class-attribute instance-attribute

content_hash: str | None = None

Normalized, container-independent tensor-region content hash of this component file.

Distinct from the whole-file :attr:sha256sum: it hashes only the component's tensor payload (sorted by name, folding in dtype/shape/bytes and excluding container metadata and key ordering), so byte-equivalent VAE/text-encoder weights shipped in different containers share one hash. This cross-platform-stable value (a pure function of the file bytes, independent of device and load-time dtype) is the identity the canonical registry keys on for cross-process sharing. None when unknown or unhashable (e.g. a .ckpt pickle file).

file_purpose class-attribute instance-attribute

file_purpose: str | None = None

The role this file plays for the model (e.g. "vae" or "text_encoders").

Drives on-disk placement: component files route to a sibling folder rather than sitting beside the primary checkpoint. None means the file is the primary file for its category.

known_slow_download class-attribute instance-attribute

known_slow_download: bool | None = None

Whether the download is known to be slow or not.

size_bytes class-attribute instance-attribute

size_bytes: int | None = None

The size of this file in bytes, if known. None when the reference does not declare it.

GenericModelRecordConfig

Bases: BaseModel

Configuration for a generic model record.

Source code in src/horde_model_reference/model_reference_records.py
class GenericModelRecordConfig(BaseModel):
    """Configuration for a generic model record."""

    model_config = get_default_config()

    download: list[DownloadRecord] = Field(
        default_factory=list,
    )
    """A list of files to download for the model."""

    embedded_component_hashes: dict[str, str] | None = None
    """Maps a component kind (``"vae"``, ``"text_encoders"``) to the normalized tensor-region content hash of
    that component embedded in the primary checkpoint file.

    Only monolithic checkpoints (which bundle their VAE/text-encoder inside a single file) declare this.
    Split-file models instead carry a per-file :attr:`DownloadRecord.content_hash` on each component's
    download entry, so this is ``None``/absent for them. Also ``None`` when the model has no embedded
    shareable components or is unhashable (e.g. a ``.ckpt`` pickle file)."""

model_config class-attribute instance-attribute

model_config = get_default_config()

download class-attribute instance-attribute

download: list[DownloadRecord] = Field(default_factory=list)

A list of files to download for the model.

embedded_component_hashes class-attribute instance-attribute

embedded_component_hashes: dict[str, str] | None = None

Maps a component kind ("vae", "text_encoders") to the normalized tensor-region content hash of that component embedded in the primary checkpoint file.

Only monolithic checkpoints (which bundle their VAE/text-encoder inside a single file) declare this. Split-file models instead carry a per-file :attr:DownloadRecord.content_hash on each component's download entry, so this is None/absent for them. Also None when the model has no embedded shareable components or is unhashable (e.g. a .ckpt pickle file).

GenericModelRecordMetadata

Bases: BaseModel

Metadata for a generic model record.

Source code in src/horde_model_reference/model_reference_records.py
class GenericModelRecordMetadata(BaseModel):
    """Metadata for a generic model record."""

    model_config = get_default_config()

    schema_version: str = SCHEMA_VERSION
    """The version of the schema used to create this record."""

    created_at: int | None = None
    """The Unix time of when the record was created."""
    updated_at: int | None = None
    """The Unix time of when the record was last updated."""

    created_by: str | None = None
    """The name or identifier of the person or system which created the record."""
    updated_by: str | None = None
    """The name or identifier of the person or system which last updated the record."""

model_config class-attribute instance-attribute

model_config = get_default_config()

schema_version class-attribute instance-attribute

schema_version: str = SCHEMA_VERSION

The version of the schema used to create this record.

created_at class-attribute instance-attribute

created_at: int | None = None

The Unix time of when the record was created.

updated_at class-attribute instance-attribute

updated_at: int | None = None

The Unix time of when the record was last updated.

created_by class-attribute instance-attribute

created_by: str | None = None

The name or identifier of the person or system which created the record.

updated_by class-attribute instance-attribute

updated_by: str | None = None

The name or identifier of the person or system which last updated the record.

FineTuneSeriesInfo

Bases: BaseModel

Information about a fine-tuning series.

Source code in src/horde_model_reference/model_reference_records.py
class FineTuneSeriesInfo(BaseModel):
    """Information about a fine-tuning series."""

    model_config = get_default_config()

    name: str
    """The name of the fine-tuning series."""
    version: str | None = None
    """The version of the fine-tuning series."""

    author: str | None = None
    """The author of the fine-tuning series."""

    description: str | None = None
    """A short description of the fine-tuning series."""
    homepage: str | None = None
    """A link to the homepage of the fine-tuning series."""

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the fine-tuning series.

version class-attribute instance-attribute

version: str | None = None

The version of the fine-tuning series.

author class-attribute instance-attribute

author: str | None = None

The author of the fine-tuning series.

description class-attribute instance-attribute

description: str | None = None

A short description of the fine-tuning series.

homepage class-attribute instance-attribute

homepage: str | None = None

A link to the homepage of the fine-tuning series.

GenericModelRecord

Bases: BaseModel

A generic model reference record.

Source code in src/horde_model_reference/model_reference_records.py
class GenericModelRecord(BaseModel):
    """A generic model reference record."""

    model_config = get_default_config()

    record_type: str | MODEL_REFERENCE_CATEGORY
    """Discriminator field for polymorphic deserialization. Identifies the specific record type."""

    name: str
    """The name of the model."""
    description: str | None = None
    """A short description of the model."""
    version: str | None = None
    """The version of the  model (not the version of SD it is based on, see `baseline` for that info)."""

    finetune_series: FineTuneSeriesInfo | None = None
    """Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc."""

    metadata: GenericModelRecordMetadata = Field(
        default_factory=GenericModelRecordMetadata,
    )
    """Metadata about the record itself, such as creation and update times."""

    config: GenericModelRecordConfig = Field(
        default_factory=GenericModelRecordConfig,
    )
    """A dictionary of any configuration files and information on where to download the model file(s)."""

    model_classification: ModelClassification
    """The classification of the model."""

    size_on_disk_bytes: int | None = None
    """The model's total on-disk size in bytes, if known.

    A declared aggregate; prefer :attr:`declared_total_size_bytes`, which sums per-file sizes when every
    download entry declares one. ``None`` when no size metadata is available."""

    @property
    def category(self) -> MODEL_REFERENCE_CATEGORY | None:
        """Return this record's category, or None when ``record_type`` is not a known category.

        ``record_type`` is normally the enum already; a plain-string value (older or third-party records)
        is coerced, and an unrecognised string yields None rather than raising.
        """
        if isinstance(self.record_type, MODEL_REFERENCE_CATEGORY):
            return self.record_type
        try:
            return MODEL_REFERENCE_CATEGORY(self.record_type)
        except ValueError:
            return None

    @property
    def declared_total_size_bytes(self) -> int | None:
        """Return the model's total on-disk size in bytes, or None when undeclared.

        Prefers summing per-file :attr:`DownloadRecord.size_bytes` when every download entry declares one;
        otherwise falls back to the aggregate :attr:`size_on_disk_bytes`.
        """
        downloads = self.config.download if self.config else []
        if downloads and all(download.size_bytes is not None for download in downloads):
            return sum(download.size_bytes for download in downloads if download.size_bytes is not None)
        return self.size_on_disk_bytes

    @property
    def primary_download_url(self) -> str | None:
        """Return the URL of the first download entry, or None if there are no downloads."""
        if self.config and self.config.download:
            return self.config.download[0].file_url
        return None

    @property
    def all_download_urls(self) -> list[str]:
        """Return all download URLs for this model."""
        if self.config and self.config.download:
            return [d.file_url for d in self.config.download]
        return []

    @property
    def download_count(self) -> int:
        """Return the number of download entries for this model."""
        if self.config and self.config.download:
            return len(self.config.download)
        return 0

model_config class-attribute instance-attribute

model_config = get_default_config()

record_type instance-attribute

record_type: str | MODEL_REFERENCE_CATEGORY

Discriminator field for polymorphic deserialization. Identifies the specific record type.

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

model_classification instance-attribute

model_classification: ModelClassification

The classification of the model.

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

ImageGenerationModelRecord

Bases: GenericModelRecord

A model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.image_generation)
class ImageGenerationModelRecord(GenericModelRecord):
    """A model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.image_generation
    """Discriminator field identifying this as an image generation model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.image_generation),
    )
    """The domain (e.g., image, text) and purpose (e.g., generation, classification) of the model."""

    inpainting: bool | None = False
    """If this is an inpainting model or not."""
    baseline: KNOWN_IMAGE_GENERATION_BASELINE | str
    """The model on which this model is based."""
    optimization: str | None = None
    """The optimization type of the model."""
    tags: list[NormalizedTag] | None = None
    """Any tags associated with the model which may be useful for searching."""
    showcases: list[str] | None = None
    """Links to any showcases of the model which illustrate its style."""
    min_bridge_version: int | None = None
    """The minimum version of AI-Horde-Worker required to use this model."""
    trigger: list[str] | None = None
    """A list of trigger words or phrases which can be used to activate the model."""
    homepage: str | None = None
    """A link to the model's homepage."""
    nsfw: bool
    """Whether the model is NSFW or not."""

    style: NormalizedModelStyle | MODEL_STYLE | None = None
    """The style of the model."""

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

    @model_validator(mode="after")
    def validator_set_arrays_to_empty_if_none(self) -> ImageGenerationModelRecord:
        """Set any `None` values to empty lists."""
        if self.tags is None:
            self.tags = []
        if self.showcases is None:
            self.showcases = []
        if self.trigger is None:
            self.trigger = []
        return self

    @model_validator(mode="after")
    def validator_is_baseline_and_style_known(self) -> ImageGenerationModelRecord:
        """Check if the baseline is known."""
        if not is_known_image_baseline(str(self.baseline)):
            _apply_policy(
                category=self.record_type,
                field_name="baseline",
                value=str(self.baseline),
                fallback_policy=_ERROR_POLICY,
                model_name=self.name,
            )

        if self.style is not None and not is_known_model_style(str(self.style)):
            _apply_policy(
                category=self.record_type,
                field_name="style",
                value=str(self.style),
                fallback_policy=_ERROR_POLICY,
                model_name=self.name,
            )

        return self

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = (
    image_generation
)

Discriminator field identifying this as an image generation model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(
        image_generation
    )
)

The domain (e.g., image, text) and purpose (e.g., generation, classification) of the model.

inpainting class-attribute instance-attribute

inpainting: bool | None = False

If this is an inpainting model or not.

baseline instance-attribute

baseline: KNOWN_IMAGE_GENERATION_BASELINE | str

The model on which this model is based.

optimization class-attribute instance-attribute

optimization: str | None = None

The optimization type of the model.

tags class-attribute instance-attribute

tags: list[NormalizedTag] | None = None

Any tags associated with the model which may be useful for searching.

showcases class-attribute instance-attribute

showcases: list[str] | None = None

Links to any showcases of the model which illustrate its style.

min_bridge_version class-attribute instance-attribute

min_bridge_version: int | None = None

The minimum version of AI-Horde-Worker required to use this model.

trigger class-attribute instance-attribute

trigger: list[str] | None = None

A list of trigger words or phrases which can be used to activate the model.

homepage class-attribute instance-attribute

homepage: str | None = None

A link to the model's homepage.

nsfw instance-attribute

nsfw: bool

Whether the model is NSFW or not.

style class-attribute instance-attribute

style: NormalizedModelStyle | MODEL_STYLE | None = None

The style of the model.

requirements class-attribute instance-attribute

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

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

validator_set_arrays_to_empty_if_none

validator_set_arrays_to_empty_if_none() -> (
    ImageGenerationModelRecord
)

Set any None values to empty lists.

Source code in src/horde_model_reference/model_reference_records.py
@model_validator(mode="after")
def validator_set_arrays_to_empty_if_none(self) -> ImageGenerationModelRecord:
    """Set any `None` values to empty lists."""
    if self.tags is None:
        self.tags = []
    if self.showcases is None:
        self.showcases = []
    if self.trigger is None:
        self.trigger = []
    return self

validator_is_baseline_and_style_known

validator_is_baseline_and_style_known() -> (
    ImageGenerationModelRecord
)

Check if the baseline is known.

Source code in src/horde_model_reference/model_reference_records.py
@model_validator(mode="after")
def validator_is_baseline_and_style_known(self) -> ImageGenerationModelRecord:
    """Check if the baseline is known."""
    if not is_known_image_baseline(str(self.baseline)):
        _apply_policy(
            category=self.record_type,
            field_name="baseline",
            value=str(self.baseline),
            fallback_policy=_ERROR_POLICY,
            model_name=self.name,
        )

    if self.style is not None and not is_known_model_style(str(self.style)):
        _apply_policy(
            category=self.record_type,
            field_name="style",
            value=str(self.style),
            fallback_policy=_ERROR_POLICY,
            model_name=self.name,
        )

    return self

ControlNetModelRecord

Bases: GenericModelRecord

A ControlNet model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.controlnet)
class ControlNetModelRecord(GenericModelRecord):
    """A ControlNet model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.controlnet
    """Discriminator field identifying this as a ControlNet model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.controlnet),
    )

    controlnet_style: CONTROLNET_STYLE | str | None = None
    """The 'style' (purpose) of the controlnet. See `CONTROLNET_STYLE` for all possible values and more info."""

    @model_validator(mode="after")
    def validator_is_style_known(self) -> ControlNetModelRecord:
        """Check if the style is known."""
        if self.controlnet_style is not None and not is_known_controlnet_style(str(self.controlnet_style)):
            _apply_policy(
                category=self.record_type,
                field_name="controlnet_style",
                value=str(self.controlnet_style),
                fallback_policy=_WARNING_POLICY,
                model_name=self.name,
            )

        return self

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = controlnet

Discriminator field identifying this as a ControlNet model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(controlnet)
)

controlnet_style class-attribute instance-attribute

controlnet_style: CONTROLNET_STYLE | str | None = None

The 'style' (purpose) of the controlnet. See CONTROLNET_STYLE for all possible values and more info.

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

validator_is_style_known

validator_is_style_known() -> ControlNetModelRecord

Check if the style is known.

Source code in src/horde_model_reference/model_reference_records.py
@model_validator(mode="after")
def validator_is_style_known(self) -> ControlNetModelRecord:
    """Check if the style is known."""
    if self.controlnet_style is not None and not is_known_controlnet_style(str(self.controlnet_style)):
        _apply_policy(
            category=self.record_type,
            field_name="controlnet_style",
            value=str(self.controlnet_style),
            fallback_policy=_WARNING_POLICY,
            model_name=self.name,
        )

    return self

ControlNetAnnotatorModelRecord

Bases: GenericModelRecord

A ControlNet annotator (preprocessor) checkpoint group in the model reference.

These are the detector weights comfyui_controlnet_aux loads to preprocess an image before a ControlNet runs (pose/depth/edge/etc.). One record groups the file(s) a single preprocessor needs; the files themselves are the config.download entries, with each file_name rooted at the controlnet folder's annotators/ subdirectory so a pre-placed file is found and the package skips its own fetch.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.controlnet_annotator)
class ControlNetAnnotatorModelRecord(GenericModelRecord):
    """A ControlNet *annotator* (preprocessor) checkpoint group in the model reference.

    These are the detector weights ``comfyui_controlnet_aux`` loads to preprocess an image before a
    ControlNet runs (pose/depth/edge/etc.). One record groups the file(s) a single preprocessor needs; the
    files themselves are the ``config.download`` entries, with each ``file_name`` rooted at the controlnet
    folder's ``annotators/`` subdirectory so a pre-placed file is found and the package skips its own fetch.
    """

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.controlnet_annotator
    """Discriminator field identifying this as a ControlNet annotator model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.controlnet_annotator),
    )

    control_types: list[str] = Field(default_factory=list)
    """The horde control type(s) this annotator serves (e.g. ``["depth"]`` or ``["mlsd", "hough"]``)."""
    preprocessors: list[str] = Field(default_factory=list)
    """The ``comfyui_controlnet_aux`` node class(es) that load these files (e.g. ``["OpenposePreprocessor"]``)."""

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = (
    controlnet_annotator
)

Discriminator field identifying this as a ControlNet annotator model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(
        controlnet_annotator
    )
)

control_types class-attribute instance-attribute

control_types: list[str] = Field(default_factory=list)

The horde control type(s) this annotator serves (e.g. ["depth"] or ["mlsd", "hough"]).

preprocessors class-attribute instance-attribute

preprocessors: list[str] = Field(default_factory=list)

The comfyui_controlnet_aux node class(es) that load these files (e.g. ["OpenposePreprocessor"]).

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

TextGenerationModelRecord

Bases: GenericModelRecord

A text generation model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.text_generation)
class TextGenerationModelRecord(GenericModelRecord):
    """A text generation model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.text_generation
    """Discriminator field identifying this as a text generation model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.text_generation),
    )

    baseline: str | None = None
    parameters_count: int = Field(alias="parameters")
    nsfw: bool = False
    style: str | None = None
    display_name: str | None = None
    url: str | None = None
    tags: list[NormalizedTag] | None = None
    instruct_format: str | None = None
    """The instruction template format used by this model (e.g., ChatML, Mistral, Alpaca)."""
    settings: dict[str, int | float | str | list[int] | list[float] | list[str] | bool] | None = None
    text_model_group: str | None = None
    """The base model group name for grouping model variants together."""
    name_schema_exception: str | None = None
    """If set, this model does not follow the group's naming schema. The value is the reason."""

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = (
    text_generation
)

Discriminator field identifying this as a text generation model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(
        text_generation
    )
)

baseline class-attribute instance-attribute

baseline: str | None = None

parameters_count class-attribute instance-attribute

parameters_count: int = Field(alias='parameters')

nsfw class-attribute instance-attribute

nsfw: bool = False

style class-attribute instance-attribute

style: str | None = None

display_name class-attribute instance-attribute

display_name: str | None = None

url class-attribute instance-attribute

url: str | None = None

tags class-attribute instance-attribute

tags: list[NormalizedTag] | None = None

instruct_format class-attribute instance-attribute

instruct_format: str | None = None

The instruction template format used by this model (e.g., ChatML, Mistral, Alpaca).

settings class-attribute instance-attribute

settings: (
    dict[
        str,
        int
        | float
        | str
        | list[int]
        | list[float]
        | list[str]
        | bool,
    ]
    | None
) = None

text_model_group class-attribute instance-attribute

text_model_group: str | None = None

The base model group name for grouping model variants together.

name_schema_exception class-attribute instance-attribute

name_schema_exception: str | None = None

If set, this model does not follow the group's naming schema. The value is the reason.

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

TextModelGroupNameSchema

Bases: BaseModel

Persisted naming convention for a text model group.

When saved, overrides the inferred schema from infer_name_format().

Source code in src/horde_model_reference/model_reference_records.py
class TextModelGroupNameSchema(BaseModel):
    """Persisted naming convention for a text model group.

    When saved, overrides the inferred schema from ``infer_name_format()``.
    """

    model_config = ConfigDict(extra="forbid")

    separator: str = "-"
    part_order: list[str] = Field(default_factory=lambda: ["base", "size", "variant", "version", "quant"])
    author_included: bool = True
    common_author: str | None = None
    template: str | None = None
    extra_parts: list[str] = Field(default_factory=list)
    """Free-form labels for name segments outside the five primary categories (e.g., ``["date"]``)."""

model_config class-attribute instance-attribute

model_config = ConfigDict(extra='forbid')

separator class-attribute instance-attribute

separator: str = '-'

part_order class-attribute instance-attribute

part_order: list[str] = Field(
    default_factory=lambda: [
        "base",
        "size",
        "variant",
        "version",
        "quant",
    ]
)

author_included class-attribute instance-attribute

author_included: bool = True

common_author class-attribute instance-attribute

common_author: str | None = None

template class-attribute instance-attribute

template: str | None = None

extra_parts class-attribute instance-attribute

extra_parts: list[str] = Field(default_factory=list)

Free-form labels for name segments outside the five primary categories (e.g., ["date"]).

BlipModelRecord

Bases: GenericModelRecord

A BLIP model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.blip)
class BlipModelRecord(GenericModelRecord):
    """A BLIP model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.blip
    """Discriminator field identifying this as a BLIP model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.blip),
    )

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = blip

Discriminator field identifying this as a BLIP model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(blip)
)

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

ClipModelRecord

Bases: GenericModelRecord

A CLIP model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.clip)
class ClipModelRecord(GenericModelRecord):
    """A CLIP model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.clip
    """Discriminator field identifying this as a CLIP model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.clip),
    )

    pretrained_name: str | None = None
    """The pretrained model name, if applicable."""

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = clip

Discriminator field identifying this as a CLIP model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(clip)
)

pretrained_name class-attribute instance-attribute

pretrained_name: str | None = None

The pretrained model name, if applicable.

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

CodeformerModelRecord

Bases: GenericModelRecord

A Codeformer model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.codeformer)
class CodeformerModelRecord(GenericModelRecord):
    """A Codeformer model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.codeformer
    """Discriminator field identifying this as a Codeformer model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.codeformer),
    )

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = codeformer

Discriminator field identifying this as a Codeformer model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(codeformer)
)

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

EsrganModelRecord

Bases: GenericModelRecord

An ESRGAN model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.esrgan)
class EsrganModelRecord(GenericModelRecord):
    """An ESRGAN model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.esrgan
    """Discriminator field identifying this as an ESRGAN model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.esrgan),
    )

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = esrgan

Discriminator field identifying this as an ESRGAN model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(esrgan)
)

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

GfpganModelRecord

Bases: GenericModelRecord

A GFPGAN model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.gfpgan)
class GfpganModelRecord(GenericModelRecord):
    """A GFPGAN model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.gfpgan
    """Discriminator field identifying this as a GFPGAN model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.gfpgan),
    )

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = gfpgan

Discriminator field identifying this as a GFPGAN model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(gfpgan)
)

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

SafetyCheckerModelRecord

Bases: GenericModelRecord

A safety checker model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.safety_checker)
class SafetyCheckerModelRecord(GenericModelRecord):
    """A safety checker model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.safety_checker
    """Discriminator field identifying this as a safety checker model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.safety_checker),
    )

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = safety_checker

Discriminator field identifying this as a safety checker model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(
        safety_checker
    )
)

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

VideoGenerationModelRecord

Bases: GenericModelRecord

A video generation model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.video_generation)
class VideoGenerationModelRecord(GenericModelRecord):
    """A video generation model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.video_generation
    """Discriminator field identifying this as a video generation model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.video_generation),
    )

    baseline: str | None = None
    """The model on which this model is based."""
    nsfw: bool = False
    """Whether the model is NSFW or not."""
    tags: list[NormalizedTag] | None = None
    """Any tags associated with the model which may be useful for searching."""

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = (
    video_generation
)

Discriminator field identifying this as a video generation model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(
        video_generation
    )
)

baseline class-attribute instance-attribute

baseline: str | None = None

The model on which this model is based.

nsfw class-attribute instance-attribute

nsfw: bool = False

Whether the model is NSFW or not.

tags class-attribute instance-attribute

tags: list[NormalizedTag] | None = None

Any tags associated with the model which may be useful for searching.

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

AudioGenerationModelRecord

Bases: GenericModelRecord

An audio generation model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.audio_generation)
class AudioGenerationModelRecord(GenericModelRecord):
    """An audio generation model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.audio_generation
    """Discriminator field identifying this as an audio generation model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.audio_generation),
    )

    baseline: str | None = None
    """The model on which this model is based."""
    nsfw: bool = False
    """Whether the model is NSFW or not."""
    tags: list[NormalizedTag] | None = None
    """Any tags associated with the model which may be useful for searching."""

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = (
    audio_generation
)

Discriminator field identifying this as an audio generation model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(
        audio_generation
    )
)

baseline class-attribute instance-attribute

baseline: str | None = None

The model on which this model is based.

nsfw class-attribute instance-attribute

nsfw: bool = False

Whether the model is NSFW or not.

tags class-attribute instance-attribute

tags: list[NormalizedTag] | None = None

Any tags associated with the model which may be useful for searching.

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

MiscellaneousModelRecord

Bases: GenericModelRecord

A miscellaneous model entry in the model reference.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.miscellaneous)
class MiscellaneousModelRecord(GenericModelRecord):
    """A miscellaneous model entry in the model reference."""

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.miscellaneous
    """Discriminator field identifying this as a miscellaneous model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.miscellaneous),
    )

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = miscellaneous

Discriminator field identifying this as a miscellaneous model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(
        miscellaneous
    )
)

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

LoraModelRecord

Bases: GenericModelRecord

A LoRA model entry in the model reference.

LoRA records are managed_elsewhere in canonical data: the horde itself does not host them, so they are typically supplied by third-party providers (see :mod:horde_model_reference.providers). This built-in type is provided as a convenient default; providers may subclass and register their own type instead.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.lora)
class LoraModelRecord(GenericModelRecord):
    """A LoRA model entry in the model reference.

    LoRA records are ``managed_elsewhere`` in canonical data: the horde itself does
    not host them, so they are typically supplied by third-party providers (see
    :mod:`horde_model_reference.providers`). This built-in type is provided as a
    convenient default; providers may subclass and register their own type instead.
    """

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.lora
    """Discriminator field identifying this as a LoRA model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.lora),
    )

    baseline: str | None = None
    """The baseline (e.g., ``stable_diffusion_xl``) this LoRA is intended for."""
    nsfw: bool = False
    """Whether the LoRA is NSFW or not."""
    tags: list[NormalizedTag] | None = None
    """Any tags associated with the LoRA which may be useful for searching."""
    trigger: list[str] | None = None
    """A list of trigger words or phrases which activate the LoRA."""
    homepage: str | None = None
    """A link to the LoRA's homepage."""
    showcases: list[str] | None = None
    """Links to any showcases illustrating the LoRA's effect."""

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = lora

Discriminator field identifying this as a LoRA model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(lora)
)

baseline class-attribute instance-attribute

baseline: str | None = None

The baseline (e.g., stable_diffusion_xl) this LoRA is intended for.

nsfw class-attribute instance-attribute

nsfw: bool = False

Whether the LoRA is NSFW or not.

tags class-attribute instance-attribute

tags: list[NormalizedTag] | None = None

Any tags associated with the LoRA which may be useful for searching.

trigger class-attribute instance-attribute

trigger: list[str] | None = None

A list of trigger words or phrases which activate the LoRA.

homepage class-attribute instance-attribute

homepage: str | None = None

A link to the LoRA's homepage.

showcases class-attribute instance-attribute

showcases: list[str] | None = None

Links to any showcases illustrating the LoRA's effect.

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

TextualInversionModelRecord

Bases: GenericModelRecord

A textual inversion (embedding) model entry in the model reference.

Like :class:LoraModelRecord, textual inversions are managed_elsewhere and are normally supplied by third-party providers.

Source code in src/horde_model_reference/model_reference_records.py
@register_record_type(MODEL_REFERENCE_CATEGORY.ti)
class TextualInversionModelRecord(GenericModelRecord):
    """A textual inversion (embedding) model entry in the model reference.

    Like :class:`LoraModelRecord`, textual inversions are ``managed_elsewhere`` and
    are normally supplied by third-party providers.
    """

    record_type: MODEL_REFERENCE_CATEGORY | str = MODEL_REFERENCE_CATEGORY.ti
    """Discriminator field identifying this as a textual inversion model record."""

    model_classification: ModelClassification = Field(
        default_factory=lambda: _classification_for(MODEL_REFERENCE_CATEGORY.ti),
    )

    baseline: str | None = None
    """The baseline (e.g., ``stable_diffusion_1``) this embedding is intended for."""
    nsfw: bool = False
    """Whether the embedding is NSFW or not."""
    tags: list[NormalizedTag] | None = None
    """Any tags associated with the embedding which may be useful for searching."""
    trigger: list[str] | None = None
    """A list of trigger words or phrases which activate the embedding."""
    homepage: str | None = None
    """A link to the embedding's homepage."""
    showcases: list[str] | None = None
    """Links to any showcases illustrating the embedding's effect."""

record_type class-attribute instance-attribute

record_type: MODEL_REFERENCE_CATEGORY | str = ti

Discriminator field identifying this as a textual inversion model record.

model_classification class-attribute instance-attribute

model_classification: ModelClassification = Field(
    default_factory=lambda: _classification_for(ti)
)

baseline class-attribute instance-attribute

baseline: str | None = None

The baseline (e.g., stable_diffusion_1) this embedding is intended for.

nsfw class-attribute instance-attribute

nsfw: bool = False

Whether the embedding is NSFW or not.

tags class-attribute instance-attribute

tags: list[NormalizedTag] | None = None

Any tags associated with the embedding which may be useful for searching.

trigger class-attribute instance-attribute

trigger: list[str] | None = None

A list of trigger words or phrases which activate the embedding.

homepage class-attribute instance-attribute

homepage: str | None = None

A link to the embedding's homepage.

showcases class-attribute instance-attribute

showcases: list[str] | None = None

Links to any showcases illustrating the embedding's effect.

model_config class-attribute instance-attribute

model_config = get_default_config()

name instance-attribute

name: str

The name of the model.

description class-attribute instance-attribute

description: str | None = None

A short description of the model.

version class-attribute instance-attribute

version: str | None = None

The version of the model (not the version of SD it is based on, see baseline for that info).

finetune_series class-attribute instance-attribute

finetune_series: FineTuneSeriesInfo | None = None

Information about the fine-tuning of the model. For image, some examples are 'Pony', 'Illustrious", etc.

metadata class-attribute instance-attribute

metadata: GenericModelRecordMetadata = Field(
    default_factory=GenericModelRecordMetadata
)

Metadata about the record itself, such as creation and update times.

config class-attribute instance-attribute

config: GenericModelRecordConfig = Field(
    default_factory=GenericModelRecordConfig
)

A dictionary of any configuration files and information on where to download the model file(s).

size_on_disk_bytes class-attribute instance-attribute

size_on_disk_bytes: int | None = None

The model's total on-disk size in bytes, if known.

A declared aggregate; prefer :attr:declared_total_size_bytes, which sums per-file sizes when every download entry declares one. None when no size metadata is available.

category property

category: MODEL_REFERENCE_CATEGORY | None

Return this record's category, or None when record_type is not a known category.

record_type is normally the enum already; a plain-string value (older or third-party records) is coerced, and an unrecognised string yields None rather than raising.

declared_total_size_bytes property

declared_total_size_bytes: int | None

Return the model's total on-disk size in bytes, or None when undeclared.

Prefers summing per-file :attr:DownloadRecord.size_bytes when every download entry declares one; otherwise falls back to the aggregate :attr:size_on_disk_bytes.

primary_download_url property

primary_download_url: str | None

Return the URL of the first download entry, or None if there are no downloads.

all_download_urls property

all_download_urls: list[str]

Return all download URLs for this model.

download_count property

download_count: int

Return the number of download entries for this model.

_classification_for

_classification_for(
    category: MODEL_REFERENCE_CATEGORY | str,
) -> ModelClassification

Build the default ModelClassification for category from the registry.

Source code in src/horde_model_reference/model_reference_records.py
def _classification_for(category: MODEL_REFERENCE_CATEGORY | str) -> ModelClassification:
    """Build the default ``ModelClassification`` for *category* from the registry."""
    desc = get_category_descriptor(category)
    return ModelClassification(domain=desc.domain, purpose=desc.purpose)

get_default_config

get_default_config() -> ConfigDict

Get the default config for model records based on whether AI Horde is being tested or not.

Source code in src/horde_model_reference/model_reference_records.py
def get_default_config() -> ConfigDict:
    """Get the default config for model records based on whether AI Horde is being tested or not."""
    if ai_horde_ci_settings.ai_horde_testing:
        return ConfigDict(extra="forbid", populate_by_name=True)
    return ConfigDict(extra="ignore", populate_by_name=True)

register_record_type

register_record_type(
    category: MODEL_REFERENCE_CATEGORY | str,
) -> Callable[
    [type[GenericModelRecord]], type[GenericModelRecord]
]

Register a model record type with its category.

Source code in src/horde_model_reference/model_reference_records.py
def register_record_type(
    category: MODEL_REFERENCE_CATEGORY | str,
) -> Callable[[type[GenericModelRecord]], type[GenericModelRecord]]:
    """Register a model record type with its category."""

    def decorator(cls: type[GenericModelRecord]) -> type[GenericModelRecord]:
        if category in MODEL_RECORD_TYPE_LOOKUP:
            logger.warning(
                f"Overriding existing record type for category {category}: "
                f"{MODEL_RECORD_TYPE_LOOKUP[category]} -> {cls}",
            )
        MODEL_RECORD_TYPE_LOOKUP[category] = cls
        return cls

    return decorator

_field_policy_for

_field_policy_for(
    category: MODEL_REFERENCE_CATEGORY | str,
    field_name: str,
    fallback: FieldPolicy,
) -> FieldPolicy
Source code in src/horde_model_reference/model_reference_records.py
def _field_policy_for(
    category: MODEL_REFERENCE_CATEGORY | str,
    field_name: str,
    fallback: FieldPolicy,
) -> FieldPolicy:
    policy = kind_policy_registry.get(category_key(category))
    if policy is None:
        return fallback
    return policy.field_policies.get(field_name, fallback)

_apply_policy

_apply_policy(
    *,
    category: MODEL_REFERENCE_CATEGORY | str,
    field_name: str,
    value: str,
    fallback_policy: FieldPolicy,
    model_name: str,
) -> None
Source code in src/horde_model_reference/model_reference_records.py
def _apply_policy(
    *,
    category: MODEL_REFERENCE_CATEGORY | str,
    field_name: str,
    value: str,
    fallback_policy: FieldPolicy,
    model_name: str,
) -> None:
    field_policy = _field_policy_for(category, field_name, fallback_policy)
    if field_policy.severity == "error":
        raise ValueError(f"Unknown {field_name}: {value}")

    logger.debug(f"Unknown {field_name} {value} for model {model_name}")

get_record_type_for_category

get_record_type_for_category(
    category: MODEL_REFERENCE_CATEGORY | str,
) -> type[GenericModelRecord]

Return the registered record type for category, falling back to GenericModelRecord.

Parameters:

Returns:

Source code in src/horde_model_reference/model_reference_records.py
def get_record_type_for_category(category: MODEL_REFERENCE_CATEGORY | str) -> type[GenericModelRecord]:
    """Return the registered record type for *category*, falling back to ``GenericModelRecord``.

    Args:
        category: The model reference category (enum member or plain string).

    Returns:
        The record type class registered for the category, or ``GenericModelRecord``
        if no specific type has been registered.

    """
    return MODEL_RECORD_TYPE_LOOKUP.get(category, GenericModelRecord)