detrium.hub.manager
Dual-source HubManager supporting Hugging Face Hub and ModelScope with fallback and SHA256 verification.
class HubModelEntry
Metadata for an officially indexed Detrium model.
字段
| 名称 | 类型 | 默认值 |
|---|
name | str | — |
family | str | — |
task | str | — |
recipe | str | — |
filename | str | — |
hf_repo | Optional[str] | None |
ms_repo | Optional[str] | None |
license | str | 'Apache-2.0' |
imgsz | int | 640 |
sha256 | Optional[str] | None |
class HubManager
Resolve and download Detrium model weights across Hugging Face Hub and ModelScope.
| 名称 | 类型 | 默认值 |
|---|
registry_path | Path | _REGISTRY_YAML |
cache_dir | Optional[Path] | None |
providers | Optional[Mapping[str, HubProvider]] | None |
list_models(self) -> List[str]
get_entry(self, name: str) -> Optional[HubModelEntry]
resolve_and_download(self, model_ref: str, *, source: str='auto', revision: Optional[str]=None, timeout: float=30.0) -> Path
Return a verified local path to `model_ref` (local file, alias, `hf://`, or `ms://`).
| 名称 | 类型 | 默认值 |
|---|
model_ref | str | — |
source | str | 'auto' |
revision | Optional[str] | None |
timeout | float | 30.0 |
parse_hub_uri(uri: str) -> Optional[Tuple[str, str, str]]
Parse `hf://org/repo/file.pt` or `ms://org/repo/file.pt` into `(provider, repo_id, filename)`.
compute_sha256(path: Path) -> str