hafnia 0.5.1__py3-none-any.whl → 0.5.3__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.
- hafnia/dataset/dataset_details_uploader.py +1 -1
- hafnia/dataset/dataset_recipe/dataset_recipe.py +56 -101
- hafnia/dataset/hafnia_dataset.py +9 -49
- hafnia/dataset/hafnia_dataset_types.py +1 -1
- hafnia/dataset/operations/dataset_stats.py +2 -1
- hafnia/dataset/primitives/classification.py +1 -1
- hafnia/dataset/primitives/segmentation.py +1 -1
- hafnia/experiment/command_builder.py +686 -0
- hafnia/platform/dataset_recipe.py +30 -18
- hafnia/platform/datasets.py +8 -4
- hafnia/platform/experiment.py +12 -8
- hafnia/platform/trainer_package.py +58 -12
- hafnia/utils.py +7 -5
- {hafnia-0.5.1.dist-info → hafnia-0.5.3.dist-info}/METADATA +15 -10
- {hafnia-0.5.1.dist-info → hafnia-0.5.3.dist-info}/RECORD +25 -26
- hafnia_cli/dataset_recipe_cmds.py +4 -8
- hafnia_cli/experiment_cmds.py +15 -25
- hafnia_cli/profile_cmds.py +8 -3
- hafnia_cli/trainer_package_cmds.py +52 -4
- hafnia/data/__init__.py +0 -3
- hafnia/data/factory.py +0 -22
- /hafnia/{visualizations → dataset}/colors.py +0 -0
- /hafnia/{visualizations → dataset}/image_visualizations.py +0 -0
- /hafnia/{torch_helpers.py → dataset/torch_helpers.py} +0 -0
- {hafnia-0.5.1.dist-info → hafnia-0.5.3.dist-info}/WHEEL +0 -0
- {hafnia-0.5.1.dist-info → hafnia-0.5.3.dist-info}/entry_points.txt +0 -0
- {hafnia-0.5.1.dist-info → hafnia-0.5.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import Optional
|
|
2
|
+
from typing import Dict, Optional
|
|
3
3
|
|
|
4
4
|
import click
|
|
5
5
|
|
|
@@ -21,12 +21,60 @@ def cmd_list_trainer_packages(cfg: Config, limit: Optional[int]) -> None:
|
|
|
21
21
|
|
|
22
22
|
from hafnia.platform.trainer_package import get_trainer_packages, pretty_print_trainer_packages
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
trainers = get_trainer_packages(endpoint, cfg.api_key)
|
|
24
|
+
trainers = get_trainer_packages(cfg=cfg)
|
|
26
25
|
|
|
27
26
|
pretty_print_trainer_packages(trainers, limit=limit)
|
|
28
27
|
|
|
29
28
|
|
|
29
|
+
@trainer_package.command(name="create")
|
|
30
|
+
@click.pass_obj
|
|
31
|
+
@click.argument(
|
|
32
|
+
"path",
|
|
33
|
+
type=Path,
|
|
34
|
+
)
|
|
35
|
+
@click.option(
|
|
36
|
+
"-n",
|
|
37
|
+
"--name",
|
|
38
|
+
type=str,
|
|
39
|
+
default=None,
|
|
40
|
+
help="Name of the trainer package.",
|
|
41
|
+
)
|
|
42
|
+
@click.option(
|
|
43
|
+
"-d",
|
|
44
|
+
"--description",
|
|
45
|
+
type=str,
|
|
46
|
+
default=None,
|
|
47
|
+
help="Description of the trainer package.",
|
|
48
|
+
)
|
|
49
|
+
@click.option(
|
|
50
|
+
"--cmd",
|
|
51
|
+
type=Optional[str],
|
|
52
|
+
default=None,
|
|
53
|
+
show_default=True,
|
|
54
|
+
help="Default command to run the trainer package.",
|
|
55
|
+
)
|
|
56
|
+
def cmd_create_trainer_package(
|
|
57
|
+
cfg: Config,
|
|
58
|
+
path: Path,
|
|
59
|
+
cmd: Optional[str] = None,
|
|
60
|
+
name: Optional[str] = None,
|
|
61
|
+
description: Optional[str] = None,
|
|
62
|
+
) -> Dict:
|
|
63
|
+
"""Create a trainer package on the platform"""
|
|
64
|
+
from hafnia.platform.trainer_package import create_trainer_package
|
|
65
|
+
|
|
66
|
+
path_trainer = Path(path).resolve()
|
|
67
|
+
trainer_response = create_trainer_package(
|
|
68
|
+
source_dir=path_trainer,
|
|
69
|
+
name=name,
|
|
70
|
+
description=description,
|
|
71
|
+
cmd=cmd,
|
|
72
|
+
cfg=cfg,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
return trainer_response
|
|
76
|
+
|
|
77
|
+
|
|
30
78
|
@trainer_package.command(name="create-zip")
|
|
31
79
|
@click.argument("source")
|
|
32
80
|
@click.option(
|
|
@@ -46,7 +94,7 @@ def cmd_create_trainer_package_zip(source: str, output: str) -> None:
|
|
|
46
94
|
raise click.ClickException(consts.ERROR_TRAINER_PACKAGE_FILE_FORMAT)
|
|
47
95
|
|
|
48
96
|
path_source = Path(source)
|
|
49
|
-
path_output_zip = archive_dir(path_source, path_output_zip)
|
|
97
|
+
path_output_zip, _ = archive_dir(path_source, path_output_zip)
|
|
50
98
|
|
|
51
99
|
|
|
52
100
|
@trainer_package.command(name="view-zip")
|
hafnia/data/__init__.py
DELETED
hafnia/data/factory.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from typing import Any
|
|
3
|
-
|
|
4
|
-
from hafnia import utils
|
|
5
|
-
from hafnia.dataset.hafnia_dataset import HafniaDataset, get_or_create_dataset_path_from_recipe
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def load_dataset(recipe: Any, force_redownload: bool = False) -> HafniaDataset:
|
|
9
|
-
"""Load a dataset either from a local path or from the Hafnia platform."""
|
|
10
|
-
|
|
11
|
-
path_dataset = get_dataset_path(recipe, force_redownload=force_redownload)
|
|
12
|
-
dataset = HafniaDataset.from_path(path_dataset)
|
|
13
|
-
return dataset
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def get_dataset_path(recipe: Any, force_redownload: bool = False) -> Path:
|
|
17
|
-
if utils.is_hafnia_cloud_job():
|
|
18
|
-
return utils.get_dataset_path_in_hafnia_cloud()
|
|
19
|
-
|
|
20
|
-
path_dataset = get_or_create_dataset_path_from_recipe(recipe, force_redownload=force_redownload)
|
|
21
|
-
|
|
22
|
-
return path_dataset
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|