summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2020-12-26 20:26:48 +0800
committerJordan Gong <jordan.gong@protonmail.com>2020-12-26 20:26:48 +0800
commitd5f7cdab1466566d805f9cbf81c05767880886ae (patch)
tree99a7d95582518e9ffdf44f67fa9691daaa46ee90 /utils
parente7bac6ab39b9abbbcbdcf10d565df4863510f0d9 (diff)
Add config file and corresponding type hint
Diffstat (limited to 'utils')
-rw-r--r--utils/configuration.py48
1 files changed, 48 insertions, 0 deletions
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