hydraflow 0.16.0__py3-none-any.whl → 0.16.2__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.
- hydraflow/core/io.py +33 -15
- hydraflow/core/main.py +6 -1
- hydraflow/core/run_info.py +3 -25
- {hydraflow-0.16.0.dist-info → hydraflow-0.16.2.dist-info}/METADATA +2 -6
- {hydraflow-0.16.0.dist-info → hydraflow-0.16.2.dist-info}/RECORD +8 -8
- {hydraflow-0.16.0.dist-info → hydraflow-0.16.2.dist-info}/WHEEL +0 -0
- {hydraflow-0.16.0.dist-info → hydraflow-0.16.2.dist-info}/entry_points.txt +0 -0
- {hydraflow-0.16.0.dist-info → hydraflow-0.16.2.dist-info}/licenses/LICENSE +0 -0
hydraflow/core/io.py
CHANGED
@@ -5,9 +5,12 @@ from __future__ import annotations
|
|
5
5
|
import fnmatch
|
6
6
|
import urllib.parse
|
7
7
|
import urllib.request
|
8
|
+
from functools import cache
|
8
9
|
from pathlib import Path
|
9
10
|
from typing import TYPE_CHECKING
|
10
11
|
|
12
|
+
from omegaconf import OmegaConf
|
13
|
+
|
11
14
|
if TYPE_CHECKING:
|
12
15
|
from collections.abc import Callable, Iterator
|
13
16
|
|
@@ -74,27 +77,37 @@ def log_text(run: Run, from_dir: Path, pattern: str = "*.log") -> None:
|
|
74
77
|
mlflow.log_text(text, file.name)
|
75
78
|
|
76
79
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
80
|
+
@cache
|
81
|
+
def get_experiment_name(experiment_dir: Path) -> str:
|
82
|
+
"""Get the job name from an experiment directory.
|
83
|
+
|
84
|
+
Extracts the job name from the meta.yaml file. Returns an empty string
|
85
|
+
if the file does not exist or if the job name cannot be found.
|
86
|
+
|
87
|
+
Args:
|
88
|
+
experiment_dir: Path to the experiment directory containing the meta.yaml file
|
89
|
+
|
90
|
+
Returns:
|
91
|
+
The job name as a string, or an empty string if the file does not exist
|
92
|
+
|
93
|
+
"""
|
94
|
+
path = experiment_dir / "meta.yaml"
|
95
|
+
if not path.exists():
|
96
|
+
return ""
|
97
|
+
|
98
|
+
meta = OmegaConf.load(experiment_dir / "meta.yaml")
|
99
|
+
return OmegaConf.select(meta, "name", default="")
|
87
100
|
|
88
101
|
|
89
102
|
def predicate_experiment_dir(
|
90
|
-
|
103
|
+
experiment_dir: Path,
|
91
104
|
experiment_names: list[str] | Callable[[str], bool] | None = None,
|
92
105
|
) -> bool:
|
93
106
|
"""Predicate an experiment directory based on the path and experiment names."""
|
94
|
-
if not
|
107
|
+
if not experiment_dir.is_dir() or experiment_dir.name in [".trash", "0"]:
|
95
108
|
return False
|
96
109
|
|
97
|
-
name = get_experiment_name(
|
110
|
+
name = get_experiment_name(experiment_dir)
|
98
111
|
if not name:
|
99
112
|
return False
|
100
113
|
|
@@ -108,9 +121,14 @@ def predicate_experiment_dir(
|
|
108
121
|
|
109
122
|
|
110
123
|
def get_experiment_names(tracking_dir: str | Path) -> list[str]:
|
111
|
-
"""Get the experiment names from the tracking directory.
|
124
|
+
"""Get the experiment names from the tracking directory.
|
125
|
+
|
126
|
+
Returns:
|
127
|
+
list[str]: A list of experiment names sorted by the name.
|
128
|
+
|
129
|
+
"""
|
112
130
|
names = [get_experiment_name(path) for path in Path(tracking_dir).iterdir()]
|
113
|
-
return
|
131
|
+
return sorted(name for name in names if name and name != "Default")
|
114
132
|
|
115
133
|
|
116
134
|
def iter_experiment_dirs(
|
hydraflow/core/main.py
CHANGED
@@ -82,7 +82,12 @@ def main[C](
|
|
82
82
|
rerun_finished: If True, allows rerunning completed runs. Defaults to
|
83
83
|
False.
|
84
84
|
update: A function that takes a configuration and returns a new
|
85
|
-
configuration.
|
85
|
+
configuration or None. The function can modify the configuration in-place
|
86
|
+
and/or return it. If the function returns None, the original (potentially
|
87
|
+
modified) configuration is used. Changes made by this function are saved
|
88
|
+
to the configuration file. This is useful for adding derived parameters,
|
89
|
+
ensuring consistency between related values, or adding runtime information
|
90
|
+
to the configuration. Defaults to None.
|
86
91
|
|
87
92
|
"""
|
88
93
|
import mlflow
|
hydraflow/core/run_info.py
CHANGED
@@ -11,11 +11,11 @@ was created.
|
|
11
11
|
from __future__ import annotations
|
12
12
|
|
13
13
|
from dataclasses import dataclass
|
14
|
-
from functools import
|
14
|
+
from functools import cached_property
|
15
15
|
from pathlib import Path
|
16
16
|
from typing import TYPE_CHECKING
|
17
17
|
|
18
|
-
from
|
18
|
+
from .io import get_experiment_name
|
19
19
|
|
20
20
|
if TYPE_CHECKING:
|
21
21
|
from pathlib import Path
|
@@ -50,7 +50,7 @@ class RunInfo:
|
|
50
50
|
Hydra configuration file (e.g., if the file does not exist or does not
|
51
51
|
contain the expected format).
|
52
52
|
"""
|
53
|
-
return
|
53
|
+
return get_experiment_name(self.run_dir.parent)
|
54
54
|
|
55
55
|
def to_dict(self) -> dict[str, Any]:
|
56
56
|
"""Convert the RunInfo to a dictionary."""
|
@@ -59,25 +59,3 @@ class RunInfo:
|
|
59
59
|
"run_dir": self.run_dir.as_posix(),
|
60
60
|
"job_name": self.job_name,
|
61
61
|
}
|
62
|
-
|
63
|
-
|
64
|
-
@cache
|
65
|
-
def get_job_name(experiment_dir: Path) -> str:
|
66
|
-
"""Get the job name from an experiment directory.
|
67
|
-
|
68
|
-
Extracts the job name from the meta.yaml file. Returns an empty string
|
69
|
-
if the file does not exist or if the job name cannot be found.
|
70
|
-
|
71
|
-
Args:
|
72
|
-
experiment_dir: Path to the experiment directory containing the meta.yaml file
|
73
|
-
|
74
|
-
Returns:
|
75
|
-
The job name as a string, or an empty string if the file does not exist
|
76
|
-
|
77
|
-
"""
|
78
|
-
path = experiment_dir / "meta.yaml"
|
79
|
-
if not path.exists():
|
80
|
-
return ""
|
81
|
-
|
82
|
-
meta = OmegaConf.load(experiment_dir / "meta.yaml")
|
83
|
-
return OmegaConf.select(meta, "name")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hydraflow
|
3
|
-
Version: 0.16.
|
3
|
+
Version: 0.16.2
|
4
4
|
Summary: HydraFlow seamlessly integrates Hydra and MLflow to streamline ML experiment management, combining Hydra's configuration management with MLflow's tracking capabilities.
|
5
5
|
Project-URL: Documentation, https://daizutabi.github.io/hydraflow/
|
6
6
|
Project-URL: Source, https://github.com/daizutabi/hydraflow
|
@@ -194,10 +194,6 @@ For detailed documentation, visit our [documentation site](https://daizutabi.git
|
|
194
194
|
- [User Guide](https://daizutabi.github.io/hydraflow/part1-applications/) - Detailed documentation of HydraFlow's capabilities
|
195
195
|
- [API Reference](https://daizutabi.github.io/hydraflow/api/hydraflow/) - Complete API documentation
|
196
196
|
|
197
|
-
## Contributing
|
198
|
-
|
199
|
-
We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
|
200
|
-
|
201
197
|
## License
|
202
198
|
|
203
|
-
This project is licensed under the MIT License
|
199
|
+
This project is licensed under the MIT License.
|
@@ -3,19 +3,19 @@ hydraflow/cli.py,sha256=3rGr___wwp8KazjLGQ7JO_IgAMqLyMlcVSs_QJK7g0Y,3135
|
|
3
3
|
hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
hydraflow/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
hydraflow/core/context.py,sha256=igE17oQESGjH-sBnICI8HkZbngY_crkHTgx2E-YkmEo,4155
|
6
|
-
hydraflow/core/io.py,sha256=
|
7
|
-
hydraflow/core/main.py,sha256=
|
6
|
+
hydraflow/core/io.py,sha256=B3-jPuJWttRgpbIpy_XA-Z2qpXzNF1ATwyYEwA7Pv3w,5172
|
7
|
+
hydraflow/core/main.py,sha256=pgr2b9A4VoZuwbApE71NElmV64MFJv8UKda05q4uCqk,6010
|
8
8
|
hydraflow/core/run.py,sha256=SugX6JLdBqsfz3JTrB66I3muo03rrmwDvITVZQaF48w,12685
|
9
9
|
hydraflow/core/run_collection.py,sha256=cbaJO68WzE-QNlTc8NhOyQ1pHDNberJs-31qTY7P9Fo,19495
|
10
|
-
hydraflow/core/run_info.py,sha256=
|
10
|
+
hydraflow/core/run_info.py,sha256=B5sueHKVH9KEwty8fWuYzGC3M0-_g3TF_iwDM_2dyJs,1885
|
11
11
|
hydraflow/executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
hydraflow/executor/aio.py,sha256=xXsmBPIPdBlopv_1h0FdtOvoKUcuW7PQeKCV2d_lN9I,2122
|
13
13
|
hydraflow/executor/conf.py,sha256=8Xq4UAenRKJIl1NBgNbSfv6VUTJhdwPLayZIEAsiBR0,414
|
14
14
|
hydraflow/executor/io.py,sha256=18wnHpCMQRGYL-oN2841h9W2aSW_X2SmO68Lx-3FIbU,1043
|
15
15
|
hydraflow/executor/job.py,sha256=6QeJ18OMeocXeM04rCYL46GgArfX1SvZs9_4HTomTgE,5436
|
16
16
|
hydraflow/executor/parser.py,sha256=RxP8qpDaJ8VLqZ51VlPFyVitWctObhkE_3iPIsY66Cs,14610
|
17
|
-
hydraflow-0.16.
|
18
|
-
hydraflow-0.16.
|
19
|
-
hydraflow-0.16.
|
20
|
-
hydraflow-0.16.
|
21
|
-
hydraflow-0.16.
|
17
|
+
hydraflow-0.16.2.dist-info/METADATA,sha256=3UWuHRuYrTCwXopZeqP9xBDKYn2_pUpL4Q2MBSOJhaA,7535
|
18
|
+
hydraflow-0.16.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
19
|
+
hydraflow-0.16.2.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
|
20
|
+
hydraflow-0.16.2.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
|
21
|
+
hydraflow-0.16.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|