From d5f7cdab1466566d805f9cbf81c05767880886ae Mon Sep 17 00:00:00 2001 From: Jordan Gong Date: Sat, 26 Dec 2020 20:26:48 +0800 Subject: Add config file and corresponding type hint --- utils/configuration.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 utils/configuration.py (limited to 'utils') diff --git a/utils/configuration.py b/utils/configuration.py new file mode 100644 index 0000000..32b9bec --- /dev/null +++ b/utils/configuration.py @@ -0,0 +1,48 @@ +from typing import TypedDict, Tuple + +import torch + + +class SystemConfiguration(TypedDict): + device: torch.device + CUDA_VISIBLE_DEVICES: str + save_path: str + + +class DatasetConfiguration(TypedDict): + name: str + path: str + train_size: int + num_sampled_frames: int + discard_threshold: int + num_input_channels: int + frame_size: Tuple[int, int] + cache_on: bool + + +class DataloaderConfiguration(TypedDict): + batch_size: Tuple[int, int] + num_workers: int + pin_memory: bool + + +class HyperparameterConfiguration(TypedDict): + hidden_dim: int + lr: int + betas: Tuple[float, float] + hard_or_all: str + margin: float + + +class ModelConfiguration(TypedDict): + name: str + restore_iter: int + total_iter: int + + +class Configuration(TypedDict): + system: SystemConfiguration + dataset: DatasetConfiguration + dataloader: DataloaderConfiguration + hyperparameter: HyperparameterConfiguration + model: ModelConfiguration -- cgit v1.2.3