Extract training functions
This commit is contained in:
parent
c966866abc
commit
d336ec3be6
4 changed files with 183 additions and 0 deletions
|
|
@ -1,7 +0,0 @@
|
|||
from pathlib import Path
|
||||
|
||||
|
||||
def get_next_run_name(path: Path, prefix: str = "run") -> str:
|
||||
run_ids = [int(run.stem.split("_")[1]) for run in path.glob(f"{prefix}_*")]
|
||||
next_run_id = max(run_ids, default=-1) + 1
|
||||
return f"{prefix}_{next_run_id}"
|
||||
5
src/utils/serialise_hparams.py
Normal file
5
src/utils/serialise_hparams.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from typing import Any, Dict
|
||||
|
||||
|
||||
def serialise_hparams(hyperparameters: Dict[str, Any]) -> Dict[str, Any]:
|
||||
return {k: str(v) if isinstance(v, list) else v for k, v in hyperparameters.items()}
|
||||
Loading…
Add table
Add a link
Reference in a new issue