mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-03 16:45:33 -03:00
Add OpenModelDB (openmodeldb.info) as a metadata and download source for
the existing upscaler model type.
Metadata:
- New OpenModelDBClient: fetches the site's bulk JSON dumps, caches them
on disk (24h TTL + ETag revalidation), and builds a local sha256 index
- New OpenModelDBModelMetadataProvider adapts catalogue entries to the
CivitAI-shaped version dict contract; registered in the fallback chain
behind the enable_openmodeldb_api setting (default on), gated to the
upscaler sub-type so other model types never trigger the dump download
- Persisted provenance uses metadata_source "openmodeldb" plus a nested
openmodeldb block (page URL, architecture, scale, license)
Images: paired-image LR/SR URLs are ephemeral imgdiff.net sessions, so
displayable images come from the site-hosted auto-generated thumbnails
(model-level cover leads images[], per-image thumbs for the rest); the
original comparison URL is kept in meta.comparisonUrl.
Downloads:
- New OpenModelDBSource (flat model ids, omdb: group prefix) with
resource filename derivation that recovers names hidden mid-path
(mediafire) or synthesizes {id}.{type} for folder links
- HTML-gateway mirrors (mediafire/mega/drive) are rejected with a clear
manual-download hint instead of silently saving an HTML page as .pth
- ModelSource base gains is_valid_source_id / default_subdir_parts /
resolve_download_url hooks so flat-id sources need no platform branches
UI: "View on OpenModelDB" link in the model modal (downloaded and
hash-enriched models), settings toggle next to the CivArchive one.
89 lines
2.1 KiB
Python
89 lines
2.1 KiB
Python
"""External model-source providers (Hugging Face, ModelScope, TensorArt, OpenModelDB).
|
|
|
|
This package is the single abstraction over "a site that hosts models and
|
|
a model card". See :mod:`py.services.model_sources.base` for the provider
|
|
protocol and :mod:`py.services.model_sources.registry` for the lookup and
|
|
metadata-normalisation helpers used across the codebase.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .base import (
|
|
GROUP_PREFIXES,
|
|
HTTP_TIMEOUT,
|
|
ModelCardContext,
|
|
ModelSource,
|
|
ModelSourceCache,
|
|
ModelSourceError,
|
|
SourceRef,
|
|
USER_AGENT,
|
|
clean_source_url,
|
|
fetch_json,
|
|
fetch_text,
|
|
filter_weight_files,
|
|
is_valid_source_id,
|
|
)
|
|
from .huggingface import HuggingFaceSource
|
|
from .hydration import (
|
|
hydrate_from_source,
|
|
load_model_card,
|
|
resolve_site_base_model,
|
|
)
|
|
from .modelscope import ModelScopeIntlSource, ModelScopeSource
|
|
from .openmodeldb import OpenModelDBSource
|
|
from .registry import (
|
|
LEGACY_HF_URL_FIELD,
|
|
SOURCE_PLATFORM_FIELD,
|
|
SOURCE_URL_FIELD,
|
|
detect_source,
|
|
downloadable_sources,
|
|
get_download_source,
|
|
get_source,
|
|
get_source_platform,
|
|
has_external_source,
|
|
list_sources,
|
|
normalize_metadata_source,
|
|
resolve_source_ref,
|
|
source_group_key,
|
|
source_label,
|
|
)
|
|
from .tensorart import TensorArtSource
|
|
|
|
__all__ = [
|
|
"GROUP_PREFIXES",
|
|
"HTTP_TIMEOUT",
|
|
"LEGACY_HF_URL_FIELD",
|
|
"ModelCardContext",
|
|
"ModelSource",
|
|
"ModelSourceCache",
|
|
"ModelSourceError",
|
|
"HuggingFaceSource",
|
|
"ModelScopeIntlSource",
|
|
"ModelScopeSource",
|
|
"OpenModelDBSource",
|
|
"SOURCE_PLATFORM_FIELD",
|
|
"SOURCE_URL_FIELD",
|
|
"SourceRef",
|
|
"TensorArtSource",
|
|
"USER_AGENT",
|
|
"clean_source_url",
|
|
"detect_source",
|
|
"downloadable_sources",
|
|
"fetch_json",
|
|
"fetch_text",
|
|
"filter_weight_files",
|
|
"get_download_source",
|
|
"get_source",
|
|
"get_source_platform",
|
|
"has_external_source",
|
|
"hydrate_from_source",
|
|
"is_valid_source_id",
|
|
"list_sources",
|
|
"load_model_card",
|
|
"normalize_metadata_source",
|
|
"resolve_site_base_model",
|
|
"resolve_source_ref",
|
|
"source_group_key",
|
|
"source_label",
|
|
]
|