datahub-cli 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datahub/__init__.py +46 -0
- datahub/catalog.py +1152 -0
- datahub/cli.py +251 -0
- datahub/config.py +101 -0
- datahub/hardware.py +148 -0
- datahub/ollama_search.py +97 -0
- datahub/progress.py +44 -0
- datahub/providers.py +702 -0
- datahub/py.typed +0 -0
- datahub/scoring.py +172 -0
- datahub/tui.py +846 -0
- datahub_cli-0.2.0.dist-info/METADATA +130 -0
- datahub_cli-0.2.0.dist-info/RECORD +16 -0
- datahub_cli-0.2.0.dist-info/WHEEL +4 -0
- datahub_cli-0.2.0.dist-info/entry_points.txt +4 -0
- datahub_cli-0.2.0.dist-info/licenses/LICENSE +21 -0
datahub/__init__.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Public API for the local data catalog and hardware-aware model estimates."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from .catalog import catalog_path
|
|
9
|
+
from .config import resolve_config
|
|
10
|
+
from .hardware import HardwareProfile, detect_hardware
|
|
11
|
+
from .scoring import ModelSpec, QuantTier, parse_parameters, score_model
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
__version__ = version("datahub-cli")
|
|
15
|
+
except PackageNotFoundError:
|
|
16
|
+
__version__ = "0+unknown"
|
|
17
|
+
|
|
18
|
+
__all__ = ["__version__", "detect_hardware", "evaluate_model", "get_dataset_dir", "get_model_path"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_dataset_dir(dataset_id: str, *, data_root: str | Path | None = None) -> Path:
|
|
22
|
+
"""Return the indexed dataset path, using its exact ID or unique name."""
|
|
23
|
+
return catalog_path("datasets", dataset_id, resolve_config(data_root=data_root))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_model_path(model_id: str, *, data_root: str | Path | None = None) -> Path:
|
|
27
|
+
"""Return the indexed model file or bundle path by exact ID or unique name."""
|
|
28
|
+
return catalog_path("models", model_id, resolve_config(data_root=data_root))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def evaluate_model(
|
|
32
|
+
model: str | ModelSpec,
|
|
33
|
+
hardware: HardwareProfile | None = None,
|
|
34
|
+
*,
|
|
35
|
+
params: int | None = None,
|
|
36
|
+
active_params: int | None = None,
|
|
37
|
+
task: str = "",
|
|
38
|
+
max_context: int = 8192,
|
|
39
|
+
) -> QuantTier:
|
|
40
|
+
"""Estimate fit for a model ID or an explicit model specification."""
|
|
41
|
+
if isinstance(model, str):
|
|
42
|
+
total, active = parse_parameters(model)
|
|
43
|
+
# An explicit total for a dense model also controls active parameters by default.
|
|
44
|
+
inferred_active = active if active != total or params is None else params
|
|
45
|
+
model = ModelSpec(model, params or total, active_params or inferred_active, task)
|
|
46
|
+
return score_model(model, hardware or detect_hardware(), max_context)
|