Add your description here
Project description
MLflow Sweep
MLflow Sweep is an extension of MLflow that adds functionality for hyperparameter optimization.
🌟 Features
- 🚀 Seamless integration with MLflow for experiment tracking
- 📊 Comprehensive hyperparameter sweeping capabilities
- 📈 Visualization of sweep results
- 🔄 Support for multiple sweep strategies (grid search, random, Bayesian)
- 🧩 Extensible architecture for custom sweep configurations
🔧 Installation
pip install mlflow-sweep
Development setup
# Clone the repository
git clone https://github.com/yourusername/mlflow_sweep
cd mlflow_sweep
# Install using uv with development dependencies
uv sync --dev
📋 Requirements
- Python 3.11+
- MLflow
In particular, because Python uses a last install wins strategy, you should ensure that the mlflow-sweep package is
installed after MLflow. The reason for this is that mlflow-sweep extends the MLflow CLI with a new command
mlflow sweep and this command will not be available if mlflow was the last package installed/updated.
📖 Usage
Start by creating a sweep configuration file (e.g., sweep_config.yaml) that defines what command to run, the
parameters to sweep over and the sweep strategy. Here is an example configuration:
command:
uv run example.py
--learning-rate ${learning_rate}
--batch-size ${batch_size}
experiment_name: sweep-demo
sweep_name: test-sweep
method: random
parameters:
learning_rate:
distribution: uniform
min: 0.001
max: 0.1
batch_size:
values: [16, 32, 64, 128]
run_cap: 10
The configuration file uses close to the same syntax as Weights & Biases (W&B)
sweeps, in particular the parameters section
is exactly the same.
Then use the mlflow sweep init command to initialize the sweep:
mlflow sweep init sweep_config.yaml
This will create a sweep (a parent run in MLflow) which is just a MLflow run with the sweep configuration saved as an artifact. It will return the ID of the sweep run.
Then you can use the mlflow sweep run command to start the sweep:
mlflow sweep run --sweep-id=<sweep_id>
The --sweep-id argument is the ID of the sweep run created in the previous step. It is an optional argument and if
not provided we will look for the most recent initialized sweep run in the current directory. The mlflow sweep run
command can be executed in parallel to parallelize the search process. The process will either stop when the run_cap
is reached or when all combinations of the parameters have been tried (only applicable for grid search).
Finally, you can use the mlflow sweep finalize command to finalize the sweep:
mlflow sweep finalize --sweep-id=<sweep_id>
This will mark the sweep as completed and do a final analysis of the results. The final analysis will be saved as artifacts to the parent sweep run.
❕ License
Package is licensed under Apache 2.0 license. See the LICENSE file for details. If you use this tool in your research, please cite it as:
@misc{mlflow_sweep,
author = {Nicki Skafte Detlefsen},
title = {MLflow Sweep: A tool for hyperparameter optimization with MLflow},
howpublished = {\url{https://github.com/SkafteNicki/mlflow_sweep}},
year = {2025}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlflow_sweep-0.1.0.tar.gz.
File metadata
- Download URL: mlflow_sweep-0.1.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93e38f1ad71a42fbabaa726d17c01fa1548b511d3b4b8e8ad4c85c476c69ccc6
|
|
| MD5 |
452f1d98f5a018e79a212aef40b25456
|
|
| BLAKE2b-256 |
016d14262ed2f19d752c1be3c1e6b7cfb4ca71010755188eb2190cfbecf3f561
|
File details
Details for the file mlflow_sweep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mlflow_sweep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cac3a0a31ea1be934330894814c8e65691f998e800c76c9743f0283591b16fb8
|
|
| MD5 |
5d433a4a58248ce51f4e22665de56295
|
|
| BLAKE2b-256 |
6c262903544811f019d3b6dfcafaab06caae158fd3ae0cbc4b3860175b8dfce9
|