feat: add durable success-first modelhub agent
This commit is contained in:
@@ -25,6 +25,14 @@ class HFModelSummary:
|
||||
last_modified: datetime | None
|
||||
pipeline_tag: str | None
|
||||
created_at: datetime | None = None
|
||||
params: int | None = None
|
||||
file_size: int | None = None
|
||||
tags: tuple[str, ...] = ()
|
||||
tasks: tuple[str, ...] = ()
|
||||
license: str | None = None
|
||||
gated: bool = False
|
||||
private: bool = False
|
||||
likes: int = 0
|
||||
|
||||
@property
|
||||
def model_address(self) -> str:
|
||||
@@ -42,6 +50,8 @@ class ModelInspection:
|
||||
onnx_files: list[str] = field(default_factory=list)
|
||||
model_config: dict[str, Any] = field(default_factory=dict)
|
||||
config_fetch_error: str | None = None
|
||||
model_card_metadata: dict[str, Any] = field(default_factory=dict)
|
||||
published_size_bytes: int | None = None
|
||||
|
||||
@property
|
||||
def root_file_names(self) -> set[str]:
|
||||
@@ -132,10 +142,13 @@ class ModelInspection:
|
||||
@property
|
||||
def repository_size_bytes(self) -> int | None:
|
||||
"""Return exact recursive on-disk size when every file has a size."""
|
||||
if not self.file_paths or any(path not in self.file_sizes for path in self.file_paths):
|
||||
return None
|
||||
total = sum(max(0, int(self.file_sizes[path])) for path in self.file_paths)
|
||||
return total if total > 0 else None
|
||||
exact: int | None = None
|
||||
if self.file_paths and not any(path not in self.file_sizes for path in self.file_paths):
|
||||
total = sum(max(0, int(self.file_sizes[path])) for path in self.file_paths)
|
||||
exact = total if total > 0 else None
|
||||
published = int(self.published_size_bytes or 0) or None
|
||||
values = [value for value in (exact, published) if value is not None]
|
||||
return max(values) if values else None
|
||||
|
||||
def estimated_load_bytes(self, framework: str) -> int | None:
|
||||
if framework == "llamacpp":
|
||||
|
||||
Reference in New Issue
Block a user