detrium.hub.providers
Pluggable Hub download providers: Hugging Face Hub, ModelScope, and direct HTTP fallback.
class HubProvider(ABC)
Abstract provider for downloading a file from a remote model hub.
字段
build_url(self, repo_id: str, filename: str, revision: Optional[str]=None) -> str
| 名称 | 类型 | 默认值 |
|---|
repo_id | str | — |
filename | str | — |
revision | Optional[str] | None |
download(self, repo_id: str, filename: str, dst_path: Path, *, revision: Optional[str]=None, timeout: float=30.0) -> Path
| 名称 | 类型 | 默认值 |
|---|
repo_id | str | — |
filename | str | — |
dst_path | Path | — |
revision | Optional[str] | None |
timeout | float | 30.0 |
class HuggingFaceProvider(HubProvider)
Hugging Face Hub provider (uses `huggingface_hub` SDK if installed, else direct HTTP).
| 名称 | 类型 | 默认值 |
|---|
endpoint | Optional[str] | None |
build_url(self, repo_id: str, filename: str, revision: Optional[str]=None) -> str
| 名称 | 类型 | 默认值 |
|---|
repo_id | str | — |
filename | str | — |
revision | Optional[str] | None |
download(self, repo_id: str, filename: str, dst_path: Path, *, revision: Optional[str]=None, timeout: float=30.0) -> Path
| 名称 | 类型 | 默认值 |
|---|
repo_id | str | — |
filename | str | — |
dst_path | Path | — |
revision | Optional[str] | None |
timeout | float | 30.0 |
class ModelScopeProvider(HubProvider)
ModelScope Hub provider (uses `modelscope` SDK if installed, else direct HTTP).
| 名称 | 类型 | 默认值 |
|---|
endpoint | Optional[str] | None |
build_url(self, repo_id: str, filename: str, revision: Optional[str]=None) -> str
| 名称 | 类型 | 默认值 |
|---|
repo_id | str | — |
filename | str | — |
revision | Optional[str] | None |
download(self, repo_id: str, filename: str, dst_path: Path, *, revision: Optional[str]=None, timeout: float=30.0) -> Path
| 名称 | 类型 | 默认值 |
|---|
repo_id | str | — |
filename | str | — |
dst_path | Path | — |
revision | Optional[str] | None |
timeout | float | 30.0 |