Skip to content

Commit

Permalink
added logging to Tuner
Browse files Browse the repository at this point in the history
  • Loading branch information
klemen1999 committed May 13, 2024
1 parent 7f6aa1f commit e66d325
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions luxonis_train/core/tuner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os.path as osp
from typing import Any
from logging import getLogger

import lightning.pytorch as pl
import optuna
Expand All @@ -13,6 +14,8 @@

from .core import Core

logger = getLogger(__name__)


class Tuner(Core):
def __init__(self, cfg: str | dict, args: list[str] | tuple[str, ...] | None):
Expand All @@ -32,6 +35,7 @@ def __init__(self, cfg: str | dict, args: list[str] | tuple[str, ...] | None):

def tune(self) -> None:
"""Runs Optuna tunning of hyperparameters."""
logger.info("Starting tuning...")

pruner = (
optuna.pruners.MedianPruner()
Expand Down Expand Up @@ -66,6 +70,8 @@ def tune(self) -> None:
timeout=self.tune_cfg.timeout,
)

logger.info(f"Best study parameters: {study.best_params}")

def _objective(self, trial: optuna.trial.Trial) -> float:
"""Objective function used to optimize Optuna study."""
rank = rank_zero_only.rank
Expand Down

0 comments on commit e66d325

Please sign in to comment.