-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
29 lines (26 loc) · 829 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import yaml
import torch
paths = yaml.safe_load(open("paths.yaml", "r"))
os.makedirs(paths["pretrained_checkpoints"], exist_ok=True)
os.makedirs(paths["precalculated_embeddings"], exist_ok=True)
config = {
"pretrained_checkpoint_dir": paths["pretrained_checkpoints"],
"device": "cuda" if torch.cuda.is_available() else "cpu",
"gpu_count": torch.cuda.device_count(),
"dataloader": {
"num_workers": min(10, os.cpu_count()),
"precalculated_embeddings_path": paths["precalculated_embeddings"],
},
"datasets": {
"imagenet": {
"path": paths["datasets"]["imagenet"],
},
"inaturalist": {
"path": paths["datasets"]["inaturalist"],
},
"imagenet_d": {
"path": paths["datasets"]["imagenet_d"],
}
},
}