Skip to content

Commit

Permalink
Merge pull request #338 from luiscarm9/patch-12
Browse files Browse the repository at this point in the history
Neptune utils for version 2.2.0
  • Loading branch information
jamesdolezal authored Feb 9, 2024
2 parents f5914e4 + 7d2ca54 commit 7cacb9b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions slideflow/util/neptune_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def start_run(
'''Starts a neptune run'''

from neptune import management

import neptune

if tags is None:
tags = []
project_name = project.replace("_", "-").replace(".", "-")
Expand Down Expand Up @@ -74,7 +75,7 @@ def log_config(self, hp_data: Dict, stage: str) -> None:
}
self.run['backend'] = sf.backend()
self.run['project_info'] = {key: stringify_unsupported(hp_data[key]) for key in proj_keys}
self.run['outcomes'] = outcomes
self.run['outcomes'] = str(outcomes)
self.run['model_params/validation'] = stringify_unsupported(validation_params)
self._log_hp(hp_data, 'stage', 'stage')
self._log_hp(hp_data, 'model_params/hp', 'hp')
Expand All @@ -94,8 +95,9 @@ def log_config(self, hp_data: Dict, stage: str) -> None:
self._log_hp(hp_data, 'eval/max_tiles', 'max_tiles')

def _log_hp(self, hp_data, run_key, hp_key) -> None:
from neptune.utils import stringify_unsupported
try:
self.run[run_key] = hp_data[hp_key]
self.run[run_key] = stringify_unsupported(hp_data[hp_key])
except KeyError:
log.debug(f"Unable to log Neptune hp_data key '{hp_key}'")

Expand Down

0 comments on commit 7cacb9b

Please sign in to comment.