hydraflow 0.14.2__tar.gz → 0.14.3__tar.gz
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-0.14.2 → hydraflow-0.14.3}/PKG-INFO +77 -6
- hydraflow-0.14.3/README.md +139 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/pyproject.toml +20 -2
- hydraflow-0.14.3/tests/cli/app.py +54 -0
- hydraflow-0.14.2/README.md +0 -75
- hydraflow-0.14.2/tests/cli/app.py +0 -30
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.devcontainer/devcontainer.json +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.devcontainer/postCreate.sh +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.devcontainer/starship.toml +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.gitattributes +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.github/workflows/ci.yaml +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.github/workflows/docs.yaml +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.github/workflows/publish.yaml +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/.gitignore +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/LICENSE +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/apps/quickstart.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/docs/index.md +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/docs/usage/quickstart.md +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/mkdocs.yaml +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/cli.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/core/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/core/config.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/core/context.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/core/io.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/core/main.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/core/mlflow.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/core/param.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/entities/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/entities/run_collection.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/entities/run_data.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/entities/run_info.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/executor/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/executor/aio.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/executor/conf.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/executor/io.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/executor/job.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/executor/parser.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/src/hydraflow/py.typed +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/conftest.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/hydraflow.yaml +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/submit.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/test_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/test_setup.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/test_show.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/cli/test_version.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/conftest.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/config/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/config/test_config.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/config/test_params.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/context/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/context/chdir.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/context/log_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/context/start_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/context/test_chdir.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/context/test_log_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/context/test_start_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/io/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/io/hydra_dir.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/io/test_hydra_dir.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/io/test_iter_dirs.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/io/test_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/default.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/force_new_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/match_overrides.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/rerun_finished.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/skip_finished.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/test_default.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/test_force_new_run.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/test_match_overrides.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/test_rerun_finished.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/main/test_skip_finished.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/param/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/param/params.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/param/test_param.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/param/test_params.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/core/test_mlflow.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/filter.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/test_collection.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/test_data.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/test_filter.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/test_info.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/test_values.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/entities/values.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/__init__.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/conftest.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/echo.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/read.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/test_aio.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/test_args.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/test_conf.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/test_io.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/test_job.py +0 -0
- {hydraflow-0.14.2 → hydraflow-0.14.3}/tests/executor/test_parser.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hydraflow
|
3
|
-
Version: 0.14.
|
4
|
-
Summary:
|
3
|
+
Version: 0.14.3
|
4
|
+
Summary: HydraFlow seamlessly integrates Hydra and MLflow to streamline ML experiment management. It combines Hydra's configuration management with MLflow's tracking capabilities, offering automated experiment tracking, versioning, and a rich CLI interface. Perfect for ML researchers and teams who need reproducibility while scaling experiments.
|
5
5
|
Project-URL: Documentation, https://daizutabi.github.io/hydraflow/
|
6
6
|
Project-URL: Source, https://github.com/daizutabi/hydraflow
|
7
7
|
Project-URL: Issues, https://github.com/daizutabi/hydraflow/issues
|
@@ -28,13 +28,20 @@ License: MIT License
|
|
28
28
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
29
29
|
SOFTWARE.
|
30
30
|
License-File: LICENSE
|
31
|
+
Keywords: ai,data-science,deep-learning,experiment-tracking,hydra,machine-learning,mlflow,mlops,research
|
31
32
|
Classifier: Development Status :: 4 - Beta
|
33
|
+
Classifier: Environment :: Console
|
34
|
+
Classifier: Intended Audience :: Developers
|
35
|
+
Classifier: Intended Audience :: Science/Research
|
32
36
|
Classifier: License :: OSI Approved :: MIT License
|
37
|
+
Classifier: Operating System :: OS Independent
|
33
38
|
Classifier: Programming Language :: Python
|
34
39
|
Classifier: Programming Language :: Python :: 3.10
|
35
40
|
Classifier: Programming Language :: Python :: 3.11
|
36
41
|
Classifier: Programming Language :: Python :: 3.12
|
37
42
|
Classifier: Programming Language :: Python :: 3.13
|
43
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
44
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
38
45
|
Requires-Python: >=3.10
|
39
46
|
Requires-Dist: hydra-core>=1.3
|
40
47
|
Requires-Dist: mlflow>=2.15
|
@@ -50,6 +57,7 @@ Description-Content-Type: text/markdown
|
|
50
57
|
[![Python Version][python-v-image]][python-v-link]
|
51
58
|
[![Build Status][GHAction-image]][GHAction-link]
|
52
59
|
[![Coverage Status][codecov-image]][codecov-link]
|
60
|
+
[![Documentation Status][docs-image]][docs-link]
|
53
61
|
|
54
62
|
<!-- Badges -->
|
55
63
|
[pypi-v-image]: https://img.shields.io/pypi/v/hydraflow.svg
|
@@ -60,6 +68,8 @@ Description-Content-Type: text/markdown
|
|
60
68
|
[GHAction-link]: https://github.com/daizutabi/hydraflow/actions?query=event%3Apush+branch%3Amain
|
61
69
|
[codecov-image]: https://codecov.io/github/daizutabi/hydraflow/coverage.svg?branch=main
|
62
70
|
[codecov-link]: https://codecov.io/github/daizutabi/hydraflow?branch=main
|
71
|
+
[docs-image]: https://readthedocs.org/projects/hydraflow/badge/?version=latest
|
72
|
+
[docs-link]: https://daizutabi.github.io/hydraflow/
|
63
73
|
|
64
74
|
## Overview
|
65
75
|
|
@@ -80,6 +90,8 @@ machine learning workflows.
|
|
80
90
|
checkpoints and configuration files, with MLflow.
|
81
91
|
- **Seamless Integration**: Easily integrate Hydra and MLflow in your machine learning
|
82
92
|
projects with minimal setup.
|
93
|
+
- **Rich CLI Interface**: Command-line tools for managing experiments and viewing results.
|
94
|
+
- **Cross-Platform Support**: Works consistently across different operating systems.
|
83
95
|
|
84
96
|
## Installation
|
85
97
|
|
@@ -89,7 +101,7 @@ You can install Hydraflow via pip:
|
|
89
101
|
pip install hydraflow
|
90
102
|
```
|
91
103
|
|
92
|
-
##
|
104
|
+
## Quick Start
|
93
105
|
|
94
106
|
Here is a simple example to get you started with Hydraflow:
|
95
107
|
|
@@ -100,6 +112,7 @@ from dataclasses import dataclass
|
|
100
112
|
from typing import TYPE_CHECKING
|
101
113
|
|
102
114
|
import hydraflow
|
115
|
+
import mlflow
|
103
116
|
|
104
117
|
if TYPE_CHECKING:
|
105
118
|
from mlflow.entities import Run
|
@@ -107,15 +120,73 @@ if TYPE_CHECKING:
|
|
107
120
|
|
108
121
|
@dataclass
|
109
122
|
class Config:
|
110
|
-
|
111
|
-
|
123
|
+
"""Configuration for the ML training experiment."""
|
124
|
+
# Training hyperparameters
|
125
|
+
learning_rate: float = 0.001
|
126
|
+
batch_size: int = 32
|
127
|
+
epochs: int = 10
|
128
|
+
|
129
|
+
# Model architecture parameters
|
130
|
+
hidden_size: int = 128
|
131
|
+
dropout: float = 0.1
|
132
|
+
|
133
|
+
# Dataset parameters
|
134
|
+
train_size: float = 0.8
|
135
|
+
random_seed: int = 42
|
112
136
|
|
113
137
|
|
114
138
|
@hydraflow.main(Config)
|
115
139
|
def app(run: Run, cfg: Config):
|
116
|
-
"""
|
140
|
+
"""Train a model with the given configuration.
|
141
|
+
|
142
|
+
This example demonstrates how to:
|
143
|
+
|
144
|
+
1. Define a configuration using dataclasses
|
145
|
+
2. Use Hydraflow to integrate with MLflow
|
146
|
+
3. Track metrics and parameters automatically
|
147
|
+
|
148
|
+
Args:
|
149
|
+
run: MLflow run for the experiment corresponding to the Hydra app.
|
150
|
+
This `Run` instance is automatically created by Hydraflow.
|
151
|
+
cfg: Configuration for the experiment's run.
|
152
|
+
This `Config` instance is originally defined by Hydra, and then
|
153
|
+
automatically passed to the app by Hydraflow.
|
154
|
+
"""
|
155
|
+
# Training loop
|
156
|
+
for epoch in range(cfg.epochs):
|
157
|
+
# Simulate training and validation
|
158
|
+
train_loss = 1.0 / (epoch + 1)
|
159
|
+
val_loss = 1.1 / (epoch + 1)
|
160
|
+
|
161
|
+
# Log metrics to MLflow
|
162
|
+
mlflow.log_metrics({
|
163
|
+
"train_loss": train_loss,
|
164
|
+
"val_loss": val_loss
|
165
|
+
}, step=epoch)
|
166
|
+
|
167
|
+
print(f"Epoch {epoch}: train_loss={train_loss:.4f}, val_loss={val_loss:.4f}")
|
117
168
|
|
118
169
|
|
119
170
|
if __name__ == "__main__":
|
120
171
|
app()
|
121
172
|
```
|
173
|
+
|
174
|
+
This example demonstrates:
|
175
|
+
|
176
|
+
- Configuration management with Hydra
|
177
|
+
- Automatic experiment tracking with MLflow
|
178
|
+
- Parameter logging and metric tracking
|
179
|
+
- Type-safe configuration with dataclasses
|
180
|
+
|
181
|
+
## Documentation
|
182
|
+
|
183
|
+
For detailed documentation, including advanced usage examples and API reference,
|
184
|
+
visit our [documentation site](https://daizutabi.github.io/hydraflow/).
|
185
|
+
|
186
|
+
## Contributing
|
187
|
+
|
188
|
+
We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
|
189
|
+
|
190
|
+
## License
|
191
|
+
|
192
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# Hydraflow
|
2
|
+
|
3
|
+
[![PyPI Version][pypi-v-image]][pypi-v-link]
|
4
|
+
[![Python Version][python-v-image]][python-v-link]
|
5
|
+
[![Build Status][GHAction-image]][GHAction-link]
|
6
|
+
[![Coverage Status][codecov-image]][codecov-link]
|
7
|
+
[![Documentation Status][docs-image]][docs-link]
|
8
|
+
|
9
|
+
<!-- Badges -->
|
10
|
+
[pypi-v-image]: https://img.shields.io/pypi/v/hydraflow.svg
|
11
|
+
[pypi-v-link]: https://pypi.org/project/hydraflow/
|
12
|
+
[python-v-image]: https://img.shields.io/pypi/pyversions/hydraflow.svg
|
13
|
+
[python-v-link]: https://pypi.org/project/hydraflow
|
14
|
+
[GHAction-image]: https://github.com/daizutabi/hydraflow/actions/workflows/ci.yaml/badge.svg?branch=main&event=push
|
15
|
+
[GHAction-link]: https://github.com/daizutabi/hydraflow/actions?query=event%3Apush+branch%3Amain
|
16
|
+
[codecov-image]: https://codecov.io/github/daizutabi/hydraflow/coverage.svg?branch=main
|
17
|
+
[codecov-link]: https://codecov.io/github/daizutabi/hydraflow?branch=main
|
18
|
+
[docs-image]: https://readthedocs.org/projects/hydraflow/badge/?version=latest
|
19
|
+
[docs-link]: https://daizutabi.github.io/hydraflow/
|
20
|
+
|
21
|
+
## Overview
|
22
|
+
|
23
|
+
Hydraflow is a library designed to seamlessly integrate
|
24
|
+
[Hydra](https://hydra.cc/) and [MLflow](https://mlflow.org/), making it easier to
|
25
|
+
manage and track machine learning experiments. By combining the flexibility of
|
26
|
+
Hydra's configuration management with the robust experiment tracking capabilities
|
27
|
+
of MLflow, Hydraflow provides a comprehensive solution for managing complex
|
28
|
+
machine learning workflows.
|
29
|
+
|
30
|
+
## Key Features
|
31
|
+
|
32
|
+
- **Configuration Management**: Utilize Hydra's advanced configuration management
|
33
|
+
to handle complex parameter sweeps and experiment setups.
|
34
|
+
- **Experiment Tracking**: Leverage MLflow's tracking capabilities to log parameters,
|
35
|
+
metrics, and artifacts for each run.
|
36
|
+
- **Artifact Management**: Automatically log and manage artifacts, such as model
|
37
|
+
checkpoints and configuration files, with MLflow.
|
38
|
+
- **Seamless Integration**: Easily integrate Hydra and MLflow in your machine learning
|
39
|
+
projects with minimal setup.
|
40
|
+
- **Rich CLI Interface**: Command-line tools for managing experiments and viewing results.
|
41
|
+
- **Cross-Platform Support**: Works consistently across different operating systems.
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
|
45
|
+
You can install Hydraflow via pip:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
pip install hydraflow
|
49
|
+
```
|
50
|
+
|
51
|
+
## Quick Start
|
52
|
+
|
53
|
+
Here is a simple example to get you started with Hydraflow:
|
54
|
+
|
55
|
+
```python
|
56
|
+
from __future__ import annotations
|
57
|
+
|
58
|
+
from dataclasses import dataclass
|
59
|
+
from typing import TYPE_CHECKING
|
60
|
+
|
61
|
+
import hydraflow
|
62
|
+
import mlflow
|
63
|
+
|
64
|
+
if TYPE_CHECKING:
|
65
|
+
from mlflow.entities import Run
|
66
|
+
|
67
|
+
|
68
|
+
@dataclass
|
69
|
+
class Config:
|
70
|
+
"""Configuration for the ML training experiment."""
|
71
|
+
# Training hyperparameters
|
72
|
+
learning_rate: float = 0.001
|
73
|
+
batch_size: int = 32
|
74
|
+
epochs: int = 10
|
75
|
+
|
76
|
+
# Model architecture parameters
|
77
|
+
hidden_size: int = 128
|
78
|
+
dropout: float = 0.1
|
79
|
+
|
80
|
+
# Dataset parameters
|
81
|
+
train_size: float = 0.8
|
82
|
+
random_seed: int = 42
|
83
|
+
|
84
|
+
|
85
|
+
@hydraflow.main(Config)
|
86
|
+
def app(run: Run, cfg: Config):
|
87
|
+
"""Train a model with the given configuration.
|
88
|
+
|
89
|
+
This example demonstrates how to:
|
90
|
+
|
91
|
+
1. Define a configuration using dataclasses
|
92
|
+
2. Use Hydraflow to integrate with MLflow
|
93
|
+
3. Track metrics and parameters automatically
|
94
|
+
|
95
|
+
Args:
|
96
|
+
run: MLflow run for the experiment corresponding to the Hydra app.
|
97
|
+
This `Run` instance is automatically created by Hydraflow.
|
98
|
+
cfg: Configuration for the experiment's run.
|
99
|
+
This `Config` instance is originally defined by Hydra, and then
|
100
|
+
automatically passed to the app by Hydraflow.
|
101
|
+
"""
|
102
|
+
# Training loop
|
103
|
+
for epoch in range(cfg.epochs):
|
104
|
+
# Simulate training and validation
|
105
|
+
train_loss = 1.0 / (epoch + 1)
|
106
|
+
val_loss = 1.1 / (epoch + 1)
|
107
|
+
|
108
|
+
# Log metrics to MLflow
|
109
|
+
mlflow.log_metrics({
|
110
|
+
"train_loss": train_loss,
|
111
|
+
"val_loss": val_loss
|
112
|
+
}, step=epoch)
|
113
|
+
|
114
|
+
print(f"Epoch {epoch}: train_loss={train_loss:.4f}, val_loss={val_loss:.4f}")
|
115
|
+
|
116
|
+
|
117
|
+
if __name__ == "__main__":
|
118
|
+
app()
|
119
|
+
```
|
120
|
+
|
121
|
+
This example demonstrates:
|
122
|
+
|
123
|
+
- Configuration management with Hydra
|
124
|
+
- Automatic experiment tracking with MLflow
|
125
|
+
- Parameter logging and metric tracking
|
126
|
+
- Type-safe configuration with dataclasses
|
127
|
+
|
128
|
+
## Documentation
|
129
|
+
|
130
|
+
For detailed documentation, including advanced usage examples and API reference,
|
131
|
+
visit our [documentation site](https://daizutabi.github.io/hydraflow/).
|
132
|
+
|
133
|
+
## Contributing
|
134
|
+
|
135
|
+
We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
|
136
|
+
|
137
|
+
## License
|
138
|
+
|
139
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
@@ -4,22 +4,40 @@ build-backend = "hatchling.build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "hydraflow"
|
7
|
-
version = "0.14.
|
8
|
-
description = "
|
7
|
+
version = "0.14.3"
|
8
|
+
description = "HydraFlow seamlessly integrates Hydra and MLflow to streamline ML experiment management. It combines Hydra's configuration management with MLflow's tracking capabilities, offering automated experiment tracking, versioning, and a rich CLI interface. Perfect for ML researchers and teams who need reproducibility while scaling experiments."
|
9
9
|
readme = "README.md"
|
10
10
|
license = { file = "LICENSE" }
|
11
11
|
authors = [{ name = "daizutabi", email = "daizutabi@gmail.com" }]
|
12
12
|
classifiers = [
|
13
13
|
"Development Status :: 4 - Beta",
|
14
|
+
"Environment :: Console",
|
15
|
+
"Intended Audience :: Developers",
|
16
|
+
"Intended Audience :: Science/Research",
|
14
17
|
"License :: OSI Approved :: MIT License",
|
18
|
+
"Operating System :: OS Independent",
|
15
19
|
"Programming Language :: Python",
|
16
20
|
"Programming Language :: Python :: 3.10",
|
17
21
|
"Programming Language :: Python :: 3.11",
|
18
22
|
"Programming Language :: Python :: 3.12",
|
19
23
|
"Programming Language :: Python :: 3.13",
|
24
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
20
26
|
]
|
21
27
|
requires-python = ">=3.10"
|
28
|
+
keywords = [
|
29
|
+
"machine-learning",
|
30
|
+
"mlflow",
|
31
|
+
"hydra",
|
32
|
+
"experiment-tracking",
|
33
|
+
"mlops",
|
34
|
+
"ai",
|
35
|
+
"deep-learning",
|
36
|
+
"research",
|
37
|
+
"data-science",
|
38
|
+
]
|
22
39
|
dependencies = [
|
40
|
+
|
23
41
|
"hydra-core>=1.3",
|
24
42
|
"mlflow>=2.15",
|
25
43
|
"omegaconf>=2.3",
|
@@ -0,0 +1,54 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import logging
|
4
|
+
import time
|
5
|
+
from dataclasses import dataclass
|
6
|
+
from typing import TYPE_CHECKING
|
7
|
+
|
8
|
+
import hydraflow
|
9
|
+
|
10
|
+
if TYPE_CHECKING:
|
11
|
+
from mlflow.entities import Run
|
12
|
+
|
13
|
+
log = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
|
16
|
+
@dataclass
|
17
|
+
class Config:
|
18
|
+
"""Configuration for the example app.
|
19
|
+
|
20
|
+
Attributes:
|
21
|
+
count: Number of iterations to run
|
22
|
+
name: Identifier for the run
|
23
|
+
"""
|
24
|
+
|
25
|
+
count: int = 1
|
26
|
+
name: str = "a"
|
27
|
+
|
28
|
+
|
29
|
+
@hydraflow.main(Config)
|
30
|
+
def app(run: Run, cfg: Config):
|
31
|
+
"""Example app demonstrating Hydraflow's basic functionality.
|
32
|
+
|
33
|
+
This app shows how to:
|
34
|
+
|
35
|
+
1. Define a configuration using dataclasses
|
36
|
+
2. Use the Hydraflow decorator to integrate with MLflow
|
37
|
+
3. Access the MLflow run object and configuration
|
38
|
+
|
39
|
+
Args:
|
40
|
+
run: MLflow run object for tracking metrics and parameters
|
41
|
+
cfg: Configuration object containing run parameters
|
42
|
+
"""
|
43
|
+
# Start the run
|
44
|
+
log.info("start")
|
45
|
+
|
46
|
+
# Simulate some work
|
47
|
+
time.sleep(0.2)
|
48
|
+
|
49
|
+
# End the run
|
50
|
+
log.info("end")
|
51
|
+
|
52
|
+
|
53
|
+
if __name__ == "__main__":
|
54
|
+
app()
|
hydraflow-0.14.2/README.md
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# Hydraflow
|
2
|
-
|
3
|
-
[![PyPI Version][pypi-v-image]][pypi-v-link]
|
4
|
-
[![Python Version][python-v-image]][python-v-link]
|
5
|
-
[![Build Status][GHAction-image]][GHAction-link]
|
6
|
-
[![Coverage Status][codecov-image]][codecov-link]
|
7
|
-
|
8
|
-
<!-- Badges -->
|
9
|
-
[pypi-v-image]: https://img.shields.io/pypi/v/hydraflow.svg
|
10
|
-
[pypi-v-link]: https://pypi.org/project/hydraflow/
|
11
|
-
[python-v-image]: https://img.shields.io/pypi/pyversions/hydraflow.svg
|
12
|
-
[python-v-link]: https://pypi.org/project/hydraflow
|
13
|
-
[GHAction-image]: https://github.com/daizutabi/hydraflow/actions/workflows/ci.yaml/badge.svg?branch=main&event=push
|
14
|
-
[GHAction-link]: https://github.com/daizutabi/hydraflow/actions?query=event%3Apush+branch%3Amain
|
15
|
-
[codecov-image]: https://codecov.io/github/daizutabi/hydraflow/coverage.svg?branch=main
|
16
|
-
[codecov-link]: https://codecov.io/github/daizutabi/hydraflow?branch=main
|
17
|
-
|
18
|
-
## Overview
|
19
|
-
|
20
|
-
Hydraflow is a library designed to seamlessly integrate
|
21
|
-
[Hydra](https://hydra.cc/) and [MLflow](https://mlflow.org/), making it easier to
|
22
|
-
manage and track machine learning experiments. By combining the flexibility of
|
23
|
-
Hydra's configuration management with the robust experiment tracking capabilities
|
24
|
-
of MLflow, Hydraflow provides a comprehensive solution for managing complex
|
25
|
-
machine learning workflows.
|
26
|
-
|
27
|
-
## Key Features
|
28
|
-
|
29
|
-
- **Configuration Management**: Utilize Hydra's advanced configuration management
|
30
|
-
to handle complex parameter sweeps and experiment setups.
|
31
|
-
- **Experiment Tracking**: Leverage MLflow's tracking capabilities to log parameters,
|
32
|
-
metrics, and artifacts for each run.
|
33
|
-
- **Artifact Management**: Automatically log and manage artifacts, such as model
|
34
|
-
checkpoints and configuration files, with MLflow.
|
35
|
-
- **Seamless Integration**: Easily integrate Hydra and MLflow in your machine learning
|
36
|
-
projects with minimal setup.
|
37
|
-
|
38
|
-
## Installation
|
39
|
-
|
40
|
-
You can install Hydraflow via pip:
|
41
|
-
|
42
|
-
```bash
|
43
|
-
pip install hydraflow
|
44
|
-
```
|
45
|
-
|
46
|
-
## Getting Started
|
47
|
-
|
48
|
-
Here is a simple example to get you started with Hydraflow:
|
49
|
-
|
50
|
-
```python
|
51
|
-
from __future__ import annotations
|
52
|
-
|
53
|
-
from dataclasses import dataclass
|
54
|
-
from typing import TYPE_CHECKING
|
55
|
-
|
56
|
-
import hydraflow
|
57
|
-
|
58
|
-
if TYPE_CHECKING:
|
59
|
-
from mlflow.entities import Run
|
60
|
-
|
61
|
-
|
62
|
-
@dataclass
|
63
|
-
class Config:
|
64
|
-
count: int = 1
|
65
|
-
name: str = "a"
|
66
|
-
|
67
|
-
|
68
|
-
@hydraflow.main(Config)
|
69
|
-
def app(run: Run, cfg: Config):
|
70
|
-
"""Your app code here."""
|
71
|
-
|
72
|
-
|
73
|
-
if __name__ == "__main__":
|
74
|
-
app()
|
75
|
-
```
|
@@ -1,30 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
import logging
|
4
|
-
import time
|
5
|
-
from dataclasses import dataclass
|
6
|
-
from typing import TYPE_CHECKING
|
7
|
-
|
8
|
-
import hydraflow
|
9
|
-
|
10
|
-
if TYPE_CHECKING:
|
11
|
-
from mlflow.entities import Run
|
12
|
-
|
13
|
-
log = logging.getLogger(__name__)
|
14
|
-
|
15
|
-
|
16
|
-
@dataclass
|
17
|
-
class Config:
|
18
|
-
count: int = 1
|
19
|
-
name: str = "a"
|
20
|
-
|
21
|
-
|
22
|
-
@hydraflow.main(Config)
|
23
|
-
def app(run: Run, cfg: Config):
|
24
|
-
log.info("start")
|
25
|
-
time.sleep(0.2)
|
26
|
-
log.info("end")
|
27
|
-
|
28
|
-
|
29
|
-
if __name__ == "__main__":
|
30
|
-
app()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|