ExperimentTracker¶
gepa.logging.experiment_tracker.ExperimentTracker(use_wandb: bool = False, wandb_api_key: str | None = None, wandb_init_kwargs: dict[str, Any] | None = None, wandb_attach_existing: bool = False, wandb_step_metric: str | None = None, use_mlflow: bool = False, mlflow_tracking_uri: str | None = None, mlflow_experiment_name: str | None = None, mlflow_attach_existing: bool = False, key_prefix: str = '')
¶
Unified experiment tracking that supports both wandb and mlflow.
Source code in gepa/logging/experiment_tracker.py
Attributes¶
use_wandb = use_wandb
instance-attribute
¶
use_mlflow = use_mlflow
instance-attribute
¶
wandb_api_key = wandb_api_key
instance-attribute
¶
wandb_init_kwargs = wandb_init_kwargs or {}
instance-attribute
¶
wandb_attach_existing = wandb_attach_existing
instance-attribute
¶
wandb_step_metric = wandb_step_metric
instance-attribute
¶
mlflow_tracking_uri = mlflow_tracking_uri
instance-attribute
¶
mlflow_experiment_name = mlflow_experiment_name
instance-attribute
¶
mlflow_attach_existing = mlflow_attach_existing
instance-attribute
¶
key_prefix = key_prefix
instance-attribute
¶
Functions¶
__enter__()
¶
__exit__(exc_type, exc_val, exc_tb)
¶
initialize()
¶
start_run()
¶
Start a new run.
When wandb_attach_existing=True the tracker skips wandb.init()
and logs into whatever run is already active in the process.
When mlflow_attach_existing=True the tracker skips
mlflow.start_run() and logs into the already-active MLflow run.
In both cases end_run() will not terminate the run.
Source code in gepa/logging/experiment_tracker.py
log_config(config: dict[str, Any]) -> None
¶
Log run configuration/hyperparameters to the active backends.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
Flat dict of config key-value pairs. Non-serializable values are converted to strings. |
required |
Source code in gepa/logging/experiment_tracker.py
log_metrics(metrics: dict[str, Any], step: int | None = None)
¶
Log metrics to the active backends.
Source code in gepa/logging/experiment_tracker.py
log_summary(summary: dict[str, Any]) -> None
¶
Log run summary data (visible on the run overview page).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
dict[str, Any]
|
Key-value pairs for the run summary. Supports strings, numbers, and other serializable values. |
required |
Source code in gepa/logging/experiment_tracker.py
log_table(table_name: str, columns: list[str], data: list[list[Any]]) -> None
¶
Log a table to the active backends.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name
|
str
|
Name/key for the table. |
required |
columns
|
list[str]
|
Column headers. |
required |
data
|
list[list[Any]]
|
Rows of data (each row is a list matching columns). |
required |
Source code in gepa/logging/experiment_tracker.py
log_html(html_content: str, key: str = 'candidate_tree') -> None
¶
Log an HTML string as a rich media artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
html_content
|
str
|
Self-contained HTML string. |
required |
key
|
str
|
Artifact key / name used in the dashboard. |
'candidate_tree'
|
Source code in gepa/logging/experiment_tracker.py
end_run()
¶
End the current run.
When wandb_attach_existing=True or mlflow_attach_existing=True
the respective run is left open — the caller owns its lifecycle.
Source code in gepa/logging/experiment_tracker.py
is_active() -> bool
¶
Check if any backend has an active run.